File tree 16 files changed +145
-109
lines changed
16 files changed +145
-109
lines changed Original file line number Diff line number Diff line change 3
3
(and possibly TimedeltaArray/PeriodArray)
4
4
"""
5
5
from __future__ import annotations
6
+ from typing import (
7
+ TYPE_CHECKING ,
8
+ )
9
+
6
10
7
11
import numpy as np
8
12
14
18
Timestamp ,
15
19
iNaT ,
16
20
)
17
- from pandas ._typing import npt
18
21
22
+ if TYPE_CHECKING :
23
+ from pandas ._typing import npt
19
24
20
25
def generate_regular_range (
21
26
start : Timestamp | Timedelta | None ,
Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
-
2
+ from typing import (
3
+ TYPE_CHECKING ,)
3
4
from datetime import (
4
5
date ,
5
6
datetime ,
15
16
Timedelta ,
16
17
Timestamp ,
17
18
)
18
- from pandas ._typing import (
19
- TYPE_CHECKING ,
20
- DtypeObj ,
21
- type_t ,
22
- )
19
+
23
20
from pandas .compat import pa_version_under7p0
24
21
from pandas .util ._decorators import cache_readonly
25
22
33
30
34
31
if TYPE_CHECKING :
35
32
from pandas .core .arrays .arrow import ArrowExtensionArray
33
+ from pandas ._typing import (
34
+ DtypeObj ,
35
+ type_t ,
36
+ )
36
37
37
38
38
39
@register_extension_dtype
Original file line number Diff line number Diff line change 3
3
import json
4
4
5
5
import pyarrow
6
-
7
- from pandas . _typing import IntervalClosedType
6
+ from typing import (
7
+ TYPE_CHECKING ,)
8
8
9
9
from pandas .core .arrays .interval import VALID_CLOSED
10
10
11
+ if TYPE_CHECKING :
12
+ from pandas ._typing import IntervalClosedType
11
13
12
14
class ArrowPeriodType (pyarrow .ExtensionType ):
13
15
def __init__ (self , freq ) -> None :
Original file line number Diff line number Diff line change 25
25
import numpy as np
26
26
27
27
from pandas ._libs import lib
28
- from pandas ._typing import (
29
- ArrayLike ,
30
- AstypeArg ,
31
- AxisInt ,
32
- Dtype ,
33
- FillnaOptions ,
34
- PositionalIndexer ,
35
- ScalarIndexer ,
36
- SequenceIndexer ,
37
- Shape ,
38
- SortKind ,
39
- TakeIndexer ,
40
- npt ,
41
- )
28
+
42
29
from pandas .compat import set_function_name
43
30
from pandas .compat .numpy import function as nv
44
31
from pandas .errors import AbstractMethodError
93
80
NumpySorter ,
94
81
NumpyValueArrayLike ,
95
82
)
83
+ from pandas ._typing import (
84
+ ArrayLike ,
85
+ AstypeArg ,
86
+ AxisInt ,
87
+ Dtype ,
88
+ FillnaOptions ,
89
+ PositionalIndexer ,
90
+ ScalarIndexer ,
91
+ SequenceIndexer ,
92
+ Shape ,
93
+ SortKind ,
94
+ TakeIndexer ,
95
+ npt ,
96
+ )
96
97
97
98
_extension_array_shared_docs : dict [str , str ] = {}
98
99
Original file line number Diff line number Diff line change 12
12
lib ,
13
13
missing as libmissing ,
14
14
)
15
- from pandas ._typing import (
16
- Dtype ,
17
- DtypeObj ,
18
- type_t ,
19
- )
15
+
20
16
21
17
from pandas .core .dtypes .common import (
22
18
is_list_like ,
37
33
38
34
from pandas ._typing import npt
39
35
36
+ from pandas ._typing import (
37
+ Dtype ,
38
+ DtypeObj ,
39
+ type_t ,
40
+ )
41
+
40
42
41
43
@register_extension_dtype
42
44
class BooleanDtype (BaseMaskedDtype ):
Original file line number Diff line number Diff line change 25
25
lib ,
26
26
)
27
27
from pandas ._libs .arrays import NDArrayBacked
28
- from pandas ._typing import (
29
- ArrayLike ,
30
- AstypeArg ,
31
- AxisInt ,
32
- Dtype ,
33
- NpDtype ,
34
- Ordered ,
35
- Shape ,
36
- SortKind ,
37
- npt ,
38
- type_t ,
39
- )
28
+
40
29
from pandas .compat .numpy import function as nv
41
30
from pandas .util ._validators import validate_bool_kwarg
42
31
114
103
Index ,
115
104
Series ,
116
105
)
106
+ from pandas ._typing import (
107
+ ArrayLike ,
108
+ AstypeArg ,
109
+ AxisInt ,
110
+ Dtype ,
111
+ NpDtype ,
112
+ Ordered ,
113
+ Shape ,
114
+ SortKind ,
115
+ npt ,
116
+ type_t ,
117
+ )
117
118
118
119
119
120
CategoricalT = TypeVar ("CategoricalT" , bound = "Categorical" )
Original file line number Diff line number Diff line change 42
42
tzconversion ,
43
43
)
44
44
from pandas ._libs .tslibs .dtypes import abbrev_to_npy_unit
45
- from pandas ._typing import (
46
- DateTimeErrorChoices ,
47
- IntervalClosedType ,
48
- TimeAmbiguous ,
49
- TimeNonexistent ,
50
- npt ,
51
- )
45
+
52
46
from pandas .errors import PerformanceWarning
53
47
from pandas .util ._exceptions import find_stack_level
54
48
from pandas .util ._validators import validate_inclusive
89
83
if TYPE_CHECKING :
90
84
from pandas import DataFrame
91
85
from pandas .core .arrays import PeriodArray
86
+ from pandas ._typing import (
87
+ DateTimeErrorChoices ,
88
+ IntervalClosedType ,
89
+ TimeAmbiguous ,
90
+ TimeNonexistent ,
91
+ npt ,
92
+ )
92
93
93
94
_midnight = time (0 , 0 )
94
95
Original file line number Diff line number Diff line change 15
15
lib ,
16
16
missing as libmissing ,
17
17
)
18
- from pandas ._typing import (
19
- Dtype ,
20
- DtypeObj ,
21
- npt ,
22
- )
18
+
23
19
from pandas .errors import AbstractMethodError
24
20
from pandas .util ._decorators import cache_readonly
25
21
39
35
40
36
if TYPE_CHECKING :
41
37
import pyarrow
38
+ from pandas ._typing import (
39
+ Dtype ,
40
+ DtypeObj ,
41
+ npt ,
42
+ )
42
43
43
44
44
45
T = TypeVar ("T" , bound = "NumericArray" )
Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
+ from typing import (
3
+ TYPE_CHECKING ,
4
+ )
2
5
3
6
import numpy as np
4
7
7
10
get_unit_from_dtype ,
8
11
is_supported_unit ,
9
12
)
10
- from pandas ._typing import (
11
- AxisInt ,
12
- Dtype ,
13
- NpDtype ,
14
- Scalar ,
15
- npt ,
16
- )
13
+
17
14
from pandas .compat .numpy import function as nv
18
15
19
16
from pandas .core .dtypes .astype import astype_array
35
32
from pandas .core .construction import ensure_wrapped_if_datetimelike
36
33
from pandas .core .strings .object_array import ObjectStringArrayMixin
37
34
35
+ if TYPE_CHECKING :
36
+ from pandas ._typing import (
37
+ AxisInt ,
38
+ Dtype ,
39
+ NpDtype ,
40
+ Scalar ,
41
+ npt ,
42
+ )
38
43
39
44
class PandasArray (
40
45
OpsMixin ,
Original file line number Diff line number Diff line change 45
45
get_period_field_arr ,
46
46
period_asfreq_arr ,
47
47
)
48
- from pandas ._typing import (
49
- AnyArrayLike ,
50
- Dtype ,
51
- NpDtype ,
52
- npt ,
53
- )
48
+
54
49
from pandas .util ._decorators import (
55
50
cache_readonly ,
56
51
doc ,
90
85
TimedeltaArray ,
91
86
)
92
87
from pandas .core .arrays .base import ExtensionArray
88
+ from pandas ._typing import (
89
+ AnyArrayLike ,
90
+ Dtype ,
91
+ NpDtype ,
92
+ npt ,
93
+ )
93
94
94
95
95
96
BaseOffsetT = TypeVar ("BaseOffsetT" , bound = BaseOffset )
Original file line number Diff line number Diff line change 28
28
SparseIndex ,
29
29
)
30
30
from pandas ._libs .tslibs import NaT
31
- from pandas ._typing import (
32
- ArrayLike ,
33
- AstypeArg ,
34
- Axis ,
35
- AxisInt ,
36
- Dtype ,
37
- NpDtype ,
38
- PositionalIndexer ,
39
- Scalar ,
40
- ScalarIndexer ,
41
- SequenceIndexer ,
42
- npt ,
43
- )
31
+
44
32
from pandas .compat .numpy import function as nv
45
33
from pandas .errors import PerformanceWarning
46
34
from pandas .util ._exceptions import find_stack_level
@@ -122,6 +110,20 @@ class ellipsis(Enum):
122
110
123
111
from pandas import Series
124
112
113
+ from pandas ._typing import (
114
+ ArrayLike ,
115
+ AstypeArg ,
116
+ Axis ,
117
+ AxisInt ,
118
+ Dtype ,
119
+ NpDtype ,
120
+ PositionalIndexer ,
121
+ Scalar ,
122
+ ScalarIndexer ,
123
+ SequenceIndexer ,
124
+ npt ,
125
+ )
126
+
125
127
else :
126
128
ellipsis = type (Ellipsis )
127
129
Original file line number Diff line number Diff line change 10
10
11
11
import numpy as np
12
12
13
- from pandas ._typing import (
14
- Dtype ,
15
- DtypeObj ,
16
- type_t ,
17
- )
18
13
from pandas .errors import PerformanceWarning
19
14
from pandas .util ._exceptions import find_stack_level
20
15
37
32
38
33
if TYPE_CHECKING :
39
34
from pandas .core .arrays .sparse .array import SparseArray
40
-
35
+ from pandas ._typing import (
36
+ Dtype ,
37
+ DtypeObj ,
38
+ type_t ,
39
+ )
41
40
42
41
@register_extension_dtype
43
42
class SparseDtype (ExtensionDtype ):
Original file line number Diff line number Diff line change 10
10
Iterable ,
11
11
)
12
12
13
- import numpy as np
14
13
15
14
from pandas ._libs import lib
16
- from pandas ._typing import (
17
- IndexLabel ,
18
- npt ,
19
- )
15
+
20
16
21
17
from pandas .core .dtypes .missing import notna
22
18
26
22
27
23
if TYPE_CHECKING :
28
24
import scipy .sparse
25
+ from pandas ._typing import (
26
+ IndexLabel ,
27
+ npt ,
28
+ )
29
+ import numpy as np
29
30
30
31
31
32
def _check_is_partition (parts : Iterable , whole : Iterable ):
You can’t perform that action at this time.
0 commit comments