diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index c9cfe3043..cc27ae7db 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -618,6 +618,8 @@ class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]): # -- os._Environ.__ior__ # -- collections.UserDict.__ior__ # -- collections.ChainMap.__ior__ + # -- peewee.attrdict.__add__ + # -- peewee.attrdict.__iadd__ # -- weakref.WeakValueDictionary.__ior__ # -- weakref.WeakKeyDictionary.__ior__ @overload diff --git a/stubs/peewee/peewee.pyi b/stubs/peewee/peewee.pyi index fbd8d9566..da8e5f967 100644 --- a/stubs/peewee/peewee.pyi +++ b/stubs/peewee/peewee.pyi @@ -1,9 +1,9 @@ import itertools import logging import threading -from _typeshed import Incomplete -from collections.abc import Generator -from typing import NamedTuple +from _typeshed import Incomplete, Self, SupportsKeysAndGetItem +from collections.abc import Generator, Iterable +from typing import ClassVar, NamedTuple, TypeVar class NullHandler(logging.Handler): def emit(self, record) -> None: ... @@ -15,15 +15,19 @@ basestring = str long = int izip_longest = itertools.zip_longest -class attrdict(dict[Incomplete, Incomplete]): - def __getattr__(self, attr): ... - def __setattr__(self, attr, value) -> None: ... - def __iadd__(self, rhs): ... - def __add__(self, rhs): ... +_VT = TypeVar("_VT") + +class attrdict(dict[str, _VT]): + def __getattr__(self, attr: str) -> _VT: ... + def __setattr__(self, attr: str, value: _VT) -> None: ... + # calls dict.update() + def __iadd__(self: Self, rhs: SupportsKeysAndGetItem[str, _VT] | Iterable[tuple[str, _VT]]) -> Self: ... + def __add__(self, rhs: SupportsKeysAndGetItem[str, _VT] | Iterable[tuple[str, _VT]]) -> attrdict[_VT]: ... OP: Incomplete DJANGO_MAP: Incomplete JOIN: Incomplete +PREFETCH_TYPE: attrdict[int] def chunked(it, n) -> Generator[Incomplete, None, None]: ... @@ -47,6 +51,8 @@ class DatabaseProxy(Proxy): def manual_commit(self): ... def transaction(self, *args, **kwargs): ... def savepoint(self): ... + @property + def Model(self) -> type[Model]: ... class ModelDescriptor: ... @@ -369,6 +375,7 @@ class SQL(ColumnBase): def Check(constraint, name: Incomplete | None = ...): ... class Function(ColumnBase): + no_coerce_functions: ClassVar[set[str]] name: Incomplete arguments: Incomplete def __init__(self, name, arguments, coerce: bool = ..., python_value: Incomplete | None = ...) -> None: ... @@ -820,6 +827,8 @@ class Database(_callable_context_manager): def bind(self, models, bind_refs: bool = ..., bind_backrefs: bool = ...) -> None: ... def bind_ctx(self, models, bind_refs: bool = ..., bind_backrefs: bool = ...): ... def get_noop_select(self, ctx): ... + @property + def Model(self) -> type[Model]: ... class SqliteDatabase(Database): field_types: Incomplete