Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
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.0.0"
version = "4.0.1"
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
29 changes: 24 additions & 5 deletions stubs/peewee/peewee.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from collections.abc import Callable, Generator, Iterable, Iterator
from datetime import datetime
from decimal import Decimal
from types import TracebackType
from typing import Any, ClassVar, Final, Literal, NamedTuple, TypeVar
from typing import Any, ClassVar, Final, Literal, NamedTuple, TypeVar, overload
from typing_extensions import Self
from uuid import UUID

Expand All @@ -20,6 +20,7 @@ basestring = str
long = int
izip_longest = itertools.zip_longest

_T = TypeVar("_T")
_VT = TypeVar("_VT")
_F = TypeVar("_F", bound=Callable[..., Any])

Expand Down Expand Up @@ -400,6 +401,7 @@ class SQL(ColumnBase):
def __sql__(self, ctx): ...

def Check(constraint, name=None): ...
def Default(value) -> SQL: ...

class Function(ColumnBase):
no_coerce_functions: ClassVar[set[str]]
Expand Down Expand Up @@ -849,7 +851,9 @@ class SqliteDatabase(Database):
server_version: Incomplete
truncate_table: bool
nulls_ordering: bool
def __init__(self, database, regexp_function: bool = False, *args, **kwargs) -> None: ...
def __init__(
self, database, pragmas=None, regexp_function: bool = False, rank_functions: bool = False, *args, **kwargs
) -> None: ...
returning_clause: Incomplete
def init(self, database, pragmas=None, timeout: int = 5, returning_clause=None, **kwargs) -> None: ...
def pragma(self, key, value=..., permanent: bool = False, schema: str | None = None): ...
Expand Down Expand Up @@ -902,7 +906,20 @@ class SqliteDatabase(Database):
def to_timestamp(self, date_field) -> Cast: ...
def from_timestamp(self, date_field) -> Function: ...

class Psycopg2Adapter:
class _BasePsycopgAdapter:
isolation_levels: dict[int, str]
isolation_levels_inv: dict[str, int]
def __init__(self) -> None: ...
@overload
def isolation_level_int(self, isolation_level: str) -> int: ...
@overload
def isolation_level_int(self, isolation_level: _T) -> _T: ...
@overload
def isolation_level_str(self, isolation_level: int) -> str: ...
@overload
def isolation_level_str(self, isolation_level: _T) -> _T: ...

class Psycopg2Adapter(_BasePsycopgAdapter):
json_type: Incomplete
jsonb_type: Incomplete
cast_json_case: bool
Expand All @@ -916,7 +933,7 @@ class Psycopg2Adapter:
def is_connection_closed(self, conn) -> bool: ...
def extract_date(self, date_part, date_field) -> Function: ...

class Psycopg3Adapter:
class Psycopg3Adapter(_BasePsycopgAdapter):
json_type: Incomplete
jsonb_type: Incomplete
cast_json_case: bool
Expand Down Expand Up @@ -973,6 +990,7 @@ class PostgresqlDatabase(Database):
def from_timestamp(self, date_field) -> Function: ...
def get_noop_select(self, ctx): ...
def set_time_zone(self, timezone) -> None: ...
def set_isolation_level(self, isolation_level: int | str) -> None: ...

class MySQLDatabase(Database):
field_types: Incomplete
Expand Down Expand Up @@ -1037,7 +1055,7 @@ class _savepoint(_callable_context_manager):
quoted_sid: Incomplete
def __init__(self, db, sid=None) -> None: ...
def commit(self, begin: bool = True) -> None: ...
def rollback(self) -> None: ...
def rollback(self, begin: bool = True) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
Expand Down Expand Up @@ -1854,6 +1872,7 @@ __all__ = [
"DateField",
"DateTimeField",
"DecimalField",
"Default",
"DeferredForeignKey",
"DeferredThroughModel",
"DJANGO_MAP",
Expand Down