Skip to content

Commit 2bcfd7c

Browse files
committed
[peewee] Model.select() type contains the model being selected
1 parent 3c62217 commit 2bcfd7c

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

stubs/peewee/peewee.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from collections.abc import Callable, Generator, Iterable, Iterator
55
from datetime import datetime
66
from decimal import Decimal
77
from types import TracebackType
8-
from typing import Any, ClassVar, Final, Literal, NamedTuple, NoReturn, TypeVar, overload, type_check_only
8+
from typing import Any, ClassVar, Final, Literal, Generic, NamedTuple, NoReturn, TypeVar, overload, type_check_only
99
from typing_extensions import Self, TypeIs
1010
from uuid import UUID
1111

@@ -1660,7 +1660,7 @@ class Model(metaclass=ModelBase):
16601660
@classmethod
16611661
def alias(cls, alias=None) -> ModelAlias: ...
16621662
@classmethod
1663-
def select(cls, *fields) -> ModelSelect: ...
1663+
def select(cls: type[_TModel], *fields) -> ModelSelect[_TModel]: ...
16641664
@classmethod
16651665
def update(cls, data=None, /, **update) -> ModelUpdate: ...
16661666
@classmethod
@@ -1782,11 +1782,11 @@ class ModelCompoundSelectQuery(BaseModelSelect, CompoundSelectQuery): # type: i
17821782
model: Incomplete
17831783
def __init__(self, model, *args, **kwargs) -> None: ...
17841784

1785-
class ModelSelect(BaseModelSelect, Select): # type: ignore[misc]
1786-
model: Incomplete
1785+
class ModelSelect(BaseModelSelect, Select, Generic[_TModel]): # type: ignore[misc]
1786+
model: _TModel
17871787
def __init__(self, model, fields_or_models, is_default: bool = False) -> None: ...
17881788
def clone(self) -> Self: ...
1789-
def select(self, *fields_or_models): ...
1789+
def select(self, *fields_or_models) -> ModelSelect[_TModel]: ...
17901790
def select_extend(self, *columns): ...
17911791
def switch(self, ctx=None) -> Self: ...
17921792
def join(self, dest, join_type="INNER JOIN", on=None, src=None, attr=None) -> Self: ... # type: ignore[override]

0 commit comments

Comments
 (0)