Consistently use Generic as the last base class (#10610)

This commit is contained in:
Nikita Sobolev
2023-08-28 11:16:54 +03:00
committed by GitHub
parent 3b9ab5e9b1
commit 2c1db00761
15 changed files with 17 additions and 17 deletions

View File

@@ -69,7 +69,7 @@ class _CData(metaclass=_CDataMeta):
def __buffer__(self, __flags: int) -> memoryview: ...
def __release_buffer__(self, __buffer: memoryview) -> None: ...
class _SimpleCData(Generic[_T], _CData):
class _SimpleCData(_CData, Generic[_T]):
value: _T
# The TypeVar can be unsolved here,
# but we can't use overloads without creating many, many mypy false-positive errors
@@ -78,7 +78,7 @@ class _SimpleCData(Generic[_T], _CData):
class _CanCastTo(_CData): ...
class _PointerLike(_CanCastTo): ...
class _Pointer(Generic[_CT], _PointerLike, _CData):
class _Pointer(_PointerLike, _CData, Generic[_CT]):
_type_: type[_CT]
contents: _CT
@overload
@@ -140,7 +140,7 @@ class _StructUnionBase(_CData, metaclass=_StructUnionMeta):
class Union(_StructUnionBase): ...
class Structure(_StructUnionBase): ...
class Array(Generic[_CT], _CData):
class Array(_CData, Generic[_CT]):
@property
@abstractmethod
def _length_(self) -> int: ...

View File

@@ -69,7 +69,7 @@ class excel(Dialect): ...
class excel_tab(excel): ...
class unix_dialect(Dialect): ...
class DictReader(Generic[_T], Iterator[_DictReadMapping[_T | Any, str | Any]]):
class DictReader(Iterator[_DictReadMapping[_T | Any, str | Any]], Generic[_T]):
fieldnames: Sequence[_T] | None
restkey: str | None
restval: str | None

View File

@@ -321,7 +321,7 @@ else:
dir: GenericPath[AnyStr] | None = None,
) -> IO[Any]: ...
class _TemporaryFileWrapper(Generic[AnyStr], IO[AnyStr]):
class _TemporaryFileWrapper(IO[AnyStr], Generic[AnyStr]):
file: IO[AnyStr] # io.TextIOWrapper, io.BufferedReader or io.BufferedWriter
name: str
delete: bool