Skip to content

Annotate known magic method return types #9131

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 4 commits into from
Nov 8, 2022
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 stdlib/xml/dom/minidom.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class CDATASection(Text):

class ReadOnlySequentialNamedNodeMap:
def __init__(self, seq=...) -> None: ...
def __len__(self): ...
def __len__(self) -> int: ...
def getNamedItem(self, name): ...
def getNamedItemNS(self, namespaceURI: str, localName): ...
def __getitem__(self, name_or_tuple): ...
Expand Down
2 changes: 1 addition & 1 deletion stdlib/xml/sax/xmlreader.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class AttributesImpl:
def getQNameByName(self, name): ...
def getNames(self): ...
def getQNames(self): ...
def __len__(self): ...
def __len__(self) -> int: ...
def __getitem__(self, name): ...
def keys(self): ...
def __contains__(self, name): ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/Pillow/PIL/ImageMath.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class _Operand:
im: Any
def __init__(self, im) -> None: ...
def apply(self, op, im1, im2: Any | None = ..., mode: Any | None = ...): ...
def __bool__(self): ...
def __bool__(self) -> bool: ...
def __abs__(self): ...
def __pos__(self): ...
def __neg__(self): ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/Pillow/PIL/ImageWin.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ from typing import Any
class HDC:
dc: Any
def __init__(self, dc) -> None: ...
def __int__(self): ...
def __int__(self) -> int: ...

class HWND:
wnd: Any
def __init__(self, wnd) -> None: ...
def __int__(self): ...
def __int__(self) -> int: ...

class Dib:
image: Any
Expand Down
14 changes: 7 additions & 7 deletions stubs/Pillow/PIL/PdfParser.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ class PdfFormatError(RuntimeError): ...
def check_format_condition(condition, error_message) -> None: ...

class IndirectReference:
def __bytes__(self): ...
def __bytes__(self) -> bytes: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def __hash__(self): ...
def __hash__(self) -> int: ...

class IndirectObjectDef(IndirectReference): ...

Expand All @@ -29,7 +29,7 @@ class XrefTable:
def __getitem__(self, key): ...
def __delitem__(self, key) -> None: ...
def __contains__(self, key): ...
def __len__(self): ...
def __len__(self) -> int: ...
def keys(self): ...
def write(self, f): ...

Expand All @@ -38,14 +38,14 @@ class PdfName:
def __init__(self, name) -> None: ...
def name_as_str(self): ...
def __eq__(self, other): ...
def __hash__(self): ...
def __hash__(self) -> int: ...
@classmethod
def from_pdf_stream(cls, data): ...
allowed_chars: Any
def __bytes__(self): ...
def __bytes__(self) -> bytes: ...

class PdfArray(list[Any]):
def __bytes__(self): ...
def __bytes__(self) -> bytes: ...

class PdfDict(collections.UserDict[bytes, Any]):
def __setattr__(self, key, value) -> None: ...
Expand All @@ -55,7 +55,7 @@ class PdfDict(collections.UserDict[bytes, Any]):
class PdfBinary:
data: Any
def __init__(self, data) -> None: ...
def __bytes__(self): ...
def __bytes__(self) -> bytes: ...

class PdfStream:
dictionary: Any
Expand Down
2 changes: 1 addition & 1 deletion stubs/Pillow/PIL/PyAccess.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class PyAccess:
image32: Any
image: Any
def __init__(self, img, readonly: bool = ...) -> None: ...
def __setitem__(self, xy, color): ...
def __setitem__(self, xy, color) -> None: ...
def __getitem__(self, xy): ...
putpixel: Any
getpixel: Any
Expand Down
4 changes: 2 additions & 2 deletions stubs/Pillow/PIL/TiffImagePlugin.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class IFDRational(Rational):
@property
def denominator(a): ...
def limit_rational(self, max_denominator): ...
def __hash__(self): ...
def __hash__(self) -> int: ...
def __eq__(self, other): ...
__add__: Any
__radd__: Any
Expand Down Expand Up @@ -131,7 +131,7 @@ class ImageFileDirectory_v1(ImageFileDirectory_v2):
def from_v2(cls, original): ...
def to_v2(self): ...
def __contains__(self, tag): ...
def __len__(self): ...
def __len__(self) -> int: ...
def __iter__(self): ...
def __setitem__(self, tag, value) -> None: ...
def __getitem__(self, tag): ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/SQLAlchemy/sqlalchemy/cresultproxy.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ class BaseRow:
def __init__(self, parent, processors, keymap, key_style, data) -> None: ...
def __reduce__(self): ...
def __iter__(self): ...
def __len__(self): ...
def __hash__(self): ...
def __len__(self) -> int: ...
def __hash__(self) -> int: ...
__getitem__: Any

def safe_rowproxy_reconstructor(__cls, __state): ...
2 changes: 1 addition & 1 deletion stubs/SQLAlchemy/sqlalchemy/engine/result.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ResultMetaData:

class RMKeyView(KeysView[Any]):
def __init__(self, parent) -> None: ...
def __len__(self): ...
def __len__(self) -> int: ...
def __iter__(self): ...
def __contains__(self, item): ...
def __eq__(self, other): ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/SQLAlchemy/sqlalchemy/engine/row.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ RowProxy = Row

class ROMappingView(KeysView[Any], ValuesView[Any], ItemsView[Any, Any]):
def __init__(self, mapping, items) -> None: ...
def __len__(self): ...
def __len__(self) -> int: ...
def __iter__(self): ...
def __contains__(self, item): ...
def __eq__(self, other): ...
Expand All @@ -50,7 +50,7 @@ class ROMappingView(KeysView[Any], ValuesView[Any], ItemsView[Any, Any]):
class RowMapping(BaseRow, Mapping[Any, Any]):
__getitem__: Any
def __iter__(self): ...
def __len__(self): ...
def __len__(self) -> int: ...
def __contains__(self, key): ...
def items(self): ...
def keys(self): ...
Expand Down
8 changes: 4 additions & 4 deletions stubs/SQLAlchemy/sqlalchemy/event/attr.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ class _EmptyListener(_InstanceLevelDispatch):
remove: Any
clear: Any
def __call__(self, *args, **kw) -> None: ...
def __len__(self): ...
def __len__(self) -> int: ...
def __iter__(self): ...
def __bool__(self): ...
def __bool__(self) -> bool: ...
__nonzero__: Any

class _CompoundListener(_InstanceLevelDispatch):
def exec_once(self, *args, **kw) -> None: ...
def exec_once_unless_exception(self, *args, **kw) -> None: ...
def __call__(self, *args, **kw) -> None: ...
def __len__(self): ...
def __len__(self) -> int: ...
def __iter__(self): ...
def __bool__(self): ...
def __bool__(self) -> bool: ...
__nonzero__: Any

class _ListenerCollection(_CompoundListener):
Expand Down
18 changes: 9 additions & 9 deletions stubs/SQLAlchemy/sqlalchemy/ext/associationproxy.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class AssociationProxy(interfaces.InspectionAttrInfo):
cascade_scalar_deletes: bool = ...,
) -> None: ...
def __get__(self, obj, class_): ...
def __set__(self, obj, values): ...
def __delete__(self, obj): ...
def __set__(self, obj, values) -> None: ...
def __delete__(self, obj) -> None: ...
def for_class(self, class_, obj: Any | None = ...): ...

class AssociationProxyInstance:
Expand Down Expand Up @@ -95,8 +95,8 @@ class _AssociationCollection:
def __init__(self, lazy_collection, creator, getter, setter, parent) -> None: ...
@property
def col(self): ...
def __len__(self): ...
def __bool__(self): ...
def __len__(self) -> int: ...
def __bool__(self) -> bool: ...
__nonzero__: Any

class _AssociationList(_AssociationCollection):
Expand Down Expand Up @@ -132,7 +132,7 @@ class _AssociationList(_AssociationCollection):
def __imul__(self, n): ...
def index(self, item, *args): ...
def copy(self): ...
def __hash__(self): ...
def __hash__(self) -> int: ...

class _AssociationDict(_AssociationCollection):
def __getitem__(self, key): ...
Expand All @@ -158,11 +158,11 @@ class _AssociationDict(_AssociationCollection):
def popitem(self): ...
def update(self, *a, **kw) -> None: ...
def copy(self): ...
def __hash__(self): ...
def __hash__(self) -> int: ...

class _AssociationSet(_AssociationCollection):
def __len__(self): ...
def __bool__(self): ...
def __len__(self) -> int: ...
def __bool__(self) -> bool: ...
__nonzero__: Any
def __contains__(self, value): ...
def __iter__(self): ...
Expand Down Expand Up @@ -196,4 +196,4 @@ class _AssociationSet(_AssociationCollection):
def __le__(self, other): ...
def __gt__(self, other): ...
def __ge__(self, other): ...
def __hash__(self): ...
def __hash__(self) -> int: ...
2 changes: 1 addition & 1 deletion stubs/SQLAlchemy/sqlalchemy/ext/asyncio/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ class StartableContext(abc.ABC, metaclass=abc.ABCMeta):
async def __aexit__(self, type_, value, traceback): ...

class ProxyComparable(ReversibleProxy):
def __hash__(self): ...
def __hash__(self) -> int: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
2 changes: 1 addition & 1 deletion stubs/SQLAlchemy/sqlalchemy/orm/attributes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class CollectionAttributeImpl(AttributeImpl):
def backref_listeners(attribute, key, uselist): ...

class History:
def __bool__(self): ...
def __bool__(self) -> bool: ...
__nonzero__: Any
def empty(self): ...
def sum(self): ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/SQLAlchemy/sqlalchemy/orm/collections.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class CollectionAdapter:
def clear_with_event(self, initiator: Any | None = ...) -> None: ...
def clear_without_event(self) -> None: ...
def __iter__(self): ...
def __len__(self): ...
def __bool__(self): ...
def __len__(self) -> int: ...
def __bool__(self) -> bool: ...
__nonzero__: Any
def fire_append_wo_mutation_event(self, item, initiator: Any | None = ...): ...
def fire_append_event(self, item, initiator: Any | None = ...): ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/SQLAlchemy/sqlalchemy/orm/dynamic.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class DynamicCollectionAdapter:
data: Any
def __init__(self, data) -> None: ...
def __iter__(self): ...
def __len__(self): ...
def __bool__(self): ...
def __len__(self) -> int: ...
def __bool__(self) -> bool: ...
__nonzero__: Any

class AppenderMixin:
Expand Down
2 changes: 1 addition & 1 deletion stubs/SQLAlchemy/sqlalchemy/orm/identity.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class IdentityMap:
def popitem(self) -> None: ...
def pop(self, key, *args) -> None: ...
def setdefault(self, key, default: Any | None = ...) -> None: ...
def __len__(self): ...
def __len__(self) -> int: ...
def copy(self) -> None: ...
def __setitem__(self, key, value) -> None: ...
def __delitem__(self, key) -> None: ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/SQLAlchemy/sqlalchemy/orm/instrumentation.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ClassManager(HasMemoized, dict[Any, Any]):
local_attrs: Any
originals: Any
def __init__(self, class_) -> None: ...
def __hash__(self): ...
def __hash__(self) -> int: ... # type: ignore[override]
def __eq__(self, other): ...
@property
def is_mapped(self): ...
Expand Down Expand Up @@ -57,7 +57,7 @@ class ClassManager(HasMemoized, dict[Any, Any]):
def teardown_instance(self, instance) -> None: ...
def has_state(self, instance): ...
def has_parent(self, state, key, optimistic: bool = ...): ...
def __bool__(self): ...
def __bool__(self) -> bool: ...
__nonzero__: Any

class _SerializeManager:
Expand Down
6 changes: 3 additions & 3 deletions stubs/SQLAlchemy/sqlalchemy/orm/path_registry.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class PathRegistry(HasCacheKey):
def set(self, attributes, key, value) -> None: ...
def setdefault(self, attributes, key, value) -> None: ...
def get(self, attributes, key, value: Any | None = ...): ...
def __len__(self): ...
def __hash__(self): ...
def __len__(self) -> int: ...
def __hash__(self) -> int: ...
@property
def length(self): ...
def pairs(self) -> None: ...
Expand Down Expand Up @@ -93,7 +93,7 @@ class AbstractEntityRegistry(PathRegistry):
def entity_path(self): ...
@property
def mapper(self): ...
def __bool__(self): ...
def __bool__(self) -> bool: ...
__nonzero__: Any
def __getitem__(self, entity): ...

Expand Down
2 changes: 1 addition & 1 deletion stubs/SQLAlchemy/sqlalchemy/sql/annotation.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Annotated:
__dict__: Any
def __init__(self, element, values) -> None: ...
def __reduce__(self): ...
def __hash__(self): ...
def __hash__(self) -> int: ...
def __eq__(self, other): ...
@property
def entity_namespace(self): ...
Expand Down
10 changes: 5 additions & 5 deletions stubs/SQLAlchemy/sqlalchemy/sql/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ class _DialectArgView(MutableMapping[Any, Any]):
def __getitem__(self, key): ...
def __setitem__(self, key, value) -> None: ...
def __delitem__(self, key) -> None: ...
def __len__(self): ...
def __len__(self) -> int: ...
def __iter__(self): ...

class _DialectArgDict(MutableMapping[Any, Any]):
def __init__(self) -> None: ...
def __len__(self): ...
def __len__(self) -> int: ...
def __iter__(self): ...
def __getitem__(self, key): ...
def __setitem__(self, key, value) -> None: ...
Expand Down Expand Up @@ -119,8 +119,8 @@ class ColumnCollection:
def keys(self): ...
def values(self): ...
def items(self): ...
def __bool__(self): ...
def __len__(self): ...
def __bool__(self) -> bool: ...
def __len__(self) -> int: ...
def __iter__(self): ...
def __getitem__(self, key): ...
def __getattr__(self, key): ...
Expand Down Expand Up @@ -157,4 +157,4 @@ class ColumnSet(util.ordered_column_set[ColumnElement[Any]]):
def extend(self, cols) -> None: ...
def __add__(self, other): ...
def __eq__(self, other): ...
def __hash__(self): ...
def __hash__(self) -> int: ... # type: ignore[override]
2 changes: 1 addition & 1 deletion stubs/SQLAlchemy/sqlalchemy/sql/elements.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class ClauseList(roles.InElementRole, roles.OrderByRole, roles.ColumnsClauseRole
clauses: Any
def __init__(self, *clauses, **kwargs) -> None: ...
def __iter__(self): ...
def __len__(self): ...
def __len__(self) -> int: ...
def append(self, clause) -> None: ...
def self_group(self, against: Any | None = ...): ...

Expand Down
2 changes: 1 addition & 1 deletion stubs/SQLAlchemy/sqlalchemy/sql/lambdas.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class PyWrapper(ColumnOperators[_T], Generic[_T]):
def operate(self, op, *other, **kwargs): ...
def reverse_operate(self, op, other, **kwargs): ...
def __clause_element__(self): ...
def __bool__(self): ...
def __bool__(self) -> bool: ...
def __nonzero__(self): ...
def __getattribute__(self, key): ...
def __iter__(self): ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/SQLAlchemy/sqlalchemy/sql/schema.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class ColumnCollectionConstraint(ColumnCollectionMixin, Constraint):
def copy(self, target_table: Any | None = ..., **kw): ...
def contains_column(self, col): ...
def __iter__(self): ...
def __len__(self): ...
def __len__(self) -> int: ...

class CheckConstraint(ColumnCollectionConstraint):
__visit_name__: str
Expand Down Expand Up @@ -318,7 +318,7 @@ class MetaData(SchemaItem):
naming_convention: Any | None = ...,
info: Any | None = ...,
) -> None: ...
def __contains__(self, table_or_key): ...
def __contains__(self, table_or_key) -> bool: ...
def is_bound(self): ...
bind: Any
def clear(self) -> None: ...
Expand Down
Loading