Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.9/dist-packages/numpy/_typing/_scalars.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-04-09 06:12 +0000

1from typing import Union, Any 

2 

3import numpy as np 

4 

5# NOTE: `_StrLike_co` and `_BytesLike_co` are pointless, as `np.str_` and 

6# `np.bytes_` are already subclasses of their builtin counterpart 

7 

8_CharLike_co = Union[str, bytes] 

9 

10# The 6 `<X>Like_co` type-aliases below represent all scalars that can be 

11# coerced into `<X>` (with the casting rule `same_kind`) 

12_BoolLike_co = Union[bool, np.bool] 

13_UIntLike_co = Union[_BoolLike_co, np.unsignedinteger[Any]] 

14_IntLike_co = Union[_BoolLike_co, int, np.integer[Any]] 

15_FloatLike_co = Union[_IntLike_co, float, np.floating[Any]] 

16_ComplexLike_co = Union[_FloatLike_co, complex, np.complexfloating[Any, Any]] 

17_TD64Like_co = Union[_IntLike_co, np.timedelta64] 

18 

19_NumberLike_co = Union[int, float, complex, np.number[Any], np.bool] 

20_ScalarLike_co = Union[ 

21 int, 

22 float, 

23 complex, 

24 str, 

25 bytes, 

26 np.generic, 

27] 

28 

29# `_VoidLike_co` is technically not a scalar, but it's close enough 

30_VoidLike_co = Union[tuple[Any, ...], np.void]