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

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

12 statements  

1from typing import Union, Tuple, 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] 

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

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

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

17_TD64Like_co = Union[_IntLike_co, np.timedelta64] 

18 

19_NumberLike_co = Union[int, float, complex, np.number, 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]