Skip to content
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: 1 addition & 1 deletion stubs/peewee/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "4.2.6"
version = "4.3.0"
upstream-repository = "https://github.com/coleifer/peewee"
# We're not providing stubs for all playhouse modules right now
# https://github.com/python/typeshed/pull/11731#issuecomment-2065729058
Expand Down
18 changes: 12 additions & 6 deletions stubs/peewee/peewee.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ SCOPE_COLUMN: Final = 16
CSQ_PARENTHESES_NEVER: Final = 0
CSQ_PARENTHESES_ALWAYS: Final = 1
CSQ_PARENTHESES_UNNESTED: Final = 2
CSQ_PARENTHESES_GROUPED: Final = 3
CSQ_FLAT: Final = 0
CSQ_PARENS: Final = 1
CSQ_WRAP: Final = 2
SNAKE_CASE_STEP1: Final[re.Pattern[str]]
SNAKE_CASE_STEP2: Final[re.Pattern[str]]
IDENTIFIER_RE: Final[re.Pattern[str]]
Expand Down Expand Up @@ -946,7 +950,6 @@ class SqliteDatabase(Database):
def unload_extension(self, extension) -> None: ...
def attach(self, filename, name) -> bool: ...
def detach(self, name) -> bool: ...
def last_insert_id(self, cursor, query_type=None): ...
def begin(self, lock_type=None) -> None: ...
def get_tables(self, schema: str | None = None) -> list[str]: ...
def get_views(self, schema: str | None = None) -> list[ViewMetadata]: ...
Expand Down Expand Up @@ -1027,7 +1030,6 @@ class PostgresqlDatabase(Database):
**kwargs,
) -> None: ...
def is_connection_usable(self) -> bool: ...
def last_insert_id(self, cursor, query_type=None): ...
def begin(self, isolation_level: str | None = None) -> None: ...
def get_tables(self, schema: str | None = None) -> list[str]: ...
def get_views(self, schema: str | None = None) -> list[ViewMetadata]: ...
Expand Down Expand Up @@ -1228,7 +1230,8 @@ class Field(ColumnBase, Generic[_V]):
def adapt(self, value): ...
def db_value(self, value): ...
def python_value(self, value): ...
def to_value(self, value, case: bool = False) -> Value: ...
def to_value(self, value) -> Value: ...
def case_value(self, value) -> Value: ...
def get_sort_key(self, ctx) -> tuple[Incomplete, ...]: ...
def __sql__(self, ctx): ...
def get_modifiers(self) -> list[int] | None: ...
Expand Down Expand Up @@ -1597,8 +1600,10 @@ class ForeignKeyField(Field[_V]):
cls, model: type[_M], *args: Any, null: Literal[False] = ..., **kwargs: Unpack[_FKKwargs]
) -> ForeignKeyField[_M]: ...
@overload
# Untyped fallback: model given as a name/"self"/deferred ref, so the related type isn't known.
def __new__(cls, model: Any = ..., *args: Any, **kwargs: Unpack[_FKKwargs]) -> ForeignKeyField[Any]: ...
# Self-reference, the only string peewee accepts. Named refs use DeferredForeignKey.
def __new__(
cls, model: Literal["self"] = ..., *args: Any, null: bool = ..., **kwargs: Unpack[_FKKwargs]
) -> ForeignKeyField[Any]: ...

@property
def field_type(self): ... # type: ignore[override]
Expand All @@ -1616,7 +1621,8 @@ class ForeignKeyField(Field[_V]):
class DeferredForeignKey(Field):
field_kwargs: Incomplete
rel_model_name: Incomplete
def __init__(self, rel_model_name, **kwargs) -> None: ...
# Model named by string, so the related type isn't knowable and null can't refine it.
def __init__(self, rel_model_name: str, *, null: bool = ..., **kwargs: Unpack[_FKKwargs]) -> None: ...
__hash__ = object.__hash__
def __deepcopy__(self, memo=None) -> DeferredForeignKey: ...
def set_model(self, rel_model) -> None: ...
Expand Down