diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2020-10-09 07:54:50 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-09 07:54:50 -0600 |
commit | dee73994c5723d518807cc4cb94d9e1e1b633443 (patch) | |
tree | 4c7d972cb078d6b3953bb303b298a3e47748a100 | |
parent | 0cefa592833151266d3e0fc2f258685280b0713b (diff) | |
parent | 7e952c739ca9ac123f2e8568c5ded7693be058da (diff) | |
download | numpy-dee73994c5723d518807cc4cb94d9e1e1b633443.tar.gz |
Merge pull request #17479 from person142/np-unicode
ENH: type np.unicode_ as np.str_
-rw-r--r-- | numpy/__init__.pyi | 4 | ||||
-rw-r--r-- | numpy/typing/tests/data/reveal/scalars.py | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/numpy/__init__.pyi b/numpy/__init__.pyi index 7f7ada3e5..f282b3f48 100644 --- a/numpy/__init__.pyi +++ b/numpy/__init__.pyi @@ -471,7 +471,6 @@ sort_complex: Any source: Any split: Any stack: Any -str0: Any string_: Any take_along_axis: Any tile: Any @@ -493,7 +492,6 @@ uint0: Any uintc: Any uintp: Any ulonglong: Any -unicode_: Any union1d: Any unique: Any unpackbits: Any @@ -1588,6 +1586,8 @@ class str_(character, str): self, __value: bytes, encoding: str = ..., errors: str = ... ) -> None: ... +unicode_ = str0 = str_ + # TODO(alan): Platform dependent types # longcomplex, longdouble, longfloat # bytes, short, intc, intp, longlong diff --git a/numpy/typing/tests/data/reveal/scalars.py b/numpy/typing/tests/data/reveal/scalars.py index ec3713b0f..0168ebed8 100644 --- a/numpy/typing/tests/data/reveal/scalars.py +++ b/numpy/typing/tests/data/reveal/scalars.py @@ -14,3 +14,6 @@ reveal_type(x.strides) # E: tuple[builtins.int] reveal_type(np.complex64().real) # E: numpy.float32 reveal_type(np.complex128().imag) # E: numpy.float64 + +reveal_type(np.unicode_('foo')) # E: numpy.str_ +reveal_type(np.str0('foo')) # E: numpy.str_ |