Skip to content

Commit f7f23c4

Browse files
committed
type_t
1 parent ca14374 commit f7f23c4

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

pandas-stubs/_typing.pyi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
from builtins import type as type_t
34
import datetime
45
from io import (
56
BufferedIOBase,
@@ -25,7 +26,7 @@ from typing import (
2526
)
2627

2728
import numpy as np
28-
import numpy.typing
29+
from numpy import typing as npt
2930
from pandas.core.arrays import ExtensionArray
3031
from pandas.core.frame import DataFrame
3132
from pandas.core.generic import NDFrame
@@ -40,8 +41,6 @@ from pandas._libs.tslibs import (
4041

4142
from pandas.core.dtypes.dtypes import ExtensionDtype
4243

43-
npt = numpy.typing
44-
4544
ArrayLike = Union[ExtensionArray, np.ndarray]
4645
AnyArrayLike = Union[Index, Series, np.ndarray]
4746
PythonScalar = Union[str, int, float, bool, complex]
@@ -208,3 +207,5 @@ GroupByObjectNonScalar = Union[
208207
tuple, list[Label], Function, Series, np.ndarray, Mapping[Label, Any], Index
209208
]
210209
GroupByObject = Union[Scalar, GroupByObjectNonScalar]
210+
211+
__all__ = ["npt", "type_t"]

pandas-stubs/core/arrays/boolean.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@ from __future__ import annotations
22

33
import numpy as np
44

5-
from pandas._typing import Scalar
5+
from pandas._typing import (
6+
Scalar,
7+
type_t,
8+
)
69

710
from pandas.core.dtypes.base import ExtensionDtype as ExtensionDtype
811

912
from .masked import BaseMaskedArray as BaseMaskedArray
1013

11-
_type = type
12-
_type_BooleanArray = type[BooleanArray]
13-
1414
class BooleanDtype(ExtensionDtype):
1515
name: str = ...
1616
@property
1717
def na_value(self) -> Scalar: ...
1818
@property
19-
def type(self) -> _type: ...
19+
def type(self) -> type_t: ...
2020
@property
2121
def kind(self) -> str: ...
2222
@classmethod
23-
def construct_array_type(cls) -> _type_BooleanArray: ...
23+
def construct_array_type(cls) -> type_t[BooleanArray]: ...
2424
def __from_arrow__(self, array): ...
2525

2626
def coerce_to_array(values, mask=..., copy: bool = ...): ...

pandas-stubs/core/arrays/string_.pyi

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@ from __future__ import annotations
22

33
from pandas.core.arrays import PandasArray as PandasArray
44

5-
from pandas.core.dtypes.base import ExtensionDtype as ExtensionDtype
5+
from pandas._typing import type_t
66

7-
_type = type
8-
_type_StringArray = type[StringArray]
7+
from pandas.core.dtypes.base import ExtensionDtype as ExtensionDtype
98

109
class StringDtype(ExtensionDtype):
1110
name: str = ...
1211
na_value = ...
1312
@property
14-
def type(self) -> _type: ...
13+
def type(self) -> type_t: ...
1514
@classmethod
16-
def construct_array_type(cls) -> _type_StringArray: ...
15+
def construct_array_type(cls) -> type_t[StringArray]: ...
1716
def __from_arrow__(self, array): ...
1817

1918
class StringArray(PandasArray):

pandas-stubs/core/dtypes/base.pyi

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ from __future__ import annotations
22

33
from pandas.core.arrays import ExtensionArray
44

5-
_type = type
6-
_type_ExtensionArray = type[ExtensionArray]
5+
from pandas._typing import type_t
76

87
class ExtensionDtype:
98
def __eq__(self, other) -> bool: ...
@@ -12,15 +11,15 @@ class ExtensionDtype:
1211
@property
1312
def na_value(self): ...
1413
@property
15-
def type(self) -> _type: ...
14+
def type(self) -> type_t: ...
1615
@property
1716
def kind(self) -> str: ...
1817
@property
1918
def name(self) -> str: ...
2019
@property
2120
def names(self) -> list[str] | None: ...
2221
@classmethod
23-
def construct_array_type(cls) -> _type_ExtensionArray: ...
22+
def construct_array_type(cls) -> type_t[ExtensionArray]: ...
2423
@classmethod
2524
def construct_from_string(cls, string: str): ...
2625
@classmethod

0 commit comments

Comments
 (0)