File tree 8 files changed +18
-30
lines changed
8 files changed +18
-30
lines changed Original file line number Diff line number Diff line change 13
13
TYPE_CHECKING ,
14
14
Any ,
15
15
Callable ,
16
+ Hashable ,
16
17
Sequence ,
17
18
cast ,
18
19
)
21
22
import numpy as np
22
23
23
24
from pandas ._libs .tslibs import Timestamp
24
- from pandas ._typing import (
25
- FrameOrSeries ,
26
- Hashable ,
27
- )
25
+ from pandas ._typing import FrameOrSeries
28
26
from pandas .util ._validators import validate_percentile
29
27
30
28
from pandas .core .dtypes .common import (
Original file line number Diff line number Diff line change 20
20
from pandas ._typing import (
21
21
ArrayLike ,
22
22
DtypeObj ,
23
- Optional ,
24
23
)
25
24
26
25
from pandas .core .dtypes .base import _registry as registry
@@ -1406,7 +1405,7 @@ def is_1d_only_ea_obj(obj: Any) -> bool:
1406
1405
)
1407
1406
1408
1407
1409
- def is_1d_only_ea_dtype (dtype : Optional [ DtypeObj ] ) -> bool :
1408
+ def is_1d_only_ea_dtype (dtype : DtypeObj | None ) -> bool :
1410
1409
"""
1411
1410
Analogue to is_extension_array_dtype but excluding DatetimeTZDtype.
1412
1411
"""
@@ -1471,7 +1470,7 @@ def is_extension_array_dtype(arr_or_dtype) -> bool:
1471
1470
return registry .find (dtype ) is not None
1472
1471
1473
1472
1474
- def is_ea_or_datetimelike_dtype (dtype : Optional [ DtypeObj ] ) -> bool :
1473
+ def is_ea_or_datetimelike_dtype (dtype : DtypeObj | None ) -> bool :
1475
1474
"""
1476
1475
Check for ExtensionDtype, datetime64 dtype, or timedelta64 dtype.
1477
1476
@@ -1715,7 +1714,7 @@ def _validate_date_like_dtype(dtype) -> None:
1715
1714
)
1716
1715
1717
1716
1718
- def validate_all_hashable (* args , error_name : Optional [ str ] = None ) -> None :
1717
+ def validate_all_hashable (* args , error_name : str | None = None ) -> None :
1719
1718
"""
1720
1719
Return None if all args are hashable, else raise a TypeError.
1721
1720
Original file line number Diff line number Diff line change 68
68
Scalar ,
69
69
StorageOptions ,
70
70
Suffixes ,
71
+ TimedeltaConvertibleTypes ,
72
+ TimestampConvertibleTypes ,
71
73
ValueKeyFunc ,
72
74
npt ,
73
75
)
209
211
210
212
if TYPE_CHECKING :
211
213
212
- from pandas ._typing import (
213
- TimedeltaConvertibleTypes ,
214
- TimestampConvertibleTypes ,
215
- )
216
-
217
214
from pandas .core .groupby .generic import DataFrameGroupBy
218
215
from pandas .core .resample import Resampler
219
216
Original file line number Diff line number Diff line change 3
3
"""
4
4
from __future__ import annotations
5
5
6
- from typing import TYPE_CHECKING
6
+ from typing import (
7
+ TYPE_CHECKING ,
8
+ Any ,
9
+ )
7
10
import warnings
8
11
9
12
import numpy as np
10
13
11
14
from pandas ._typing import (
12
- Any ,
13
15
AnyArrayLike ,
14
16
ArrayLike ,
15
17
)
Original file line number Diff line number Diff line change 7
7
from typing import (
8
8
TYPE_CHECKING ,
9
9
Any ,
10
+ Callable ,
10
11
Sequence ,
11
12
TypeVar ,
12
13
cast ,
27
28
Tick ,
28
29
parsing ,
29
30
)
30
- from pandas ._typing import (
31
- Callable ,
32
- final ,
33
- )
31
+ from pandas ._typing import final
34
32
from pandas .compat .numpy import function as nv
35
33
from pandas .util ._decorators import (
36
34
Appender ,
Original file line number Diff line number Diff line change 9
9
Timedelta ,
10
10
to_offset ,
11
11
)
12
- from pandas ._typing import (
13
- DtypeObj ,
14
- Optional ,
15
- )
12
+ from pandas ._typing import DtypeObj
16
13
17
14
from pandas .core .dtypes .common import (
18
15
TD64NS_DTYPE ,
@@ -233,7 +230,7 @@ def inferred_type(self) -> str:
233
230
def timedelta_range (
234
231
start = None ,
235
232
end = None ,
236
- periods : Optional [ int ] = None ,
233
+ periods : int | None = None ,
237
234
freq = None ,
238
235
name = None ,
239
236
closed = None ,
Original file line number Diff line number Diff line change 7
7
TYPE_CHECKING ,
8
8
Any ,
9
9
Callable ,
10
+ Hashable ,
10
11
TypeVar ,
11
12
)
12
13
19
20
from pandas ._typing import (
20
21
ArrayLike ,
21
22
DtypeObj ,
22
- Hashable ,
23
23
)
24
24
from pandas .util ._validators import validate_bool_kwarg
25
25
Original file line number Diff line number Diff line change 43
43
IndexKeyFunc ,
44
44
SingleManager ,
45
45
StorageOptions ,
46
+ TimedeltaConvertibleTypes ,
47
+ TimestampConvertibleTypes ,
46
48
ValueKeyFunc ,
47
49
npt ,
48
50
)
142
144
143
145
if TYPE_CHECKING :
144
146
145
- from pandas ._typing import (
146
- TimedeltaConvertibleTypes ,
147
- TimestampConvertibleTypes ,
148
- )
149
-
150
147
from pandas .core .frame import DataFrame
151
148
from pandas .core .groupby .generic import SeriesGroupBy
152
149
from pandas .core .resample import Resampler
You can’t perform that action at this time.
0 commit comments