Skip to content

Make peewee stubs compatible with peewee 3.15.4 #9176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions stdlib/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 17 additions & 8 deletions stubs/peewee/peewee.pyi
Original file line number Diff line number Diff line change
@@ -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: ...
Expand All @@ -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]: ...

Expand All @@ -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: ...

Expand Down Expand Up @@ -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: ...
Expand Down Expand Up @@ -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
Expand Down