@@ -9,24 +9,8 @@ import _numtype as _nt
99import numpy as np
1010from numpy ._core ._internal import _ctypes
1111from numpy ._core .multiarray import flagsobj
12- from numpy ._typing import _ArrayLike , _BoolCodes , _DTypeLike , _Shape , _ShapeLike , _VoidDTypeLike
13- from numpy ._typing ._char_codes import (
14- _Float32Codes ,
15- _Float64Codes ,
16- _Int8Codes ,
17- _Int16Codes ,
18- _Int32Codes ,
19- _Int64Codes ,
20- _IntPCodes ,
21- _LongCodes ,
22- _LongDoubleCodes ,
23- _UInt8Codes ,
24- _UInt16Codes ,
25- _UInt32Codes ,
26- _UInt64Codes ,
27- _UIntPCodes ,
28- _ULongCodes ,
29- )
12+ from numpy ._typing import _ArrayLike , _DTypeLike , _Shape , _ShapeLike , _VoidDTypeLike
13+ from numpy ._typing ._char_codes import _LongCodes , _ULongCodes
3014
3115__all__ = ["as_array" , "as_ctypes" , "as_ctypes_type" , "c_intp" , "load_library" , "ndpointer" ]
3216
@@ -176,43 +160,33 @@ def as_ctypes(obj: _nt.Array[np.longdouble]) -> ct.Array[ct.c_longdouble]: ...
176160
177161# TODO(jorenham): https://github.com/numpy/numtype/issues/522
178162@overload
179- def as_ctypes_type (dtype : _DTypeLike [ np . bool ] | type [ bool | ct . c_bool ] | _BoolCodes ) -> type [ct .c_bool ]: ...
163+ def as_ctypes_type (dtype : _nt . ToDTypeBool ) -> type [ct .c_bool ]: ...
180164@overload
181- def as_ctypes_type (dtype : _DTypeLike [ np . int8 ] | type [ ct . c_int8 | ct . c_byte ] | _Int8Codes ) -> type [ct .c_int8 ]: ...
165+ def as_ctypes_type (dtype : _nt . ToDTypeInt8 ) -> type [ct .c_int8 ]: ...
182166@overload
183- def as_ctypes_type (dtype : _DTypeLike [ np . int16 ] | type [ ct . c_int16 | ct . c_short ] | _Int16Codes ) -> type [ct .c_int16 ]: ...
167+ def as_ctypes_type (dtype : _nt . ToDTypeUInt8 ) -> type [ct .c_uint8 ]: ...
184168@overload
185- def as_ctypes_type (dtype : _DTypeLike [ np . int32 ] | type [ ct . c_int32 | ct . c_int ] | _Int32Codes ) -> type [ct .c_int32 ]: ...
169+ def as_ctypes_type (dtype : _nt . ToDTypeInt16 ) -> type [ct .c_int16 ]: ...
186170@overload
187- def as_ctypes_type (dtype : type [ ct . c_long ] | _LongCodes ) -> type [ct .c_long ]: ...
171+ def as_ctypes_type (dtype : _nt . ToDTypeUInt16 ) -> type [ct .c_uint16 ]: ...
188172@overload
189- def as_ctypes_type (dtype : type [ _nt .JustInt | ct . c_ssize_t ] | _IntPCodes ) -> type [ct .c_ssize_t ]: ...
173+ def as_ctypes_type (dtype : _nt .ToDTypeInt32 ) -> type [ct .c_int32 ]: ...
190174@overload
191- def as_ctypes_type (dtype : _DTypeLike [ np . int64 ] | type [ ct . c_int64 ] | _Int64Codes ) -> type [ct .c_int64 ]: ...
175+ def as_ctypes_type (dtype : _nt . ToDTypeUInt32 ) -> type [ct .c_uint32 ]: ...
192176@overload
193- def as_ctypes_type (dtype : _DTypeLike [ np . uint8 ] | type [ ct . c_uint8 | ct . c_ubyte ] | _UInt8Codes ) -> type [ct .c_uint8 ]: ...
177+ def as_ctypes_type (dtype : _nt . ToDTypeInt64 ) -> type [ct .c_int64 ]: ...
194178@overload
195- def as_ctypes_type (
196- dtype : _DTypeLike [np .uint16 ] | type [ct .c_uint16 | ct .c_ushort ] | _UInt16Codes ,
197- ) -> type [ct .c_uint16 ]: ...
179+ def as_ctypes_type (dtype : _nt .ToDTypeUInt64 ) -> type [ct .c_uint64 ]: ...
198180@overload
199- def as_ctypes_type (
200- dtype : _DTypeLike [np .uint32 ] | type [ct .c_uint32 | ct .c_uint ] | _UInt32Codes ,
201- ) -> type [ct .c_uint32 ]: ...
181+ def as_ctypes_type (dtype : type [ct .c_long ] | _LongCodes ) -> type [ct .c_long ]: ...
202182@overload
203183def as_ctypes_type (dtype : type [ct .c_ulong ] | _ULongCodes ) -> type [ct .c_ulong ]: ...
204184@overload
205- def as_ctypes_type (dtype : type [ct .c_void_p | ct .c_size_t ] | _UIntPCodes ) -> type [ct .c_size_t ]: ...
206- @overload
207- def as_ctypes_type (dtype : _DTypeLike [np .uint64 ] | type [ct .c_uint64 ] | _UInt64Codes ) -> type [ct .c_uint64 ]: ...
208- @overload
209- def as_ctypes_type (dtype : _DTypeLike [np .float32 ] | type [ct .c_float ] | _Float32Codes ) -> type [ct .c_float ]: ...
185+ def as_ctypes_type (dtype : _nt .ToDTypeFloat32 ) -> type [ct .c_float ]: ...
210186@overload
211- def as_ctypes_type (dtype : _DTypeLike [ np . float64 ] | type [ ct . c_double ] | _Float64Codes ) -> type [ct .c_double ]: ...
187+ def as_ctypes_type (dtype : _nt . ToDTypeFloat64 ) -> type [ct .c_double ]: ...
212188@overload
213- def as_ctypes_type (
214- dtype : _DTypeLike [np .longdouble ] | type [ct .c_longdouble ] | _LongDoubleCodes ,
215- ) -> type [ct .c_longdouble ]: ...
189+ def as_ctypes_type (dtype : _nt .ToDTypeLongDouble ) -> type [ct .c_longdouble ]: ...
216190@overload
217191def as_ctypes_type (dtype : _VoidDTypeLike ) -> _ct ._UnionType | _ct ._PyCStructType : ...
218192@overload
0 commit comments