mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-10 21:42:25 +08:00
Update Unused parameters in stubs/ (#9704)
* Update _Unused TypeAlias * Update `object | None` params * Replace unused `object` parameters with `Unused` alias
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from _typeshed import SupportsItems
|
||||
from _typeshed import SupportsItems, Unused
|
||||
from collections.abc import Iterable, Mapping, Sequence
|
||||
from typing import Any, NamedTuple
|
||||
from typing_extensions import Self, TypeAlias
|
||||
@@ -6,11 +6,14 @@ from typing_extensions import Self, TypeAlias
|
||||
from ..util import immutabledict
|
||||
from .interfaces import Dialect
|
||||
|
||||
# object that produces a password when called with str()
|
||||
_PasswordObject: TypeAlias = object
|
||||
|
||||
# stub-only helper class
|
||||
class _URLTuple(NamedTuple):
|
||||
drivername: str
|
||||
username: str | None
|
||||
password: str | object | None # object that produces a password when called with str()
|
||||
password: str | _PasswordObject | None
|
||||
host: str | None
|
||||
port: int | None
|
||||
database: str | None
|
||||
@@ -24,7 +27,7 @@ class URL(_URLTuple):
|
||||
cls,
|
||||
drivername: str,
|
||||
username: str | None = ...,
|
||||
password: str | object | None = ..., # object that produces a password when called with str()
|
||||
password: str | _PasswordObject | None = None,
|
||||
host: str | None = ...,
|
||||
port: int | None = ...,
|
||||
database: str | None = ...,
|
||||
@@ -34,7 +37,7 @@ class URL(_URLTuple):
|
||||
self,
|
||||
drivername: str | None = ...,
|
||||
username: str | None = ...,
|
||||
password: str | object | None = ...,
|
||||
password: str | _PasswordObject | None = None,
|
||||
host: str | None = ...,
|
||||
port: int | None = ...,
|
||||
database: str | None = ...,
|
||||
@@ -49,7 +52,7 @@ class URL(_URLTuple):
|
||||
def __to_string__(self, hide_password: bool = ...) -> str: ...
|
||||
def render_as_string(self, hide_password: bool = ...) -> str: ...
|
||||
def __copy__(self) -> Self: ...
|
||||
def __deepcopy__(self, memo: object) -> Self: ...
|
||||
def __deepcopy__(self, memo: Unused) -> Self: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from _typeshed import Unused
|
||||
from logging import Logger
|
||||
from typing import Any, TypeVar, overload
|
||||
from typing_extensions import Literal, Self, TypeAlias
|
||||
@@ -32,7 +33,7 @@ def instance_logger(instance: Identified, echoflag: _EchoFlag = ...) -> None: ..
|
||||
class echo_property:
|
||||
__doc__: str
|
||||
@overload
|
||||
def __get__(self, instance: None, owner: object) -> Self: ...
|
||||
def __get__(self, instance: None, owner: Unused) -> Self: ...
|
||||
@overload
|
||||
def __get__(self, instance: Identified, owner: object) -> _EchoFlag: ...
|
||||
def __get__(self, instance: Identified, owner: Unused) -> _EchoFlag: ...
|
||||
def __set__(self, instance: Identified, value: _EchoFlag) -> None: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from _typeshed import Incomplete
|
||||
from _typeshed import Incomplete, Unused
|
||||
from collections.abc import Callable
|
||||
from typing import Any, ClassVar, TypeVar, overload
|
||||
from typing_extensions import TypeAlias
|
||||
@@ -28,7 +28,7 @@ _DeclarativeBaseMeta: TypeAlias = Callable[[str, tuple[type[Any], ...], dict[str
|
||||
def has_inherited_table(cls: type[Any]) -> bool: ...
|
||||
|
||||
class DeclarativeMeta(type):
|
||||
def __init__(cls, classname: str, bases: tuple[type[Any], ...], dict_: dict[str, Any], **kw: object) -> None: ...
|
||||
def __init__(cls, classname: str, bases: tuple[type[Any], ...], dict_: dict[str, Any], **kw: Unused) -> None: ...
|
||||
def __setattr__(cls, key: str, value: Any) -> None: ...
|
||||
def __delattr__(cls, key: str) -> None: ...
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import collections.abc
|
||||
from _typeshed import Incomplete, SupportsKeysAndGetItem
|
||||
from _typeshed import Incomplete, SupportsKeysAndGetItem, Unused
|
||||
from collections.abc import Callable, Iterable, Iterator, Mapping
|
||||
from typing import Any, Generic, NoReturn, TypeVar, overload
|
||||
from typing_extensions import Self
|
||||
@@ -16,9 +16,9 @@ collections_abc = collections.abc
|
||||
EMPTY_SET: frozenset[Any]
|
||||
|
||||
class ImmutableContainer:
|
||||
def __delitem__(self, *arg: object, **kw: object) -> NoReturn: ...
|
||||
def __setitem__(self, *arg: object, **kw: object) -> NoReturn: ...
|
||||
def __setattr__(self, *arg: object, **kw: object) -> NoReturn: ...
|
||||
def __delitem__(self, *arg: Unused, **kw: Unused) -> NoReturn: ...
|
||||
def __setitem__(self, *arg: Unused, **kw: Unused) -> NoReturn: ...
|
||||
def __setattr__(self, *arg: Unused, **kw: Unused) -> NoReturn: ...
|
||||
|
||||
@overload
|
||||
def coerce_to_immutabledict(d: None) -> immutabledict[Any, Any]: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from _typeshed import Incomplete
|
||||
from _typeshed import Incomplete, Unused
|
||||
from collections.abc import Callable
|
||||
from typing import Any, Generic, TypeVar, overload
|
||||
from typing_extensions import Self
|
||||
@@ -71,9 +71,9 @@ class memoized_property(Generic[_R]):
|
||||
__name__: str
|
||||
def __init__(self, fget: Callable[..., _R], doc: str | None = ...) -> None: ...
|
||||
@overload
|
||||
def __get__(self, obj: None, cls: object) -> Self: ...
|
||||
def __get__(self, obj: None, cls: Unused) -> Self: ...
|
||||
@overload
|
||||
def __get__(self, obj: object, cls: object) -> _R: ...
|
||||
def __get__(self, obj: object, cls: Unused) -> _R: ...
|
||||
@classmethod
|
||||
def reset(cls, obj: object, name: str) -> None: ...
|
||||
|
||||
@@ -86,9 +86,9 @@ class HasMemoized:
|
||||
__name__: str
|
||||
def __init__(self, fget: Callable[..., _R], doc: str | None = ...) -> None: ...
|
||||
@overload
|
||||
def __get__(self, obj: None, cls: object) -> Self: ...
|
||||
def __get__(self, obj: None, cls: Unused) -> Self: ...
|
||||
@overload
|
||||
def __get__(self, obj: object, cls: object) -> _R: ...
|
||||
def __get__(self, obj: object, cls: Unused) -> _R: ...
|
||||
|
||||
@classmethod
|
||||
def memoized_instancemethod(cls, fn): ...
|
||||
|
||||
Reference in New Issue
Block a user