@@ -79,9 +79,9 @@ from numpy.typing import (
7979)
8080
8181if sys .version_info >= (3 , 8 ):
82- from typing import SupportsIndex , Final , Literal as L
82+ from typing import SupportsIndex , final , Final , Literal as L
8383else :
84- from typing_extensions import SupportsIndex , Final , Literal as L
84+ from typing_extensions import SupportsIndex , final , Final , Literal as L
8585
8686_SCT = TypeVar ("_SCT" , bound = generic )
8787_ArrayType = TypeVar ("_ArrayType" , bound = NDArray [Any ])
@@ -949,9 +949,31 @@ def compare_chararrays(
949949
950950def add_docstring (__obj : Callable [..., Any ], __docstring : str ) -> None : ...
951951
952+ _GetItemKeys = L [
953+ "C" , "CONTIGUOUS" , "C_CONTIGUOUS" ,
954+ "F" , "FORTRAN" , "F_CONTIGUOUS" ,
955+ "W" , "WRITEABLE" ,
956+ "B" , "BEHAVED" ,
957+ "O" , "OWNDATA" ,
958+ "A" , "ALIGNED" ,
959+ "X" , "WRITEBACKIFCOPY" ,
960+ "CA" , "CARRAY" ,
961+ "FA" , "FARRAY" ,
962+ "FNC" ,
963+ "FORC" ,
964+ ]
965+ _SetItemKeys = L [
966+ "A" , "ALIGNED" ,
967+ "W" , "WRITABLE" ,
968+ "X" , "WRITEBACKIFCOPY" ,
969+ ]
970+
971+ @final
952972class flagsobj :
973+ __hash__ : None # type: ignore[assignment]
953974 aligned : bool
954- updateifcopy : bool
975+ # NOTE: deprecated
976+ # updateifcopy: bool
955977 writeable : bool
956978 writebackifcopy : bool
957979 @property
@@ -976,5 +998,5 @@ class flagsobj:
976998 def num (self ) -> int : ...
977999 @property
9781000 def owndata (self ) -> bool : ...
979- def __getitem__ (self , key : str ) -> bool : ...
980- def __setitem__ (self , key : str , value : bool ) -> None : ...
1001+ def __getitem__ (self , key : _GetItemKeys ) -> bool : ...
1002+ def __setitem__ (self , key : _SetItemKeys , value : bool ) -> None : ...
0 commit comments