Skip to content

Commit

Permalink
Import certain types from collections.abc
Browse files Browse the repository at this point in the history
Import of these from `typing` is deprecated from Python 3.9.
  • Loading branch information
khaeru committed Nov 20, 2024
1 parent 38da489 commit 2f29f9a
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 22 deletions.
3 changes: 2 additions & 1 deletion message_ix/core.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import logging
import os
from collections.abc import Iterable, Mapping, Sequence
from functools import lru_cache, partial
from itertools import chain, product, zip_longest
from typing import Iterable, Mapping, Optional, Sequence, Union
from typing import Optional, Union
from warnings import warn

import ixmp
Expand Down
12 changes: 2 additions & 10 deletions message_ix/macro.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
import logging
import os
from collections.abc import Collection, Hashable, Iterable, Mapping, MutableMapping
from dataclasses import dataclass
from functools import partial
from operator import itemgetter, mul
from pathlib import Path
from typing import (
TYPE_CHECKING,
Collection,
Hashable,
Iterable,
Mapping,
MutableMapping,
Optional,
Union,
)
from typing import TYPE_CHECKING, Optional, Union

import numpy as np
import pandas as pd
Expand Down
3 changes: 2 additions & 1 deletion message_ix/models.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import logging
from collections import ChainMap
from collections.abc import Mapping, MutableMapping
from copy import copy
from dataclasses import InitVar, dataclass, field
from functools import partial
from pathlib import Path
from typing import Mapping, MutableMapping, Optional
from typing import Optional
from warnings import warn

import ixmp.model.gams
Expand Down
3 changes: 2 additions & 1 deletion message_ix/report/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import logging
from collections.abc import Mapping
from functools import lru_cache, partial
from operator import itemgetter
from typing import TYPE_CHECKING, Mapping, Union, cast
from typing import TYPE_CHECKING, Union, cast

from genno.operator import broadcast_map
from ixmp.report import (
Expand Down
8 changes: 2 additions & 6 deletions message_ix/report/operator.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
from typing import (
TYPE_CHECKING,
Literal,
Mapping,
overload,
)
from collections.abc import Mapping
from typing import TYPE_CHECKING, Literal, overload

import pandas as pd

Expand Down
3 changes: 2 additions & 1 deletion message_ix/testing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import io
import os
from collections.abc import Generator
from itertools import product
from pathlib import Path
from typing import TYPE_CHECKING, Generator, Optional, Union
from typing import TYPE_CHECKING, Optional, Union

import numpy as np
import pandas as pd
Expand Down
3 changes: 2 additions & 1 deletion message_ix/tests/report/test_operator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections.abc import Mapping
from functools import partial
from typing import Any, Mapping
from typing import Any

import matplotlib
import pandas as pd
Expand Down
3 changes: 2 additions & 1 deletion message_ix/tests/test_feature_vintage_and_active_years.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections.abc import Sequence
from functools import lru_cache
from typing import Optional, Sequence
from typing import Optional

import numpy as np
import pandas as pd
Expand Down

0 comments on commit 2f29f9a

Please sign in to comment.