diff options
| author | Bas van Beek <43369155+BvB93@users.noreply.github.com> | 2021-07-08 13:37:24 +0200 |
|---|---|---|
| committer | Bas van Beek <43369155+BvB93@users.noreply.github.com> | 2021-07-08 16:37:09 +0200 |
| commit | 996e095c51a0889d7626efb8c47107a35637cf60 (patch) | |
| tree | 7550b3fa7ca9aec2749eb449fc90caaba6d337ad | |
| parent | c1eda8e77b695885561452fdc3a28169b9c5d62e (diff) | |
| download | numpy-996e095c51a0889d7626efb8c47107a35637cf60.tar.gz | |
ENH: Use literals for `flagsobj.__getitem__` and `__setitem__`
| -rw-r--r-- | numpy/core/multiarray.pyi | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/numpy/core/multiarray.pyi b/numpy/core/multiarray.pyi index 6463eea78..a7d2e6bbf 100644 --- a/numpy/core/multiarray.pyi +++ b/numpy/core/multiarray.pyi @@ -949,6 +949,25 @@ def compare_chararrays( def add_docstring(__obj: Callable[..., Any], __docstring: str) -> None: ... +_GetItemKeys = L[ + "C", "CONTIGUOUS", "C_CONTIGUOUS", + "F", "FORTRAN", "F_CONTIGUOUS", + "W", "WRITEABLE", + "B", "BEHAVED", + "O", "OWNDATA", + "A", "ALIGNED", + "X", "WRITEBACKIFCOPY", + "CA", "CARRAY", + "FA", "FARRAY", + "FNC", + "FORC", +] +_SetItemKeys = L[ + "A", "ALIGNED", + "W", "WRITABLE", + "X", "WRITEBACKIFCOPY", +] + @final class flagsobj: __hash__: None # type: ignore[assignment] @@ -979,5 +998,5 @@ class flagsobj: def num(self) -> int: ... @property def owndata(self) -> bool: ... - def __getitem__(self, key: str) -> bool: ... - def __setitem__(self, key: str, value: bool) -> None: ... + def __getitem__(self, key: _GetItemKeys) -> bool: ... + def __setitem__(self, key: _SetItemKeys, value: bool) -> None: ... |
