Skip to content

Fix dunder-method positional-only parameter discrepancies in third-party stubs #14529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stubs/braintree/braintree/attribute_getter.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ class AttributeGetter:
def __init__(self, attributes: dict[str, Any] | None = None) -> None: ...
# This doesn't exist at runtime, but subclasses should define their own fields populated by attributes in __init__
# Until that's done, keep __getattribute__ to fill in the gaps
def __getattribute__(self, name: str) -> Any: ...
def __getattribute__(self, name: str, /) -> Any: ...
30 changes: 16 additions & 14 deletions stubs/cffi/_cffi_backend.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,32 @@ class Lib:
@final
class _CDataBase:
__name__: ClassVar[str]
def __add__(self, other): ...
def __add__(self, other, /): ...
def __bool__(self) -> bool: ...
def __call__(self, *args, **kwargs): ...
def __complex__(self) -> complex: ...
def __delitem__(self, other) -> None: ...
def __delitem__(self, other, /) -> None: ...
def __dir__(self): ...
def __enter__(self): ...
def __eq__(self, other): ...
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, traceback: types.TracebackType | None): ...
def __eq__(self, other, /): ...
def __exit__(
self, type: type[BaseException] | None, value: BaseException | None, traceback: types.TracebackType | None, /
): ...
def __float__(self) -> float: ...
def __ge__(self, other): ...
def __getitem__(self, index: SupportsIndex | slice): ...
def __gt__(self, other): ...
def __ge__(self, other, /): ...
def __getitem__(self, index: SupportsIndex | slice, /): ...
def __gt__(self, other, /): ...
def __hash__(self) -> int: ...
def __int__(self) -> int: ...
def __iter__(self): ...
def __le__(self, other): ...
def __le__(self, other, /): ...
def __len__(self) -> int: ...
def __lt__(self, other): ...
def __ne__(self, other): ...
def __radd__(self, other): ...
def __rsub__(self, other): ...
def __setitem__(self, index: SupportsIndex | slice, object) -> None: ...
def __sub__(self, other): ...
def __lt__(self, other, /): ...
def __ne__(self, other, /): ...
def __radd__(self, other, /): ...
def __rsub__(self, other, /): ...
def __setitem__(self, index: SupportsIndex | slice, object, /) -> None: ...
def __sub__(self, other, /): ...

@final
class buffer:
Expand Down
48 changes: 24 additions & 24 deletions stubs/gdb/gdb/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -83,29 +83,29 @@ class Value:
def __index__(self) -> int: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __add__(self, other: _ValueOrNative) -> Value: ...
def __radd__(self, other: _ValueOrNative) -> Value: ...
def __sub__(self, other: _ValueOrNative) -> Value: ...
def __rsub__(self, other: _ValueOrNative) -> Value: ...
def __mul__(self, other: _ValueOrNative) -> Value: ...
def __rmul__(self, other: _ValueOrNative) -> Value: ...
def __truediv__(self, other: _ValueOrNative) -> Value: ...
def __rtruediv__(self, other: _ValueOrNative) -> Value: ...
def __mod__(self, other: _ValueOrNative) -> Value: ...
def __rmod__(self, other: _ValueOrNative) -> Value: ...
def __pow__(self, other: _ValueOrNative, mod: None = None) -> Value: ...
def __and__(self, other: _ValueOrNative) -> Value: ...
def __or__(self, other: _ValueOrNative) -> Value: ...
def __xor__(self, other: _ValueOrNative) -> Value: ...
def __lshift__(self, other: _ValueOrNative) -> Value: ...
def __rshift__(self, other: _ValueOrNative) -> Value: ...
def __eq__(self, other: _ValueOrNative) -> bool: ... # type: ignore[override]
def __ne__(self, other: _ValueOrNative) -> bool: ... # type: ignore[override]
def __lt__(self, other: _ValueOrNative) -> bool: ...
def __le__(self, other: _ValueOrNative) -> bool: ...
def __gt__(self, other: _ValueOrNative) -> bool: ...
def __ge__(self, other: _ValueOrNative) -> bool: ...
def __getitem__(self, key: int | str | Field) -> Value: ...
def __add__(self, other: _ValueOrNative, /) -> Value: ...
def __radd__(self, other: _ValueOrNative, /) -> Value: ...
def __sub__(self, other: _ValueOrNative, /) -> Value: ...
def __rsub__(self, other: _ValueOrNative, /) -> Value: ...
def __mul__(self, other: _ValueOrNative, /) -> Value: ...
def __rmul__(self, other: _ValueOrNative, /) -> Value: ...
def __truediv__(self, other: _ValueOrNative, /) -> Value: ...
def __rtruediv__(self, other: _ValueOrNative, /) -> Value: ...
def __mod__(self, other: _ValueOrNative, /) -> Value: ...
def __rmod__(self, other: _ValueOrNative, /) -> Value: ...
def __pow__(self, other: _ValueOrNative, mod: None = None, /) -> Value: ...
def __and__(self, other: _ValueOrNative, /) -> Value: ...
def __or__(self, other: _ValueOrNative, /) -> Value: ...
def __xor__(self, other: _ValueOrNative, /) -> Value: ...
def __lshift__(self, other: _ValueOrNative, /) -> Value: ...
def __rshift__(self, other: _ValueOrNative, /) -> Value: ...
def __eq__(self, other: _ValueOrNative, /) -> bool: ... # type: ignore[override]
def __ne__(self, other: _ValueOrNative, /) -> bool: ... # type: ignore[override]
def __lt__(self, other: _ValueOrNative, /) -> bool: ...
def __le__(self, other: _ValueOrNative, /) -> bool: ...
def __gt__(self, other: _ValueOrNative, /) -> bool: ...
def __ge__(self, other: _ValueOrNative, /) -> bool: ...
def __getitem__(self, key: int | str | Field, /) -> Value: ...
def __call__(self, *args: _ValueOrNative) -> Value: ...
def __init__(self, val: _ValueOrNative) -> None: ...
def cast(self, type: Type) -> Value: ...
Expand Down Expand Up @@ -175,7 +175,7 @@ class Type(Mapping[str, Field]):
def get(self, key: str, default: Any = ...) -> Field | Any: ...
def has_key(self, key: str) -> bool: ...
def __len__(self) -> int: ...
def __getitem__(self, key: str) -> Field: ...
def __getitem__(self, key: str, /) -> Field: ...
def __iter__(self) -> TypeIterator[str]: ...

_T = TypeVar("_T")
Expand Down
6 changes: 3 additions & 3 deletions stubs/gevent/gevent/local.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ from typing_extensions import Self
class local:
def __init__(self, *args: object, **kwargs: object) -> None: ...
def __copy__(self) -> Self: ...
def __getattribute__(self, name: str) -> Any: ...
def __delattr__(self, name: str) -> None: ...
def __setattr__(self, name: str, value: Any) -> None: ...
def __getattribute__(self, name: str, /) -> Any: ...
def __delattr__(self, name: str, /) -> None: ...
def __setattr__(self, name: str, value: Any, /) -> None: ...

__all__ = ["local"]
4 changes: 2 additions & 2 deletions stubs/hdbcli/hdbcli/resultrow.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class ResultRow:

def __len__(self) -> int: ...
@overload
def __getitem__(self, index: int) -> Any: ...
def __getitem__(self, index: int, /) -> Any: ...
@overload
def __getitem__(self, index: slice) -> Sequence[Any]: ...
def __getitem__(self, index: slice, /) -> Sequence[Any]: ...
def __iter__(self) -> Iterator[Any]: ...
# __next__, __delitem__, __setitem__ are technically defined but lead always to an error
24 changes: 18 additions & 6 deletions stubs/pika/pika/exchange_type.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
from enum import Enum
import sys

class ExchangeType(Enum):
direct = "direct"
fanout = "fanout"
headers = "headers"
topic = "topic"
if sys.version_info >= (3, 11):
from enum import StrEnum

class ExchangeType(StrEnum):
direct = "direct"
fanout = "fanout"
headers = "headers"
topic = "topic"

else:
from enum import Enum

class ExchangeType(str, Enum):
direct = "direct"
fanout = "fanout"
headers = "headers"
topic = "topic"
76 changes: 38 additions & 38 deletions stubs/protobuf/google/_upb/_message.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,18 @@ class EnumValueDescriptor:

@final
class ExtensionDict:
def __contains__(self, other) -> bool: ...
def __delitem__(self, other) -> None: ...
def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: object) -> bool: ...
def __getitem__(self, index): ...
def __gt__(self, other: object) -> bool: ...
def __contains__(self, other, /) -> bool: ...
def __delitem__(self, other, /) -> None: ...
def __eq__(self, other: object, /) -> bool: ...
def __ge__(self, other: object, /) -> bool: ...
def __getitem__(self, index, /): ...
def __gt__(self, other: object, /) -> bool: ...
def __iter__(self): ...
def __le__(self, other: object) -> bool: ...
def __le__(self, other: object, /) -> bool: ...
def __len__(self) -> int: ...
def __lt__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __setitem__(self, index, object) -> None: ...
def __lt__(self, other: object, /) -> bool: ...
def __ne__(self, other: object, /) -> bool: ...
def __setitem__(self, index, object, /) -> None: ...

@final
class ExtensionIterator:
Expand Down Expand Up @@ -201,16 +201,16 @@ class Message:
def SetInParent(self): ...
def UnknownFields(self): ...
def WhichOneof(self, object, /): ...
def __contains__(self, other) -> bool: ...
def __contains__(self, other, /) -> bool: ...
def __deepcopy__(self, memo=None): ...
def __delattr__(self, name): ...
def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: object) -> bool: ...
def __gt__(self, other: object) -> bool: ...
def __le__(self, other: object) -> bool: ...
def __lt__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __setattr__(self, name, value): ...
def __delattr__(self, name, /): ...
def __eq__(self, other: object, /) -> bool: ...
def __ge__(self, other: object, /) -> bool: ...
def __gt__(self, other: object, /) -> bool: ...
def __le__(self, other: object, /) -> bool: ...
def __lt__(self, other: object, /) -> bool: ...
def __ne__(self, other: object, /) -> bool: ...
def __setattr__(self, name, value, /): ...

@final
class MessageMeta(type): ...
Expand Down Expand Up @@ -253,16 +253,16 @@ class RepeatedCompositeContainer:
def reverse(self): ...
def sort(self, *args, **kwargs): ... # incomplete
def __deepcopy__(self, memo=None): ...
def __delitem__(self, other) -> None: ...
def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: object) -> bool: ...
def __getitem__(self, index): ...
def __gt__(self, other: object) -> bool: ...
def __le__(self, other: object) -> bool: ...
def __delitem__(self, other, /) -> None: ...
def __eq__(self, other: object, /) -> bool: ...
def __ge__(self, other: object, /) -> bool: ...
def __getitem__(self, index, /): ...
def __gt__(self, other: object, /) -> bool: ...
def __le__(self, other: object, /) -> bool: ...
def __len__(self) -> int: ...
def __lt__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __setitem__(self, index, object) -> None: ...
def __lt__(self, other: object, /) -> bool: ...
def __ne__(self, other: object, /) -> bool: ...
def __setitem__(self, index, object, /) -> None: ...

@final
class RepeatedScalarContainer:
Expand All @@ -276,17 +276,17 @@ class RepeatedScalarContainer:
def reverse(self): ...
def sort(self, *args, **kwargs): ... # incomplete
def __deepcopy__(self, memo=None): ...
def __delitem__(self, other) -> None: ...
def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: object) -> bool: ...
def __getitem__(self, index): ...
def __gt__(self, other: object) -> bool: ...
def __le__(self, other: object) -> bool: ...
def __delitem__(self, other, /) -> None: ...
def __eq__(self, other: object, /) -> bool: ...
def __ge__(self, other: object, /) -> bool: ...
def __getitem__(self, index, /): ...
def __gt__(self, other: object, /) -> bool: ...
def __le__(self, other: object, /) -> bool: ...
def __len__(self) -> int: ...
def __lt__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __lt__(self, other: object, /) -> bool: ...
def __ne__(self, other: object, /) -> bool: ...
def __reduce__(self): ...
def __setitem__(self, index, object) -> None: ...
def __setitem__(self, index, object, /) -> None: ...

@final
class ServiceDescriptor:
Expand All @@ -304,7 +304,7 @@ class ServiceDescriptor:
@final
class UnknownFieldSet:
def __init__(self, *args, **kwargs) -> None: ... # incomplete
def __getitem__(self, index): ...
def __getitem__(self, index, /): ...
def __len__(self) -> int: ...

def SetAllowOversizeProtos(object, /): ... # incomplete
4 changes: 2 additions & 2 deletions stubs/psycopg2/psycopg2/_psycopg.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class Column:
def __len__(self) -> int: ...
def __lt__(self, other, /): ...
def __ne__(self, other, /): ...
def __setstate__(self, state): ...
def __setstate__(self, state, /): ...

class ConnectionInfo:
# Note: the following properties can be None if their corresponding libpq function
Expand Down Expand Up @@ -275,7 +275,7 @@ class Error(Exception):
pgerror: str | None
def __init__(self, *args, **kwargs) -> None: ...
def __reduce__(self): ...
def __setstate__(self, state): ...
def __setstate__(self, state, /): ...

class DatabaseError(Error): ...
class DataError(DatabaseError): ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/pywin32/_win32typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1667,7 +1667,7 @@ class PySecBufferDesc:
Version: Incomplete
Buffer: Incomplete
def append(self, buffer, /) -> None: ...
def __getitem__(self, index: SupportsIndex) -> PySecBuffer: ...
def __getitem__(self, index: SupportsIndex, /) -> PySecBuffer: ...

class PyTOKEN_GROUPS: ...
class PyTOKEN_PRIVILEGES: ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/shapely/shapely/geometry/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class BaseGeometry(Geometry):
def __xor__(self, other: OptGeoArrayLikeSeq) -> GeoArray: ...
@overload
def __xor__(self, other: None) -> None: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __eq__(self, other: object, /) -> bool: ...
def __ne__(self, other: object, /) -> bool: ...
def __hash__(self) -> int: ...
@property
def coords(self) -> CoordinateSequence: ...
Expand Down
12 changes: 6 additions & 6 deletions stubs/shapely/shapely/lib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ registry: list[type[Geometry]]

class Geometry:
def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __ge__(self, other: Never) -> bool: ...
def __gt__(self, other: Never) -> bool: ...
def __le__(self, other: Never) -> bool: ...
def __lt__(self, other: Never) -> bool: ...
def __eq__(self, other: object, /) -> bool: ...
def __ne__(self, other: object, /) -> bool: ...
def __ge__(self, other: Never, /) -> bool: ...
def __gt__(self, other: Never, /) -> bool: ...
def __le__(self, other: Never, /) -> bool: ...
def __lt__(self, other: Never, /) -> bool: ...

@final
class STRtree:
Expand Down
Loading