Fixed base classes to avoid "Cannot create consistent method ordering" error. Like the Python interpreter, the pyright type checker reports an error when a class is defined in a way that a deterministic MRO cannot be established. This set of changes eliminates these errors. (#4392)

Co-authored-by: Eric Traut <erictr@microsoft.com>
This commit is contained in:
Eric Traut
2020-08-05 19:42:48 -07:00
committed by GitHub
parent fe970d1134
commit e17c6a752e
4 changed files with 5 additions and 5 deletions

View File

@@ -2,7 +2,7 @@ from typing import Generic, Optional, TypeVar
_T = TypeVar("_T")
class ProgressBar(object, Generic[_T]):
class ProgressBar(Generic[_T]):
def update(self, n_steps: int) -> None: ...
def finish(self) -> None: ...
def __enter__(self) -> ProgressBar[_T]: ...

View File

@@ -81,7 +81,7 @@ class NullAttribute(Attribute[None]):
class MapAttributeMeta(type):
def __init__(self, name, bases, attrs) -> None: ...
class MapAttribute(Generic[_KT, _VT], Attribute[Mapping[_KT, _VT]], metaclass=MapAttributeMeta):
class MapAttribute(Attribute[Mapping[_KT, _VT]], metaclass=MapAttributeMeta):
attribute_values: Any
def __init__(
self,
@@ -100,7 +100,7 @@ class MapAttribute(Generic[_KT, _VT], Attribute[Mapping[_KT, _VT]], metaclass=Ma
def is_type_safe(self, key: Any, value: Any) -> bool: ...
def validate(self) -> bool: ...
class ListAttribute(Generic[_T], Attribute[List[_T]]):
class ListAttribute(Attribute[List[_T]]):
element_type: Any
def __init__(
self,

View File

@@ -150,7 +150,7 @@ class ModelContextManager(Generic[_T]):
def __init__(self, model: Type[_T], auto_commit: bool = ...) -> None: ...
def __enter__(self) -> ModelContextManager[_T]: ...
class BatchWrite(Generic[_T], ModelContextManager[_T]):
class BatchWrite(ModelContextManager[_T]):
def save(self, put_item: _T) -> None: ...
def delete(self, del_item: _T) -> None: ...
def __enter__(self) -> BatchWrite[_T]: ...

View File

@@ -30,7 +30,7 @@ def is_immutable(self) -> NoReturn: ...
def iter_multi_items(mapping): ...
def native_itermethods(names): ...
class ImmutableListMixin(object, Generic[_V]):
class ImmutableListMixin(Generic[_V]):
def __hash__(self) -> int: ...
def __reduce_ex__(self: _D, protocol) -> Tuple[Type[_D], List[_V]]: ...
def __delitem__(self, key: _V) -> NoReturn: ...