mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-29 06:12:13 +08:00
Improve several __hash__ methods (#8128)
This commit is contained in:
@@ -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): ...
|
||||
|
||||
@@ -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): ...
|
||||
|
||||
@@ -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): ...
|
||||
|
||||
@@ -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): ...
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any
|
||||
from typing import Any, ClassVar
|
||||
|
||||
def load_source(name: str, path: str) -> dict[str, Any]: ...
|
||||
|
||||
@@ -9,7 +9,7 @@ class DataProxy:
|
||||
def __setattr__(self, key, value) -> None: ...
|
||||
def __iter__(self): ...
|
||||
def __eq__(self, other): ...
|
||||
__hash__: Any
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __len__(self): ...
|
||||
def __setitem__(self, key, value) -> None: ...
|
||||
def __getitem__(self, key): ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from datetime import datetime, timedelta, tzinfo
|
||||
from typing import Any
|
||||
from typing import ClassVar
|
||||
|
||||
def tzname_in_python2(namefunc): ...
|
||||
def enfold(dt: datetime, fold: int = ...): ...
|
||||
@@ -19,6 +19,6 @@ class tzrangebase(_tzinfo):
|
||||
def tzname(self, dt: datetime | None) -> str: ...
|
||||
def fromutc(self, dt: datetime) -> datetime: ...
|
||||
def is_ambiguous(self, dt: datetime) -> bool: ...
|
||||
__hash__: Any
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __ne__(self, other): ...
|
||||
__reduce__: Any
|
||||
__reduce__ = object.__reduce__
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import datetime
|
||||
from typing import Any, Protocol, TypeVar
|
||||
from typing import Any, ClassVar, Protocol, TypeVar
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ..relativedelta import relativedelta
|
||||
@@ -18,9 +18,9 @@ class tzutc(datetime.tzinfo):
|
||||
def is_ambiguous(self, dt: datetime.datetime | None) -> bool: ...
|
||||
def fromutc(self, dt: _DT) -> _DT: ...
|
||||
def __eq__(self, other): ...
|
||||
__hash__: Any
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __ne__(self, other): ...
|
||||
__reduce__: Any
|
||||
__reduce__ = object.__reduce__
|
||||
|
||||
class tzoffset(datetime.tzinfo):
|
||||
def __init__(self, name, offset) -> None: ...
|
||||
@@ -30,9 +30,9 @@ class tzoffset(datetime.tzinfo):
|
||||
def tzname(self, dt: datetime.datetime | None) -> str: ...
|
||||
def fromutc(self, dt: _DT) -> _DT: ...
|
||||
def __eq__(self, other): ...
|
||||
__hash__: Any
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __ne__(self, other): ...
|
||||
__reduce__: Any
|
||||
__reduce__ = object.__reduce__
|
||||
@classmethod
|
||||
def instance(cls, name, offset) -> tzoffset: ...
|
||||
|
||||
@@ -43,14 +43,14 @@ class tzlocal(_tzinfo):
|
||||
def tzname(self, dt: datetime.datetime | None) -> str: ...
|
||||
def is_ambiguous(self, dt: datetime.datetime | None) -> bool: ...
|
||||
def __eq__(self, other): ...
|
||||
__hash__: Any
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __ne__(self, other): ...
|
||||
__reduce__: Any
|
||||
__reduce__ = object.__reduce__
|
||||
|
||||
class _ttinfo:
|
||||
def __init__(self) -> None: ...
|
||||
def __eq__(self, other): ...
|
||||
__hash__: Any
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __ne__(self, other): ...
|
||||
|
||||
class _TZFileReader(Protocol):
|
||||
@@ -66,7 +66,7 @@ class tzfile(_tzinfo):
|
||||
def dst(self, dt: datetime.datetime | None) -> datetime.timedelta | None: ...
|
||||
def tzname(self, dt: datetime.datetime | None) -> str: ...
|
||||
def __eq__(self, other): ...
|
||||
__hash__: Any
|
||||
__hash__: ClassVar[None] # type: ignore[assignment]
|
||||
def __ne__(self, other): ...
|
||||
def __reduce__(self): ...
|
||||
def __reduce_ex__(self, protocol): ...
|
||||
|
||||
Reference in New Issue
Block a user