mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-04 12:35:49 +08:00
Add missing __slots__ to third-party packages (#15454)
This commit is contained in:
@@ -271,6 +271,7 @@ class RingBuffer:
|
||||
def size(self) -> int: ...
|
||||
|
||||
class Status:
|
||||
__slots__ = "_code"
|
||||
def __init__(self, code: int) -> None: ...
|
||||
@property
|
||||
def failure(self) -> bool: ...
|
||||
@@ -300,6 +301,7 @@ class Status:
|
||||
def client_zombie(self) -> bool: ...
|
||||
|
||||
class TransportState:
|
||||
__slots__ = "_code"
|
||||
def __init__(self, code: int) -> None: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
@@ -63,11 +63,15 @@ _AcceptLanguageProperty: TypeAlias = AsymmetricPropertyWithDelete[
|
||||
),
|
||||
]
|
||||
|
||||
class AcceptOffer(NamedTuple):
|
||||
@type_check_only
|
||||
class _AcceptOffer(NamedTuple):
|
||||
type: str
|
||||
subtype: str
|
||||
params: tuple[tuple[str, str], ...]
|
||||
|
||||
class AcceptOffer(_AcceptOffer):
|
||||
__slots__ = ()
|
||||
|
||||
class Accept:
|
||||
@classmethod
|
||||
def parse(cls, value: str) -> Iterator[_ParsedAccept]: ...
|
||||
|
||||
@@ -15,6 +15,7 @@ class _VersionInfo(NamedTuple):
|
||||
release: bool
|
||||
|
||||
class VersionInfo(_VersionInfo):
|
||||
__slots__ = ()
|
||||
def __new__(
|
||||
cls, major: int = 0, minor: int = 0, micro: int = 0, releaselevel: str = "final", serial: int = 0, release: bool = True
|
||||
) -> Self: ...
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
from _typeshed import Incomplete
|
||||
|
||||
class Options:
|
||||
__slots__ = (
|
||||
"retries",
|
||||
"timeout",
|
||||
"use_cache",
|
||||
"use_global_cache",
|
||||
"global_cache_timeout",
|
||||
"use_datastore",
|
||||
"force_writes",
|
||||
"max_memcache_items",
|
||||
"propagation",
|
||||
"deadline",
|
||||
"use_memcache",
|
||||
"memcache_timeout",
|
||||
)
|
||||
@classmethod
|
||||
def options(cls, wrapped, _disambiguate_from_model_properties: bool = ...): ...
|
||||
@classmethod
|
||||
@@ -12,4 +26,5 @@ class Options:
|
||||
def items(self) -> None: ...
|
||||
|
||||
class ReadOptions(Options):
|
||||
__slots__ = ("read_consistency", "read_policy", "transaction")
|
||||
def __init__(self, config: Incomplete | None = ..., **kwargs) -> None: ...
|
||||
|
||||
@@ -137,6 +137,7 @@ class BlobProperty(Property):
|
||||
def __get__(self, entity: Model, unused_cls: type[Model] | None = ...) -> bytes | list[bytes] | None: ...
|
||||
|
||||
class CompressedTextProperty(BlobProperty):
|
||||
__slots__ = ()
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
|
||||
class TextProperty(Property):
|
||||
|
||||
@@ -88,6 +88,25 @@ AND = ConjunctionNode
|
||||
OR = DisjunctionNode
|
||||
|
||||
class QueryOptions(_options.ReadOptions):
|
||||
__slots__ = (
|
||||
"kind",
|
||||
"ancestor",
|
||||
"filters",
|
||||
"order_by",
|
||||
"orders",
|
||||
"distinct_on",
|
||||
"group_by",
|
||||
"namespace",
|
||||
"project",
|
||||
"database",
|
||||
"keys_only",
|
||||
"limit",
|
||||
"offset",
|
||||
"start_cursor",
|
||||
"end_cursor",
|
||||
"projection",
|
||||
"callback",
|
||||
)
|
||||
project: Incomplete
|
||||
namespace: Incomplete
|
||||
database: str | None
|
||||
|
||||
@@ -81,6 +81,7 @@ def unescape_list_or_string(val: list[str]) -> list[str]: ...
|
||||
def unescape_list_or_string(val: str) -> str: ...
|
||||
|
||||
class Contentline(str):
|
||||
__slots__ = ("strict",)
|
||||
strict: bool
|
||||
def __new__(cls, value: str | bytes, strict: bool = False, encoding: str = "utf-8") -> Self: ...
|
||||
@classmethod
|
||||
|
||||
@@ -72,6 +72,7 @@ class vBoolean(int):
|
||||
def from_ical(cls, ical: ICAL_TYPE) -> bool: ...
|
||||
|
||||
class vText(str):
|
||||
__slots__ = ("encoding", "params")
|
||||
encoding: str
|
||||
params: Parameters
|
||||
def __new__(cls, value: ICAL_TYPE, encoding: str = "utf-8", params: SupportsKeysAndGetItem[str, str] = {}) -> Self: ...
|
||||
@@ -83,6 +84,7 @@ class vText(str):
|
||||
RELTYPE: property
|
||||
|
||||
class vCalAddress(str):
|
||||
__slots__ = ("params",)
|
||||
params: Parameters
|
||||
def __new__(cls, value: ICAL_TYPE, encoding: str = "utf-8", params: SupportsKeysAndGetItem[str, str] = {}) -> Self: ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@@ -213,6 +215,7 @@ class vPeriod(TimeBase):
|
||||
FBTYPE: property
|
||||
|
||||
class vWeekday(str):
|
||||
__slots__ = ("params", "relative", "weekday")
|
||||
week_days: Final[CaselessDict[int]]
|
||||
weekday: Literal["SU", "MO", "TU", "WE", "TH", "FR", "SA"] | None
|
||||
relative: int | None
|
||||
@@ -223,6 +226,7 @@ class vWeekday(str):
|
||||
def from_ical(cls, ical: ICAL_TYPE) -> Self: ...
|
||||
|
||||
class vFrequency(str):
|
||||
__slots__ = ("params",)
|
||||
frequencies: Final[CaselessDict[str]]
|
||||
params: Parameters
|
||||
def __new__(cls, value: ICAL_TYPE, encoding: str = "utf-8", params: SupportsKeysAndGetItem[str, str] = {}) -> Self: ...
|
||||
@@ -285,6 +289,7 @@ class vTime(TimeBase):
|
||||
def from_ical(ical: ICAL_TYPE) -> datetime.time: ...
|
||||
|
||||
class vUri(str):
|
||||
__slots__ = ("params",)
|
||||
params: Parameters
|
||||
def __new__(cls, value: ICAL_TYPE, encoding: str = "utf-8", params: SupportsKeysAndGetItem[str, str] = {}) -> Self: ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@@ -313,6 +318,7 @@ class vUTCOffset:
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
class vInline(str):
|
||||
__slots__ = ("params",)
|
||||
params: Parameters
|
||||
def __new__(cls, value: ICAL_TYPE, encoding: str = "utf-8", params: SupportsKeysAndGetItem[str, str] = {}) -> Self: ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
|
||||
@@ -21,7 +21,8 @@ class PGSchema(dbschema.DBSchema):
|
||||
class PGTranslator(SQLTranslator):
|
||||
dialect: ClassVar[str]
|
||||
|
||||
class PGValue(Value): ...
|
||||
class PGValue(Value):
|
||||
__slots__: list[str] = []
|
||||
|
||||
class PGSQLBuilder(SQLBuilder):
|
||||
dialect: ClassVar[str]
|
||||
|
||||
@@ -8,6 +8,7 @@ from psycopg2._psycopg import _type, connection, cursor
|
||||
_T_co = TypeVar("_T_co", covariant=True)
|
||||
|
||||
class Range(Generic[_T_co]):
|
||||
__slots__ = ("_lower", "_upper", "_bounds")
|
||||
def __init__(
|
||||
self, lower: _T_co | None = None, upper: _T_co | None = None, bounds: str = "[)", empty: bool = False
|
||||
) -> None: ...
|
||||
|
||||
@@ -71,6 +71,7 @@ class DictCursor(DictCursorBase):
|
||||
def __next__(self) -> DictRow: ... # type: ignore[override]
|
||||
|
||||
class DictRow(list[Any]):
|
||||
__slots__ = ("_index",)
|
||||
def __init__(self, cursor) -> None: ...
|
||||
def __getitem__(self, x): ...
|
||||
def __setitem__(self, x, v) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user