mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-09 03:01:25 +08:00
Improve __enter__ & constructor methods (#7114)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import abc
|
||||
from _typeshed import Self
|
||||
from typing import Any
|
||||
|
||||
ConnectionError: Any
|
||||
@@ -37,7 +38,7 @@ class _InProcessGlobalCache(GlobalCache):
|
||||
class RedisCache(GlobalCache):
|
||||
transient_errors: Any
|
||||
@classmethod
|
||||
def from_environment(cls, strict_read: bool = ..., strict_write: bool = ...): ...
|
||||
def from_environment(cls: type[Self], strict_read: bool = ..., strict_write: bool = ...) -> Self: ...
|
||||
redis: Any
|
||||
strict_read: Any
|
||||
strict_write: Any
|
||||
@@ -59,7 +60,9 @@ class MemcacheCache(GlobalCache):
|
||||
def __eq__(self, other): ...
|
||||
transient_errors: Any
|
||||
@classmethod
|
||||
def from_environment(cls, max_pool_size: int = ..., strict_read: bool = ..., strict_write: bool = ...): ...
|
||||
def from_environment(
|
||||
cls: type[Self], max_pool_size: int = ..., strict_read: bool = ..., strict_write: bool = ...
|
||||
) -> Self: ...
|
||||
client: Any
|
||||
strict_read: Any
|
||||
strict_write: Any
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import datetime
|
||||
from _typeshed import Self
|
||||
from collections.abc import Iterable, Sequence
|
||||
from typing import Callable, NoReturn
|
||||
from typing_extensions import Literal
|
||||
@@ -26,7 +27,7 @@ class _NotEqualMixin:
|
||||
DirectionT = Literal["asc", "desc"]
|
||||
|
||||
class IndexProperty(_NotEqualMixin):
|
||||
def __new__(cls, name: str, direction: DirectionT) -> IndexProperty: ...
|
||||
def __new__(cls: type[Self], name: str, direction: DirectionT) -> Self: ...
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
@property
|
||||
@@ -35,7 +36,7 @@ class IndexProperty(_NotEqualMixin):
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
class Index(_NotEqualMixin):
|
||||
def __new__(cls, kind: str, properties: list[IndexProperty], ancestor: bool) -> Index: ...
|
||||
def __new__(cls: type[Self], kind: str, properties: list[IndexProperty], ancestor: bool) -> Self: ...
|
||||
@property
|
||||
def kind(self) -> str: ...
|
||||
@property
|
||||
@@ -57,7 +58,8 @@ class IndexState(_NotEqualMixin):
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
class ModelAdapter:
|
||||
def __new__(cls, *args, **kwargs) -> ModelAdapter: ...
|
||||
# This actually returns NoReturn, but mypy can't handle that
|
||||
def __new__(cls: type[Self], *args, **kwargs) -> Self: ...
|
||||
|
||||
def make_connection(*args, **kwargs) -> NoReturn: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user