Skip to content

Commit cca9c71

Browse files
BordaSherin Thomas
authored andcommitted
fix imports of collections.abc for py3.10 (#14345)
fix collections.abc for py3.10 Co-authored-by: Sherin Thomas <[email protected]>
1 parent 6661f00 commit cca9c71

File tree

7 files changed

+7
-13
lines changed

7 files changed

+7
-13
lines changed

src/lightning_app/utilities/apply_func.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515

1616
import dataclasses
1717
from collections import defaultdict, OrderedDict
18-
from collections.abc import Mapping, Sequence
1918
from copy import deepcopy
20-
from typing import Any, Callable, Optional, Tuple, Union
19+
from typing import Any, Callable, Mapping, Optional, Sequence, Tuple, Union
2120

2221
from lightning_app.utilities.exceptions import MisconfigurationException
2322

src/pytorch_lightning/trainer/connectors/logger_connector/result.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
from collections.abc import Generator
1514
from dataclasses import asdict, dataclass, replace
1615
from functools import partial, wraps
17-
from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Union
16+
from typing import Any, Callable, cast, Dict, Generator, List, Optional, Tuple, Union
1817

1918
import torch
2019
from torch import Tensor

src/pytorch_lightning/trainer/supporters.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from collections.abc import Iterable, Iterator, Mapping, Sequence
1615
from dataclasses import asdict, dataclass, field
17-
from typing import Any, Callable, Dict, List, Optional, Union
16+
from typing import Any, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Sequence, Union
1817

1918
import torch
2019
from torch.utils.data import Dataset

src/pytorch_lightning/utilities/apply_func.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
import operator
1818
from abc import ABC
1919
from collections import defaultdict, OrderedDict
20-
from collections.abc import Mapping, Sequence
2120
from copy import copy, deepcopy
2221
from functools import partial
23-
from typing import Any, Callable, List, Optional, Tuple, Union
22+
from typing import Any, Callable, List, Mapping, Optional, Sequence, Tuple, Union
2423

2524
import numpy as np
2625
import torch

src/pytorch_lightning/utilities/fetching.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
# limitations under the License.
1414

1515
from abc import ABC, abstractmethod
16-
from collections.abc import Iterable, Iterator
1716
from copy import deepcopy
18-
from typing import Any, Callable, List, Optional, Sized, Tuple
17+
from typing import Any, Callable, Iterable, Iterator, List, Optional, Sized, Tuple
1918

2019
import torch
2120
from torch.utils.data.dataloader import DataLoader

tests/tests_pytorch/overrides/test_distributed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
from collections.abc import Iterable
14+
from typing import Iterable
1515

1616
import pytest
1717
from torch.utils.data import BatchSampler, SequentialSampler

tests/tests_pytorch/utilities/test_auto_restart.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@
1717
import random
1818
import random as python_random
1919
from collections import defaultdict
20-
from collections.abc import Iterable
2120
from contextlib import suppress
2221
from copy import deepcopy
2322
from dataclasses import asdict
24-
from typing import Iterator, List, Optional
23+
from typing import Iterable, Iterator, List, Optional
2524
from unittest import mock
2625
from unittest.mock import ANY
2726

0 commit comments

Comments
 (0)