|
| 1 | +import datetime as dt |
1 | 2 | from typing import (
|
2 | 3 | Any,
|
3 |
| - Sequence, |
| 4 | + Literal, |
4 | 5 | )
|
5 | 6 |
|
| 7 | +import numpy as np |
6 | 8 | from pandas.core.indexes.base import Index
|
| 9 | +from pandas.core.series import Series |
7 | 10 |
|
8 |
| -from pandas._libs.tslibs import ( # , timezones as timezones |
9 |
| - Period as Period, |
10 |
| - Timestamp, |
| 11 | +from pandas._libs import NaTType |
| 12 | +from pandas._libs.tslibs import BaseOffset |
| 13 | +from pandas._typing import ( |
| 14 | + Ordered, |
| 15 | + npt, |
11 | 16 | )
|
12 |
| -from pandas._typing import Ordered |
13 | 17 |
|
14 | 18 | from .base import ExtensionDtype as ExtensionDtype
|
15 | 19 |
|
16 |
| -_str = str |
17 |
| - |
18 | 20 | def register_extension_dtype(cls: type[ExtensionDtype]) -> type[ExtensionDtype]: ...
|
19 | 21 |
|
20 | 22 | class BaseMaskedDtype(ExtensionDtype): ...
|
21 |
| - |
22 |
| -class PandasExtensionDtype(ExtensionDtype): |
23 |
| - subdtype = ... |
24 |
| - str: _str | None = ... |
25 |
| - num: int = ... |
26 |
| - shape: tuple[int, ...] = ... |
27 |
| - itemsize: int = ... |
28 |
| - base = ... |
29 |
| - isbuiltin: int = ... |
30 |
| - isnative: int = ... |
31 |
| - def __hash__(self) -> int: ... |
32 |
| - @classmethod |
33 |
| - def reset_cache(cls) -> None: ... |
34 |
| - |
35 |
| -class CategoricalDtypeType(type): ... |
| 23 | +class PandasExtensionDtype(ExtensionDtype): ... |
36 | 24 |
|
37 | 25 | class CategoricalDtype(PandasExtensionDtype, ExtensionDtype):
|
38 |
| - name: _str = ... |
39 |
| - type: type[CategoricalDtypeType] = ... |
40 |
| - kind: _str = ... |
41 |
| - str: _str = ... |
42 |
| - base = ... |
43 | 26 | def __init__(
|
44 |
| - self, categories: Sequence[Any] | None = ..., ordered: Ordered = ... |
| 27 | + self, |
| 28 | + categories: Series | Index | list[Any] | None = ..., |
| 29 | + ordered: Ordered = ..., |
45 | 30 | ) -> None: ...
|
46 |
| - @classmethod |
47 |
| - def construct_from_string(cls, string: _str) -> CategoricalDtype: ... |
48 |
| - def __hash__(self) -> int: ... |
49 |
| - def __eq__(self, other) -> bool: ... |
50 |
| - @classmethod |
51 |
| - def construct_array_type(cls): ... |
52 |
| - @staticmethod |
53 |
| - def validate_ordered(ordered: Ordered) -> None: ... |
54 |
| - @staticmethod |
55 |
| - def validate_categories(categories, fastpath: bool = ...): ... |
56 |
| - def update_dtype(self, dtype: _str | CategoricalDtype) -> CategoricalDtype: ... |
57 | 31 | @property
|
58 | 32 | def categories(self) -> Index: ...
|
59 | 33 | @property
|
60 | 34 | def ordered(self) -> Ordered: ...
|
61 | 35 |
|
62 | 36 | class DatetimeTZDtype(PandasExtensionDtype):
|
63 |
| - type: type[Timestamp] = ... |
64 |
| - kind: _str = ... |
65 |
| - str: _str = ... |
66 |
| - num: int = ... |
67 |
| - base = ... |
68 |
| - na_value = ... |
69 |
| - def __init__(self, unit: _str = ..., tz=...) -> None: ... |
| 37 | + def __init__( |
| 38 | + self, unit: Literal["ns"] = ..., tz: str | int | dt.tzinfo | None = ... |
| 39 | + ) -> None: ... |
70 | 40 | @property
|
71 |
| - def unit(self): ... |
| 41 | + def unit(self) -> Literal["ns"]: ... |
72 | 42 | @property
|
73 |
| - def tz(self): ... |
74 |
| - @classmethod |
75 |
| - def construct_array_type(cls): ... |
76 |
| - @classmethod |
77 |
| - def construct_from_string(cls, string: _str): ... |
| 43 | + def tz(self) -> dt.tzinfo: ... |
78 | 44 | @property
|
79 |
| - def name(self) -> _str: ... |
80 |
| - def __hash__(self) -> int: ... |
81 |
| - def __eq__(self, other) -> bool: ... |
| 45 | + def na_value(self) -> NaTType: ... |
82 | 46 |
|
83 | 47 | class PeriodDtype(PandasExtensionDtype):
|
84 |
| - type: type[Period] = ... |
85 |
| - kind: _str = ... |
86 |
| - str: _str = ... |
87 |
| - base = ... |
88 |
| - num: int = ... |
89 |
| - def __new__(cls, freq=...): ... |
90 |
| - @property |
91 |
| - def freq(self): ... |
92 |
| - @classmethod |
93 |
| - def construct_from_string(cls, string: _str): ... |
| 48 | + def __init__(self, freq: str | BaseOffset = ...): ... |
94 | 49 | @property
|
95 |
| - def name(self) -> _str: ... |
| 50 | + def freq(self) -> BaseOffset: ... |
96 | 51 | @property
|
97 |
| - def na_value(self): ... |
98 |
| - def __hash__(self) -> int: ... |
99 |
| - def __eq__(self, other) -> bool: ... |
100 |
| - @classmethod |
101 |
| - def is_dtype(cls, dtype) -> bool: ... |
102 |
| - @classmethod |
103 |
| - def construct_array_type(cls): ... |
104 |
| - def __from_arrow__(self, array): ... |
| 52 | + def na_value(self) -> NaTType: ... |
105 | 53 |
|
106 | 54 | class IntervalDtype(PandasExtensionDtype):
|
107 |
| - name: _str = ... |
108 |
| - kind: _str = ... |
109 |
| - str: _str = ... |
110 |
| - base = ... |
111 |
| - num: int = ... |
112 |
| - def __new__(cls, subtype=...): ... |
113 |
| - @property |
114 |
| - def subtype(self): ... |
115 |
| - @classmethod |
116 |
| - def construct_array_type(cls): ... |
117 |
| - @classmethod |
118 |
| - def construct_from_string(cls, string: _str): ... |
| 55 | + def __init__(self, subtype: str | npt.DTypeLike | None = ...): ... |
119 | 56 | @property
|
120 |
| - def type(self): ... |
121 |
| - def __hash__(self) -> int: ... |
122 |
| - def __eq__(self, other) -> bool: ... |
123 |
| - @classmethod |
124 |
| - def is_dtype(cls, dtype) -> bool: ... |
125 |
| - def __from_arrow__(self, array): ... |
| 57 | + def subtype(self) -> np.dtype | None: ... |
0 commit comments