summaryrefslogtreecommitdiff
path: root/numpy/typing/_scalars.py
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2020-12-09 20:31:36 +0200
committerGitHub <noreply@github.com>2020-12-09 20:31:36 +0200
commitb6f8b211d79327948d2c6972a62e0700975d613b (patch)
treebb95c70dacc4ca2ac7c4f0e7454cb29f60a9d6b9 /numpy/typing/_scalars.py
parent707a5da81def895fde4a5f6f9b6fab8ed082133e (diff)
parent0da188da1e7a65b85b73d2499f7397fea89ff7bd (diff)
downloadnumpy-b6f8b211d79327948d2c6972a62e0700975d613b.tar.gz
Merge pull request #17795 from BvB93/x-like
ENH: Add two new `_<X>Like` unions
Diffstat (limited to 'numpy/typing/_scalars.py')
-rw-r--r--numpy/typing/_scalars.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/numpy/typing/_scalars.py b/numpy/typing/_scalars.py
index e4fc28b07..90b2eff7b 100644
--- a/numpy/typing/_scalars.py
+++ b/numpy/typing/_scalars.py
@@ -7,12 +7,16 @@ import numpy as np
_CharLike = Union[str, bytes]
+# The 6 `<X>Like` type-aliases below represent all scalars that can be
+# coerced into `<X>` (with the casting rule `same_kind`)
_BoolLike = Union[bool, np.bool_]
-_IntLike = Union[int, np.integer]
+_UIntLike = Union[_BoolLike, np.unsignedinteger]
+_IntLike = Union[_BoolLike, int, np.integer]
_FloatLike = Union[_IntLike, float, np.floating]
_ComplexLike = Union[_FloatLike, complex, np.complexfloating]
-_NumberLike = Union[int, float, complex, np.number, np.bool_]
+_TD64Like = Union[_IntLike, np.timedelta64]
+_NumberLike = Union[int, float, complex, np.number, np.bool_]
_ScalarLike = Union[
int,
float,