Skip to content

Commit 078c6a0

Browse files
authored
Update Unused parameters in stubs/ (#9704)
* Update _Unused TypeAlias * Update `object | None` params * Replace unused `object` parameters with `Unused` alias
1 parent fbc092b commit 078c6a0

33 files changed

Lines changed: 134 additions & 133 deletions

File tree

stubs/D3DShot/d3dshot/capture_outputs/pil_capture_output.pyi

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1+
from _typeshed import Unused
12
from collections.abc import Sequence
23
from ctypes import _CVoidConstPLike
34
from typing import TypeVar
4-
from typing_extensions import TypeAlias
55

66
from d3dshot.capture_output import CaptureOutput
77
from PIL import Image
88

9-
_Unused: TypeAlias = object
109
_ImageT = TypeVar("_ImageT", bound=Image.Image)
1110

1211
class PILCaptureOutput(CaptureOutput):
@@ -22,4 +21,4 @@ class PILCaptureOutput(CaptureOutput):
2221
rotation: int,
2322
) -> Image.Image: ...
2423
def to_pil(self, frame: _ImageT) -> _ImageT: ...
25-
def stack(self, frames: Sequence[_ImageT], stack_dimension: _Unused) -> Sequence[_ImageT]: ...
24+
def stack(self, frames: Sequence[_ImageT], stack_dimension: Unused) -> Sequence[_ImageT]: ...

stubs/Pillow/PIL/PSDraw.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
from _typeshed import SupportsWrite
1+
from _typeshed import SupportsWrite, Unused
22

33
from .Image import Image
44

55
class PSDraw:
66
fp: SupportsWrite[bytes]
77
def __init__(self, fp: SupportsWrite[bytes] | None = ...) -> None: ...
88
isofont: dict[bytes, int]
9-
def begin_document(self, id: object | None = ...) -> None: ...
9+
def begin_document(self, id: Unused = None) -> None: ...
1010
def end_document(self) -> None: ...
1111
def setfont(self, font: str, size: int) -> None: ...
1212
def line(self, xy0: tuple[int, int], xy1: tuple[int, int]) -> None: ...

stubs/PyMySQL/pymysql/converters.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import datetime
22
import time
3+
from _typeshed import Unused
34
from collections.abc import Callable, Mapping, Sequence
45
from decimal import Decimal
56
from typing import Any, TypeVar
@@ -25,7 +26,7 @@ def escape_time(obj: datetime.time, mapping: _EscaperMapping = ...) -> str: ...
2526
def escape_datetime(obj: datetime.datetime, mapping: _EscaperMapping = ...) -> str: ...
2627
def escape_date(obj: datetime.date, mapping: _EscaperMapping = ...) -> str: ...
2728
def escape_struct_time(obj: time.struct_time, mapping: _EscaperMapping = ...) -> str: ...
28-
def Decimal2Literal(o: Decimal, d: object) -> str: ...
29+
def Decimal2Literal(o: Decimal, d: Unused) -> str: ...
2930
def convert_datetime(obj: str | bytes) -> datetime.datetime | str: ...
3031
def convert_timedelta(obj: str | bytes) -> datetime.timedelta | str: ...
3132
def convert_time(obj: str | bytes) -> datetime.time | str: ...

stubs/PyScreeze/pyscreeze/__init__.pyi

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
from _typeshed import Incomplete, StrOrBytesPath
1+
from _typeshed import Incomplete, StrOrBytesPath, Unused
22
from collections.abc import Callable, Generator
33
from typing import NamedTuple, SupportsFloat, TypeVar, overload
44
from typing_extensions import Final, ParamSpec, SupportsIndex, TypeAlias
55

66
from PIL import Image
77

8-
_Unused: TypeAlias = object
98
_P = ParamSpec("_P")
109
_R = TypeVar("_R")
1110
# TODO: cv2.Mat is not available as a type yet:
@@ -49,7 +48,7 @@ def locate(
4948
haystackImage: str | Image.Image | _Mat,
5049
*,
5150
grayscale: bool | None = None,
52-
limit: _Unused = 1,
51+
limit: Unused = 1,
5352
region: tuple[int, int, int, int] | None = None,
5453
step: int = 1,
5554
confidence: SupportsFloat | SupportsIndex | str = 0.999,
@@ -62,7 +61,7 @@ def locate(
6261
haystackImage: str | Image.Image,
6362
*,
6463
grayscale: bool | None = None,
65-
limit: _Unused = 1,
64+
limit: Unused = 1,
6665
region: tuple[int, int, int, int] | None = None,
6766
step: int = 1,
6867
confidence: None = None,
@@ -75,7 +74,7 @@ def locateOnScreen(
7574
minSearchTime: float = 0,
7675
*,
7776
grayscale: bool | None = None,
78-
limit: _Unused = 1,
77+
limit: Unused = 1,
7978
region: tuple[int, int, int, int] | None = None,
8079
step: int = 1,
8180
confidence: SupportsFloat | SupportsIndex | str = 0.999,
@@ -88,7 +87,7 @@ def locateOnScreen(
8887
minSearchTime: float = 0,
8988
*,
9089
grayscale: bool | None = None,
91-
limit: _Unused = 1,
90+
limit: Unused = 1,
9291
region: tuple[int, int, int, int] | None = None,
9392
step: int = 1,
9493
confidence: None = None,
@@ -125,7 +124,7 @@ def locateCenterOnScreen(
125124
*,
126125
minSearchTime: float,
127126
grayscale: bool | None = None,
128-
limit: _Unused = 1,
127+
limit: Unused = 1,
129128
region: tuple[int, int, int, int] | None = None,
130129
step: int = 1,
131130
confidence: SupportsFloat | SupportsIndex | str = 0.999,
@@ -138,7 +137,7 @@ def locateCenterOnScreen(
138137
*,
139138
minSearchTime: float,
140139
grayscale: bool | None = None,
141-
limit: _Unused = 1,
140+
limit: Unused = 1,
142141
region: tuple[int, int, int, int] | None = None,
143142
step: int = 1,
144143
confidence: None = None,
@@ -151,7 +150,7 @@ def locateOnWindow(
151150
title: str,
152151
*,
153152
grayscale: bool | None = None,
154-
limit: _Unused = 1,
153+
limit: Unused = 1,
155154
step: int = 1,
156155
confidence: SupportsFloat | SupportsIndex | str = 0.999,
157156
) -> Box | None: ...
@@ -163,7 +162,7 @@ def locateOnWindow(
163162
title: str,
164163
*,
165164
grayscale: bool | None = None,
166-
limit: _Unused = 1,
165+
limit: Unused = 1,
167166
step: int = 1,
168167
confidence: None = None,
169168
) -> Box | None: ...

stubs/SQLAlchemy/sqlalchemy/engine/url.pyi

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
from _typeshed import SupportsItems
1+
from _typeshed import SupportsItems, Unused
22
from collections.abc import Iterable, Mapping, Sequence
33
from typing import Any, NamedTuple
44
from typing_extensions import Self, TypeAlias
55

66
from ..util import immutabledict
77
from .interfaces import Dialect
88

9+
# object that produces a password when called with str()
10+
_PasswordObject: TypeAlias = object
11+
912
# stub-only helper class
1013
class _URLTuple(NamedTuple):
1114
drivername: str
1215
username: str | None
13-
password: str | object | None # object that produces a password when called with str()
16+
password: str | _PasswordObject | None
1417
host: str | None
1518
port: int | None
1619
database: str | None
@@ -24,7 +27,7 @@ class URL(_URLTuple):
2427
cls,
2528
drivername: str,
2629
username: str | None = ...,
27-
password: str | object | None = ..., # object that produces a password when called with str()
30+
password: str | _PasswordObject | None = None,
2831
host: str | None = ...,
2932
port: int | None = ...,
3033
database: str | None = ...,
@@ -34,7 +37,7 @@ class URL(_URLTuple):
3437
self,
3538
drivername: str | None = ...,
3639
username: str | None = ...,
37-
password: str | object | None = ...,
40+
password: str | _PasswordObject | None = None,
3841
host: str | None = ...,
3942
port: int | None = ...,
4043
database: str | None = ...,
@@ -49,7 +52,7 @@ class URL(_URLTuple):
4952
def __to_string__(self, hide_password: bool = ...) -> str: ...
5053
def render_as_string(self, hide_password: bool = ...) -> str: ...
5154
def __copy__(self) -> Self: ...
52-
def __deepcopy__(self, memo: object) -> Self: ...
55+
def __deepcopy__(self, memo: Unused) -> Self: ...
5356
def __hash__(self) -> int: ...
5457
def __eq__(self, other: object) -> bool: ...
5558
def __ne__(self, other: object) -> bool: ...

stubs/SQLAlchemy/sqlalchemy/log.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from _typeshed import Unused
12
from logging import Logger
23
from typing import Any, TypeVar, overload
34
from typing_extensions import Literal, Self, TypeAlias
@@ -32,7 +33,7 @@ def instance_logger(instance: Identified, echoflag: _EchoFlag = ...) -> None: ..
3233
class echo_property:
3334
__doc__: str
3435
@overload
35-
def __get__(self, instance: None, owner: object) -> Self: ...
36+
def __get__(self, instance: None, owner: Unused) -> Self: ...
3637
@overload
37-
def __get__(self, instance: Identified, owner: object) -> _EchoFlag: ...
38+
def __get__(self, instance: Identified, owner: Unused) -> _EchoFlag: ...
3839
def __set__(self, instance: Identified, value: _EchoFlag) -> None: ...

stubs/SQLAlchemy/sqlalchemy/orm/decl_api.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from _typeshed import Incomplete
1+
from _typeshed import Incomplete, Unused
22
from collections.abc import Callable
33
from typing import Any, ClassVar, TypeVar, overload
44
from typing_extensions import TypeAlias
@@ -28,7 +28,7 @@ _DeclarativeBaseMeta: TypeAlias = Callable[[str, tuple[type[Any], ...], dict[str
2828
def has_inherited_table(cls: type[Any]) -> bool: ...
2929

3030
class DeclarativeMeta(type):
31-
def __init__(cls, classname: str, bases: tuple[type[Any], ...], dict_: dict[str, Any], **kw: object) -> None: ...
31+
def __init__(cls, classname: str, bases: tuple[type[Any], ...], dict_: dict[str, Any], **kw: Unused) -> None: ...
3232
def __setattr__(cls, key: str, value: Any) -> None: ...
3333
def __delattr__(cls, key: str) -> None: ...
3434

stubs/SQLAlchemy/sqlalchemy/util/_collections.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import collections.abc
2-
from _typeshed import Incomplete, SupportsKeysAndGetItem
2+
from _typeshed import Incomplete, SupportsKeysAndGetItem, Unused
33
from collections.abc import Callable, Iterable, Iterator, Mapping
44
from typing import Any, Generic, NoReturn, TypeVar, overload
55
from typing_extensions import Self
@@ -16,9 +16,9 @@ collections_abc = collections.abc
1616
EMPTY_SET: frozenset[Any]
1717

1818
class ImmutableContainer:
19-
def __delitem__(self, *arg: object, **kw: object) -> NoReturn: ...
20-
def __setitem__(self, *arg: object, **kw: object) -> NoReturn: ...
21-
def __setattr__(self, *arg: object, **kw: object) -> NoReturn: ...
19+
def __delitem__(self, *arg: Unused, **kw: Unused) -> NoReturn: ...
20+
def __setitem__(self, *arg: Unused, **kw: Unused) -> NoReturn: ...
21+
def __setattr__(self, *arg: Unused, **kw: Unused) -> NoReturn: ...
2222

2323
@overload
2424
def coerce_to_immutabledict(d: None) -> immutabledict[Any, Any]: ...

stubs/SQLAlchemy/sqlalchemy/util/langhelpers.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from _typeshed import Incomplete
1+
from _typeshed import Incomplete, Unused
22
from collections.abc import Callable
33
from typing import Any, Generic, TypeVar, overload
44
from typing_extensions import Self
@@ -71,9 +71,9 @@ class memoized_property(Generic[_R]):
7171
__name__: str
7272
def __init__(self, fget: Callable[..., _R], doc: str | None = ...) -> None: ...
7373
@overload
74-
def __get__(self, obj: None, cls: object) -> Self: ...
74+
def __get__(self, obj: None, cls: Unused) -> Self: ...
7575
@overload
76-
def __get__(self, obj: object, cls: object) -> _R: ...
76+
def __get__(self, obj: object, cls: Unused) -> _R: ...
7777
@classmethod
7878
def reset(cls, obj: object, name: str) -> None: ...
7979

@@ -86,9 +86,9 @@ class HasMemoized:
8686
__name__: str
8787
def __init__(self, fget: Callable[..., _R], doc: str | None = ...) -> None: ...
8888
@overload
89-
def __get__(self, obj: None, cls: object) -> Self: ...
89+
def __get__(self, obj: None, cls: Unused) -> Self: ...
9090
@overload
91-
def __get__(self, obj: object, cls: object) -> _R: ...
91+
def __get__(self, obj: object, cls: Unused) -> _R: ...
9292

9393
@classmethod
9494
def memoized_instancemethod(cls, fn): ...
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
from _typeshed import Unused
12
from collections.abc import Hashable
23

34
__all__ = ("hashkey", "methodkey", "typedkey")
45

56
def hashkey(*args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ...
6-
def methodkey(self: object, *args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ...
7+
def methodkey(self: Unused, *args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ...
78
def typedkey(*args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ...

0 commit comments

Comments
 (0)