Remove many redundant inheritances from Generic[] (#10933)

This commit is contained in:
Alex Waygood
2023-10-26 19:07:20 +01:00
committed by GitHub
parent 5dbdd59c9b
commit a08d4c8d2e
30 changed files with 81 additions and 81 deletions

View File

@@ -1,7 +1,7 @@
from _typeshed import Incomplete, ReadableBuffer
from collections.abc import Callable, Iterable, Iterator
from re import Pattern
from typing import Any, Generic, TypeVar, overload
from typing import Any, TypeVar, overload
from typing_extensions import Self, TypeAlias
from . import BeautifulSoup
@@ -372,7 +372,7 @@ class SoupStrainer:
searchTag = search_tag
def search(self, markup: PageElement | Iterable[PageElement]): ...
class ResultSet(list[_PageElementT], Generic[_PageElementT]):
class ResultSet(list[_PageElementT]):
source: SoupStrainer
@overload
def __init__(self, source: SoupStrainer) -> None: ...

View File

@@ -1,7 +1,7 @@
from _typeshed import IdentityFunction, Unused
from collections.abc import Callable, Iterator, MutableMapping, Sequence
from contextlib import AbstractContextManager
from typing import Any, Generic, TypeVar, overload
from typing import Any, TypeVar, overload
__all__ = ("Cache", "FIFOCache", "LFUCache", "LRUCache", "MRUCache", "RRCache", "TLRUCache", "TTLCache", "cached", "cachedmethod")
__version__: str
@@ -10,7 +10,7 @@ _KT = TypeVar("_KT")
_VT = TypeVar("_VT")
_T = TypeVar("_T")
class Cache(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
class Cache(MutableMapping[_KT, _VT]):
@overload
def __init__(self, maxsize: float, getsizeof: Callable[[_VT], float]) -> None: ...
@overload

View File

@@ -2,7 +2,7 @@ import datetime
from _typeshed import Incomplete, SupportsItems
from abc import ABC, abstractmethod
from re import Pattern
from typing import ClassVar, Generic, TypeVar
from typing import ClassVar, TypeVar
from typing_extensions import Literal, Self
from .encryption import StandardSecurityHandler
@@ -62,7 +62,7 @@ class PDFDate:
def __init__(self, date: datetime.datetime, with_tz: bool = False, encrypt: bool = False) -> None: ...
def serialize(self) -> str: ...
class PDFArray(list[_T], Generic[_T]):
class PDFArray(list[_T]):
def serialize(self) -> str: ...
class Destination(ABC):

View File

@@ -1,13 +1,13 @@
from _typeshed import Incomplete
from collections import OrderedDict
from typing import Generic, TypeVar
from typing import TypeVar
from humanfriendly.compat import unicode
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
class CaseInsensitiveDict(OrderedDict[_KT, _VT], Generic[_KT, _VT]):
class CaseInsensitiveDict(OrderedDict[_KT, _VT]):
def __init__(self, other: Incomplete | None = None, **kw) -> None: ...
def coerce_key(self, key): ...
@classmethod

View File

@@ -1,11 +1,11 @@
from _typeshed import Incomplete
from collections.abc import MutableMapping
from typing import Generic, TypeVar
from typing import TypeVar
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
class CaseInsensitiveDict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
class CaseInsensitiveDict(MutableMapping[_KT, _VT]):
def __init__(self, other: Incomplete | None = None, **kwargs) -> None: ...
def __contains__(self, item): ...
def __delitem__(self, key) -> None: ...
@@ -19,7 +19,7 @@ class CaseInsensitiveDict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __eq__(self, other): ...
def copy(self): ...
class CaseInsensitiveWithAliasDict(CaseInsensitiveDict[_KT, _VT], Generic[_KT, _VT]):
class CaseInsensitiveWithAliasDict(CaseInsensitiveDict[_KT, _VT]):
def __init__(self, other: Incomplete | None = None, **kwargs) -> None: ...
def aliases(self): ...
def __setitem__(self, key, value) -> None: ...

View File

@@ -289,7 +289,7 @@ PSWorkerThreadExcHandlerT: TypeAlias = PubsubWorkerExceptionHandler | AsyncPubsu
CommandT: TypeAlias = tuple[tuple[str | bytes, ...], Mapping[str, Any]]
CommandStackT: TypeAlias = list[CommandT]
class Pipeline(Redis[_StrType], Generic[_StrType]):
class Pipeline(Redis[_StrType]):
UNWATCH_COMMANDS: ClassVar[set[str]]
connection_pool: Any
connection: Any

View File

@@ -382,7 +382,7 @@ class PubSubWorkerThread(threading.Thread):
def run(self) -> None: ...
def stop(self) -> None: ...
class Pipeline(Redis[_StrType], Generic[_StrType]):
class Pipeline(Redis[_StrType]):
UNWATCH_COMMANDS: Any
connection_pool: Any
connection: Any

View File

@@ -188,7 +188,7 @@ class ClusterPubSub(PubSub):
def execute_command(self, *args, **kwargs) -> None: ...
def get_redis_connection(self) -> Redis[Any] | None: ...
class ClusterPipeline(RedisCluster[_StrType], Generic[_StrType]):
class ClusterPipeline(RedisCluster[_StrType]):
command_stack: list[Incomplete]
nodes_manager: Incomplete
refresh_table_asap: bool

View File

@@ -16,7 +16,7 @@ class ClusterManagementCommands(ManagementCommands):
def replicaof(self, *args, **kwargs) -> None: ...
def swapdb(self, *args, **kwargs) -> None: ...
class ClusterDataAccessCommands(DataAccessCommands[_StrType], Generic[_StrType]):
class ClusterDataAccessCommands(DataAccessCommands[_StrType]):
def stralgo(
self,
algo,

View File

@@ -1,6 +1,6 @@
from _typeshed import Incomplete, SupportsWrite
from collections.abc import Awaitable, Callable, Generator, Iterable, Iterator, Mapping
from typing import Generic, NoReturn, TypeVar, overload
from typing import NoReturn, TypeVar, overload
from typing_extensions import Self
from .std import tqdm as std_tqdm
@@ -9,7 +9,7 @@ __all__ = ["tqdm_asyncio", "tarange", "tqdm", "trange"]
_T = TypeVar("_T")
class tqdm_asyncio(std_tqdm[_T], Generic[_T]):
class tqdm_asyncio(std_tqdm[_T]):
iterable_awaitable: bool
iterable_next: Callable[[], _T | Awaitable[_T]]
iterable_iterator: Iterator[_T]

View File

@@ -1,6 +1,6 @@
from _typeshed import Incomplete, SupportsWrite
from collections.abc import Iterable, Mapping
from typing import Generic, NoReturn, TypeVar, overload
from typing import NoReturn, TypeVar, overload
from ..auto import tqdm as tqdm_auto
from .utils_worker import MonoWorker
@@ -15,7 +15,7 @@ class DiscordIO(MonoWorker):
_T = TypeVar("_T")
class tqdm_discord(tqdm_auto[_T], Generic[_T]):
class tqdm_discord(tqdm_auto[_T]):
dio: Incomplete
@overload
def __init__(

View File

@@ -1,6 +1,6 @@
from _typeshed import Incomplete, SupportsWrite
from collections.abc import Iterable, Mapping
from typing import Generic, NoReturn, TypeVar, overload
from typing import NoReturn, TypeVar, overload
from ..auto import tqdm as tqdm_auto
from .utils_worker import MonoWorker
@@ -16,7 +16,7 @@ class SlackIO(MonoWorker):
_T = TypeVar("_T")
class tqdm_slack(tqdm_auto[_T], Generic[_T]):
class tqdm_slack(tqdm_auto[_T]):
sio: Incomplete
@overload
def __init__(

View File

@@ -1,6 +1,6 @@
from _typeshed import Incomplete, SupportsWrite
from collections.abc import Iterable, Mapping
from typing import Generic, NoReturn, TypeVar, overload
from typing import NoReturn, TypeVar, overload
from ..auto import tqdm as tqdm_auto
from .utils_worker import MonoWorker
@@ -21,7 +21,7 @@ class TelegramIO(MonoWorker):
_T = TypeVar("_T")
class tqdm_telegram(tqdm_auto[_T], Generic[_T]):
class tqdm_telegram(tqdm_auto[_T]):
tgio: Incomplete
@overload
def __init__(

View File

@@ -1,6 +1,6 @@
from _typeshed import Incomplete, SupportsWrite
from collections.abc import Iterable, Mapping
from typing import Generic, NoReturn, TypeVar, overload
from typing import NoReturn, TypeVar, overload
from .std import tqdm as std_tqdm
@@ -8,7 +8,7 @@ __all__ = ["tqdm_gui", "tgrange", "tqdm", "trange"]
_T = TypeVar("_T")
class tqdm_gui(std_tqdm[_T], Generic[_T]):
class tqdm_gui(std_tqdm[_T]):
mpl: Incomplete
plt: Incomplete
toolbar: Incomplete

View File

@@ -1,6 +1,6 @@
from _typeshed import Incomplete, SupportsWrite
from collections.abc import Iterable, Iterator, Mapping
from typing import Generic, NoReturn, TypeVar, overload
from typing import NoReturn, TypeVar, overload
from .std import tqdm as std_tqdm, trange as trange
@@ -8,7 +8,7 @@ __all__ = ["tqdm_notebook", "tnrange", "tqdm", "trange"]
_T = TypeVar("_T")
class tqdm_notebook(std_tqdm[_T], Generic[_T]):
class tqdm_notebook(std_tqdm[_T]):
@staticmethod
def status_printer(
_: SupportsWrite[str] | None, total: float | None = None, desc: str | None = None, ncols: int | None = None

View File

@@ -1,12 +1,14 @@
from _typeshed import Incomplete, SupportsWrite
from abc import ABC, abstractmethod
from collections.abc import Iterable, Mapping
from typing import Generic, NoReturn, TypeVar, overload
from typing import NoReturn, TypeVar, overload
from .std import tqdm as std_tqdm
__all__ = ["tqdm_rich", "trrange", "tqdm", "trange"]
_T = TypeVar("_T")
# Actually rich.progress.ProgressColumn
class _ProgressColumn(ABC):
max_refresh: float | None
@@ -31,9 +33,7 @@ class RateColumn(_ProgressColumn):
def __init__(self, unit: str = ..., unit_scale: bool = ..., unit_divisor: int = ...) -> None: ...
def render(self, task): ...
_T = TypeVar("_T")
class tqdm_rich(std_tqdm[_T], Generic[_T]):
class tqdm_rich(std_tqdm[_T]):
def close(self) -> None: ...
def clear(self, *_, **__) -> None: ...
def display(self, *_, **__) -> None: ...

View File

@@ -1,6 +1,6 @@
from _typeshed import Incomplete, SupportsWrite
from collections.abc import Iterable, Mapping
from typing import Generic, NoReturn, TypeVar, overload
from typing import NoReturn, TypeVar, overload
from .std import tqdm as std_tqdm
@@ -8,7 +8,7 @@ __all__ = ["tqdm_tk", "ttkrange", "tqdm", "trange"]
_T = TypeVar("_T")
class tqdm_tk(std_tqdm[_T], Generic[_T]):
class tqdm_tk(std_tqdm[_T]):
@overload
def __init__(
self,