1616# under the License.
1717
1818import datetime as dt # noqa: F401
19- import sys
2019
2120from collections .abc import Mapping , Sequence , Iterable , Iterator
2221from decimal import Decimal # noqa: F401
23-
24- if sys .version_info >= (3 , 11 ):
25- from typing import Self
26- else :
27- from typing_extensions import Self
28-
2922from typing import Any , Generic , Literal
3023
3124import numpy as np
3225import pandas as pd
3326
34- from pyarrow ._stubs_typing import SupportArrowSchema
27+ from typing_extensions import Self , TypeVar , deprecated
28+
29+ from pyarrow ._stubs_typing import SupportArrowSchema , TimeUnit
30+ from pyarrow .io import Buffer
3531from pyarrow .lib import ( # noqa: F401
3632 Array ,
3733 ChunkedArray ,
@@ -40,11 +36,7 @@ from pyarrow.lib import ( # noqa: F401
4036 MonthDayNano ,
4137 Table ,
4238)
43- from typing_extensions import TypeVar , deprecated
44-
45- from .io import Buffer
46- from .scalar import ExtensionScalar
47- from ._stubs_typing import TimeUnit
39+ from pyarrow .scalar import ExtensionScalar
4840
4941class _Weakrefable :
5042 ...
@@ -226,39 +218,44 @@ class DurationType(_BasicDataType[dt.timedelta], Generic[_Unit]):
226218 def unit (self ) -> _Unit : ...
227219
228220
229- class FixedSizeBinaryType (_BasicDataType [Decimal ]):
221+ _FixedSizeBinaryAsPyType = TypeVar ("_FixedSizeBinaryAsPyType" , default = bytes )
222+
223+
224+ class FixedSizeBinaryType (
225+ _BasicDataType [_FixedSizeBinaryAsPyType ], Generic [_FixedSizeBinaryAsPyType ]
226+ ):
230227 ...
231228
232229
233230_Precision = TypeVar ("_Precision" , default = Any )
234231_Scale = TypeVar ("_Scale" , default = Any )
235232
236233
237- class Decimal32Type (FixedSizeBinaryType , Generic [_Precision , _Scale ]):
234+ class Decimal32Type (FixedSizeBinaryType [ Decimal ] , Generic [_Precision , _Scale ]):
238235 @property
239236 def precision (self ) -> _Precision : ...
240237
241238 @property
242239 def scale (self ) -> _Scale : ...
243240
244241
245- class Decimal64Type (FixedSizeBinaryType , Generic [_Precision , _Scale ]):
242+ class Decimal64Type (FixedSizeBinaryType [ Decimal ] , Generic [_Precision , _Scale ]):
246243 @property
247244 def precision (self ) -> _Precision : ...
248245
249246 @property
250247 def scale (self ) -> _Scale : ...
251248
252249
253- class Decimal128Type (FixedSizeBinaryType , Generic [_Precision , _Scale ]):
250+ class Decimal128Type (FixedSizeBinaryType [ Decimal ] , Generic [_Precision , _Scale ]):
254251 @property
255252 def precision (self ) -> _Precision : ...
256253
257254 @property
258255 def scale (self ) -> _Scale : ...
259256
260257
261- class Decimal256Type (FixedSizeBinaryType , Generic [_Precision , _Scale ]):
258+ class Decimal256Type (FixedSizeBinaryType [ Decimal ] , Generic [_Precision , _Scale ]):
262259 @property
263260 def precision (self ) -> _Precision : ...
264261
@@ -491,7 +488,7 @@ def unregister_extension_type(type_name: str) -> None: ...
491488class KeyValueMetadata (_Metadata , Mapping [bytes , bytes ]):
492489 def __init__ (
493490 self , __arg0__ : Mapping [str | bytes , str | bytes ]
494- | Iterable [tuple [str , str ]]
491+ | Iterable [tuple [str | bytes , str | bytes ]]
495492 | KeyValueMetadata
496493 | None = None , ** kwargs : str
497494 ) -> None : ...
@@ -500,9 +497,9 @@ class KeyValueMetadata(_Metadata, Mapping[bytes, bytes]):
500497
501498 def __len__ (self ) -> int : ...
502499
503- def __contains__ (self , / , __key : object ) -> bool : ... # type: ignore[override]
500+ def __contains__ (self , / , __key : object ) -> bool : ...
504501
505- def __getitem__ (self , / , __key : Any ) -> Any : ... # type: ignore[override]
502+ def __getitem__ (self , / , __key : Any ) -> Any : ...
506503
507504 def __iter__ (self ) -> Iterator [bytes ]: ...
508505
@@ -636,7 +633,7 @@ def unify_schemas(
636633
637634def field (
638635 name : SupportArrowSchema | str | Any , type : _DataTypeT | str | None = None ,
639- nullable : bool = ... ,
636+ nullable : bool = True ,
640637 metadata : dict [Any , Any ] | None = None
641638) -> Field [_DataTypeT ] | Field [Any ]: ...
642639
@@ -702,20 +699,20 @@ def float32() -> Float32Type: ...
702699def float64 () -> Float64Type : ...
703700
704701
705- def decimal32 (precision : _Precision , scale : _Scale |
706- None = None ) -> Decimal32Type [_Precision , _Scale | Literal [0 ]]: ...
702+ def decimal32 (precision : _Precision ,
703+ scale : _Scale | Literal [ 0 ] = 0 ) -> Decimal32Type [_Precision , _Scale | Literal [0 ]]: ...
707704
708705
709- def decimal64 (precision : _Precision , scale : _Scale |
710- None = None ) -> Decimal64Type [_Precision , _Scale | Literal [0 ]]: ...
706+ def decimal64 (precision : _Precision ,
707+ scale : _Scale | Literal [ 0 ] = 0 ) -> Decimal64Type [_Precision , _Scale | Literal [0 ]]: ...
711708
712709
713- def decimal128 (precision : _Precision , scale : _Scale |
714- None = None ) -> Decimal128Type [_Precision , _Scale | Literal [0 ]]: ...
710+ def decimal128 (precision : _Precision ,
711+ scale : _Scale | Literal [ 0 ] = 0 ) -> Decimal128Type [_Precision , _Scale | Literal [0 ]]: ...
715712
716713
717- def decimal256 (precision : _Precision , scale : _Scale |
718- None = None ) -> Decimal256Type [_Precision , _Scale | Literal [0 ]]: ...
714+ def decimal256 (precision : _Precision ,
715+ scale : _Scale | Literal [ 0 ] = 0 ) -> Decimal256Type [_Precision , _Scale | Literal [0 ]]: ...
719716
720717
721718def string () -> StringType : ...
@@ -724,7 +721,7 @@ def string() -> StringType: ...
724721utf8 = string
725722
726723
727- def binary (length : Literal [- 1 ] | int = ...) -> BinaryType | FixedSizeBinaryType : ...
724+ def binary (length : Literal [- 1 ] | int = ...) -> BinaryType | FixedSizeBinaryType [ bytes ] : ...
728725
729726
730727def large_binary () -> LargeBinaryType : ...
@@ -764,8 +761,8 @@ def large_list_view(
764761def map_ (
765762 key_type : _K | Field | str | None = None ,
766763 item_type : _ValueT | Field | str | None = None ,
767- keys_sorted : bool | None = None
768- ) -> MapType [_K , _ValueT , Literal [ False ] ]: ...
764+ keys_sorted : _Ordered | None = None
765+ ) -> MapType [_K , _ValueT , _Ordered ]: ...
769766
770767
771768def dictionary (
0 commit comments