From c5f641882bfab50fa0b1eb92d705fb223d08a5df Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Mon, 23 Dec 2019 12:35:42 +0200 Subject: [PATCH 1/2] CLN: Use of Iterable from collections.abc instead of typing --- pandas/_typing.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/pandas/_typing.py b/pandas/_typing.py index 445eff9e19e47..b22c4ae48819e 100644 --- a/pandas/_typing.py +++ b/pandas/_typing.py @@ -1,15 +1,6 @@ +from collections.abc import Iterable from pathlib import Path -from typing import ( - IO, - TYPE_CHECKING, - AnyStr, - Dict, - Iterable, - List, - Optional, - TypeVar, - Union, -) +from typing import IO, TYPE_CHECKING, AnyStr, Dict, List, Optional, TypeVar, Union import numpy as np @@ -37,7 +28,6 @@ Ordered = Optional[bool] JSONSerializable = Union[Scalar, List, Dict] -# use Collection after we drop support for py35 Axes = Iterable # to maintain type information across generic functions and parametrization From bc00b8d6135693b862c1b1b086938562ebe0827c Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Tue, 24 Dec 2019 14:49:23 +0200 Subject: [PATCH 2/2] Applied @simonjayhawkins suggestion --- pandas/_typing.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pandas/_typing.py b/pandas/_typing.py index b22c4ae48819e..69b08c581cff9 100644 --- a/pandas/_typing.py +++ b/pandas/_typing.py @@ -1,6 +1,15 @@ -from collections.abc import Iterable from pathlib import Path -from typing import IO, TYPE_CHECKING, AnyStr, Dict, List, Optional, TypeVar, Union +from typing import ( + IO, + TYPE_CHECKING, + AnyStr, + Collection, + Dict, + List, + Optional, + TypeVar, + Union, +) import numpy as np @@ -28,7 +37,7 @@ Ordered = Optional[bool] JSONSerializable = Union[Scalar, List, Dict] -Axes = Iterable +Axes = Collection # to maintain type information across generic functions and parametrization _T = TypeVar("_T")