mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Do not use ClassVars with generic variables (#6348)
This commit is contained in:
@@ -166,7 +166,7 @@ def POINTER(type: Type[_CT]) -> Type[pointer[_CT]]: ...
|
||||
# ctypes._Pointer in that it is the base class for all pointer types. Unlike the real _Pointer,
|
||||
# it can be instantiated directly (to mimic the behavior of the real pointer function).
|
||||
class pointer(Generic[_CT], _PointerLike, _CData):
|
||||
_type_: ClassVar[Type[_CT]] = ...
|
||||
_type_: Type[_CT] = ...
|
||||
contents: _CT = ...
|
||||
def __init__(self, arg: _CT = ...) -> None: ...
|
||||
@overload
|
||||
@@ -262,8 +262,8 @@ class BigEndianStructure(Structure): ...
|
||||
class LittleEndianStructure(Structure): ...
|
||||
|
||||
class Array(Generic[_CT], _CData):
|
||||
_length_: ClassVar[int] = ...
|
||||
_type_: ClassVar[Type[_CT]] = ...
|
||||
_length_: int = ...
|
||||
_type_: Type[_CT] = ...
|
||||
raw: bytes = ... # Note: only available if _CT == c_char
|
||||
value: Any = ... # Note: bytes if _CT == c_char, Text if _CT == c_wchar, unavailable otherwise
|
||||
# TODO These methods cannot be annotated correctly at the moment.
|
||||
|
||||
@@ -173,7 +173,7 @@ def POINTER(type: Type[_CT]) -> Type[pointer[_CT]]: ...
|
||||
# ctypes._Pointer in that it is the base class for all pointer types. Unlike the real _Pointer,
|
||||
# it can be instantiated directly (to mimic the behavior of the real pointer function).
|
||||
class pointer(Generic[_CT], _PointerLike, _CData):
|
||||
_type_: ClassVar[Type[_CT]]
|
||||
_type_: Type[_CT]
|
||||
contents: _CT
|
||||
def __init__(self, arg: _CT = ...) -> None: ...
|
||||
@overload
|
||||
@@ -268,8 +268,8 @@ class BigEndianStructure(Structure): ...
|
||||
class LittleEndianStructure(Structure): ...
|
||||
|
||||
class Array(Generic[_CT], _CData):
|
||||
_length_: ClassVar[int]
|
||||
_type_: ClassVar[Type[_CT]]
|
||||
_length_: int
|
||||
_type_: Type[_CT]
|
||||
raw: bytes # Note: only available if _CT == c_char
|
||||
value: Any # Note: bytes if _CT == c_char, str if _CT == c_wchar, unavailable otherwise
|
||||
# TODO These methods cannot be annotated correctly at the moment.
|
||||
|
||||
Reference in New Issue
Block a user