drop ellipsis assignments from module vars, classvars and instance attrs (#5914)

Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
Oleg Höfling
2021-08-11 19:26:58 +02:00
committed by GitHub
parent 6c41e3cead
commit 64f481189f
34 changed files with 325 additions and 325 deletions

View File

@@ -24,16 +24,16 @@ _T = TypeVar("_T")
_DLLT = TypeVar("_DLLT", bound=CDLL)
_CT = TypeVar("_CT", bound=_CData)
RTLD_GLOBAL: int = ...
RTLD_LOCAL: int = ...
DEFAULT_MODE: int = ...
RTLD_GLOBAL: int
RTLD_LOCAL: int
DEFAULT_MODE: int
class CDLL(object):
_func_flags_: ClassVar[int] = ...
_func_restype_: ClassVar[_CData] = ...
_name: str = ...
_handle: int = ...
_FuncPtr: Type[_FuncPointer] = ...
_func_flags_: ClassVar[int]
_func_restype_: ClassVar[_CData]
_name: str
_handle: int
_FuncPtr: Type[_FuncPointer]
if sys.version_info >= (3, 8):
def __init__(
self,
@@ -65,12 +65,12 @@ class LibraryLoader(Generic[_DLLT]):
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
cdll: LibraryLoader[CDLL] = ...
cdll: LibraryLoader[CDLL]
if sys.platform == "win32":
windll: LibraryLoader[WinDLL] = ...
oledll: LibraryLoader[OleDLL] = ...
pydll: LibraryLoader[PyDLL] = ...
pythonapi: PyDLL = ...
windll: LibraryLoader[WinDLL]
oledll: LibraryLoader[OleDLL]
pydll: LibraryLoader[PyDLL]
pythonapi: PyDLL
# Anything that implements the read-write buffer interface.
# The buffer interface is defined purely on the C level, so we cannot define a normal Protocol
@@ -87,9 +87,9 @@ class _CDataMeta(type):
def __rmul__(cls: Type[_CT], other: int) -> Type[Array[_CT]]: ... # type: ignore
class _CData(metaclass=_CDataMeta):
_b_base: int = ...
_b_needsfree_: bool = ...
_objects: Mapping[Any, int] | None = ...
_b_base: int
_b_needsfree_: bool
_objects: Mapping[Any, int] | None
@classmethod
def from_buffer(cls: Type[_CT], source: _WritableBuffer, offset: int = ...) -> _CT: ...
@classmethod
@@ -108,9 +108,9 @@ _ECT = Callable[[Optional[Type[_CData]], _FuncPointer, Tuple[_CData, ...]], _CDa
_PF = _UnionT[Tuple[int], Tuple[int, str], Tuple[int, str, Any]]
class _FuncPointer(_PointerLike, _CData):
restype: Type[_CData] | Callable[[int], Any] | None = ...
argtypes: Sequence[Type[_CData]] = ...
errcheck: _ECT = ...
restype: Type[_CData] | Callable[[int], Any] | None
argtypes: Sequence[Type[_CData]]
errcheck: _ECT
@overload
def __init__(self, address: int) -> None: ...
@overload
@@ -180,8 +180,8 @@ 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]] = ...
contents: _CT = ...
_type_: ClassVar[Type[_CT]]
contents: _CT
def __init__(self, arg: _CT = ...) -> None: ...
@overload
def __getitem__(self, i: int) -> _CT: ...
@@ -207,7 +207,7 @@ if sys.platform == "win32":
def wstring_at(address: _CVoidConstPLike, size: int = ...) -> str: ...
class _SimpleCData(Generic[_T], _CData):
value: _T = ...
value: _T
def __init__(self, value: _T = ...) -> None: ...
class c_byte(_SimpleCData[int]): ...
@@ -255,13 +255,13 @@ if sys.platform == "win32":
class py_object(_CanCastTo, _SimpleCData[_T]): ...
class _CField:
offset: int = ...
size: int = ...
offset: int
size: int
class _StructUnionMeta(_CDataMeta):
_fields_: Sequence[Tuple[str, Type[_CData]] | Tuple[str, Type[_CData], int]] = ...
_pack_: int = ...
_anonymous_: Sequence[str] = ...
_fields_: Sequence[Tuple[str, Type[_CData]] | Tuple[str, Type[_CData], int]]
_pack_: int
_anonymous_: Sequence[str]
def __getattr__(self, name: str) -> _CField: ...
class _StructUnionBase(_CData, metaclass=_StructUnionMeta):
@@ -275,10 +275,10 @@ class BigEndianStructure(Structure): ...
class LittleEndianStructure(Structure): ...
class Array(Generic[_CT], _CData):
_length_: ClassVar[int] = ...
_type_: ClassVar[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
_length_: ClassVar[int]
_type_: ClassVar[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.
# All of these "Any"s stand for the array's element type, but it's not possible to use _CT
# here, because of a special feature of ctypes.