Skip to content

Commit a2f4053

Browse files
TYP/CLN: implicit re-export (#42498)
1 parent d3a018d commit a2f4053

File tree

8 files changed

+18
-30
lines changed

8 files changed

+18
-30
lines changed

pandas/core/describe.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
TYPE_CHECKING,
1414
Any,
1515
Callable,
16+
Hashable,
1617
Sequence,
1718
cast,
1819
)
@@ -21,10 +22,7 @@
2122
import numpy as np
2223

2324
from pandas._libs.tslibs import Timestamp
24-
from pandas._typing import (
25-
FrameOrSeries,
26-
Hashable,
27-
)
25+
from pandas._typing import FrameOrSeries
2826
from pandas.util._validators import validate_percentile
2927

3028
from pandas.core.dtypes.common import (

pandas/core/dtypes/common.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from pandas._typing import (
2121
ArrayLike,
2222
DtypeObj,
23-
Optional,
2423
)
2524

2625
from pandas.core.dtypes.base import _registry as registry
@@ -1406,7 +1405,7 @@ def is_1d_only_ea_obj(obj: Any) -> bool:
14061405
)
14071406

14081407

1409-
def is_1d_only_ea_dtype(dtype: Optional[DtypeObj]) -> bool:
1408+
def is_1d_only_ea_dtype(dtype: DtypeObj | None) -> bool:
14101409
"""
14111410
Analogue to is_extension_array_dtype but excluding DatetimeTZDtype.
14121411
"""
@@ -1471,7 +1470,7 @@ def is_extension_array_dtype(arr_or_dtype) -> bool:
14711470
return registry.find(dtype) is not None
14721471

14731472

1474-
def is_ea_or_datetimelike_dtype(dtype: Optional[DtypeObj]) -> bool:
1473+
def is_ea_or_datetimelike_dtype(dtype: DtypeObj | None) -> bool:
14751474
"""
14761475
Check for ExtensionDtype, datetime64 dtype, or timedelta64 dtype.
14771476
@@ -1715,7 +1714,7 @@ def _validate_date_like_dtype(dtype) -> None:
17151714
)
17161715

17171716

1718-
def validate_all_hashable(*args, error_name: Optional[str] = None) -> None:
1717+
def validate_all_hashable(*args, error_name: str | None = None) -> None:
17191718
"""
17201719
Return None if all args are hashable, else raise a TypeError.
17211720

pandas/core/frame.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
Scalar,
6969
StorageOptions,
7070
Suffixes,
71+
TimedeltaConvertibleTypes,
72+
TimestampConvertibleTypes,
7173
ValueKeyFunc,
7274
npt,
7375
)
@@ -209,11 +211,6 @@
209211

210212
if TYPE_CHECKING:
211213

212-
from pandas._typing import (
213-
TimedeltaConvertibleTypes,
214-
TimestampConvertibleTypes,
215-
)
216-
217214
from pandas.core.groupby.generic import DataFrameGroupBy
218215
from pandas.core.resample import Resampler
219216

pandas/core/indexers.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
"""
44
from __future__ import annotations
55

6-
from typing import TYPE_CHECKING
6+
from typing import (
7+
TYPE_CHECKING,
8+
Any,
9+
)
710
import warnings
811

912
import numpy as np
1013

1114
from pandas._typing import (
12-
Any,
1315
AnyArrayLike,
1416
ArrayLike,
1517
)

pandas/core/indexes/datetimelike.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from typing import (
88
TYPE_CHECKING,
99
Any,
10+
Callable,
1011
Sequence,
1112
TypeVar,
1213
cast,
@@ -27,10 +28,7 @@
2728
Tick,
2829
parsing,
2930
)
30-
from pandas._typing import (
31-
Callable,
32-
final,
33-
)
31+
from pandas._typing import final
3432
from pandas.compat.numpy import function as nv
3533
from pandas.util._decorators import (
3634
Appender,

pandas/core/indexes/timedeltas.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
Timedelta,
1010
to_offset,
1111
)
12-
from pandas._typing import (
13-
DtypeObj,
14-
Optional,
15-
)
12+
from pandas._typing import DtypeObj
1613

1714
from pandas.core.dtypes.common import (
1815
TD64NS_DTYPE,
@@ -233,7 +230,7 @@ def inferred_type(self) -> str:
233230
def timedelta_range(
234231
start=None,
235232
end=None,
236-
periods: Optional[int] = None,
233+
periods: int | None = None,
237234
freq=None,
238235
name=None,
239236
closed=None,

pandas/core/internals/array_manager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
TYPE_CHECKING,
88
Any,
99
Callable,
10+
Hashable,
1011
TypeVar,
1112
)
1213

@@ -19,7 +20,6 @@
1920
from pandas._typing import (
2021
ArrayLike,
2122
DtypeObj,
22-
Hashable,
2323
)
2424
from pandas.util._validators import validate_bool_kwarg
2525

pandas/core/series.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
IndexKeyFunc,
4444
SingleManager,
4545
StorageOptions,
46+
TimedeltaConvertibleTypes,
47+
TimestampConvertibleTypes,
4648
ValueKeyFunc,
4749
npt,
4850
)
@@ -142,11 +144,6 @@
142144

143145
if TYPE_CHECKING:
144146

145-
from pandas._typing import (
146-
TimedeltaConvertibleTypes,
147-
TimestampConvertibleTypes,
148-
)
149-
150147
from pandas.core.frame import DataFrame
151148
from pandas.core.groupby.generic import SeriesGroupBy
152149
from pandas.core.resample import Resampler

0 commit comments

Comments
 (0)