Improve several __hash__ methods (#8128)

This commit is contained in:
Alex Waygood
2022-06-22 11:58:00 +01:00
committed by GitHub
parent 9eed3275c3
commit 89f4dee452
9 changed files with 26 additions and 25 deletions

View File

@@ -19,7 +19,7 @@ class Row(BaseRow, Sequence[Any], metaclass=abc.ABCMeta):
@property
def index(self): ...
def __contains__(self, key): ...
__hash__: Any
__hash__ = BaseRow.__hash__
def __lt__(self, other): ...
def __le__(self, other): ...
def __ge__(self, other): ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Generic, TypeVar
from typing import Any, ClassVar, Generic, TypeVar
from ..sql.operators import ColumnOperators
from ..util import memoized_property
@@ -37,7 +37,7 @@ class CompositeProperty(DescriptorProperty):
def create_row_processor(self, query, procs, labels): ...
class Comparator(PropComparator[_T], Generic[_T]):
__hash__: Any
__hash__: ClassVar[None] # type: ignore[assignment]
@memoized_property
def clauses(self): ...
def __clause_element__(self): ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Generic, TypeVar
from typing import Any, ClassVar, Generic, TypeVar
from ..sql.operators import ColumnOperators
from ..util import memoized_property
@@ -101,7 +101,7 @@ class RelationshipProperty(StrategizedProperty):
def of_type(self, cls): ...
def and_(self, *other): ...
def in_(self, other) -> ColumnOperators[_T]: ...
__hash__: Any
__hash__: ClassVar[None] # type: ignore[assignment]
def __eq__(self, other): ...
def any(self, criterion: Any | None = ..., **kwargs): ...
def has(self, criterion: Any | None = ..., **kwargs): ...

View File

@@ -1,6 +1,6 @@
from _typeshed import Self
from collections.abc import MutableMapping
from typing import Any
from typing import Any, ClassVar
from .. import util
from ..util import HasMemoized, hybridmethod, memoized_property
@@ -133,7 +133,7 @@ class ColumnCollection:
def clear(self) -> None: ...
def remove(self, column) -> None: ...
def update(self, iter_) -> None: ...
__hash__: Any
__hash__: ClassVar[None] # type: ignore[assignment]
def add(self, column, key: Any | None = ...) -> None: ...
def contains_column(self, col): ...
def as_immutable(self): ...

View File

@@ -21,14 +21,14 @@ class Foo:
stuff: Any
moredata: Any
def __init__(self, moredata, stuff: str = ...) -> None: ...
__hash__: Any
__hash__ = object.__hash__
def __eq__(self, other): ...
class Bar:
x: Any
y: Any
def __init__(self, x, y) -> None: ...
__hash__: Any
__hash__ = object.__hash__
def __eq__(self, other): ...
class OldSchool: