Skip to content

Commit e413b8b

Browse files
committed
[peewee] Update to 4.0.1
Closes: python#15478
1 parent 35004e9 commit e413b8b

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

stubs/peewee/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "4.0.0"
1+
version = "4.0.1"
22
upstream_repository = "https://github.com/coleifer/peewee"
33
# We're not providing stubs for all playhouse modules right now
44
# https://github.com/python/typeshed/pull/11731#issuecomment-2065729058

stubs/peewee/peewee.pyi

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ from collections.abc import Callable, Generator, Iterable, Iterator
66
from datetime import datetime
77
from decimal import Decimal
88
from types import TracebackType
9-
from typing import Any, ClassVar, Final, Literal, NamedTuple, TypeVar
9+
from typing import Any, ClassVar, Final, Literal, NamedTuple, TypeVar, overload
1010
from typing_extensions import Self
1111
from uuid import UUID
1212

@@ -20,6 +20,7 @@ basestring = str
2020
long = int
2121
izip_longest = itertools.zip_longest
2222

23+
_T = TypeVar("_T")
2324
_VT = TypeVar("_VT")
2425
_F = TypeVar("_F", bound=Callable[..., Any])
2526

@@ -400,6 +401,7 @@ class SQL(ColumnBase):
400401
def __sql__(self, ctx): ...
401402

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

404406
class Function(ColumnBase):
405407
no_coerce_functions: ClassVar[set[str]]
@@ -849,7 +851,9 @@ class SqliteDatabase(Database):
849851
server_version: Incomplete
850852
truncate_table: bool
851853
nulls_ordering: bool
852-
def __init__(self, database, regexp_function: bool = False, *args, **kwargs) -> None: ...
854+
def __init__(
855+
self, database, pragmas=None, regexp_function: bool = False, rank_functions: bool = False, *args, **kwargs
856+
) -> None: ...
853857
returning_clause: Incomplete
854858
def init(self, database, pragmas=None, timeout: int = 5, returning_clause=None, **kwargs) -> None: ...
855859
def pragma(self, key, value=..., permanent: bool = False, schema: str | None = None): ...
@@ -902,7 +906,20 @@ class SqliteDatabase(Database):
902906
def to_timestamp(self, date_field) -> Cast: ...
903907
def from_timestamp(self, date_field) -> Function: ...
904908

905-
class Psycopg2Adapter:
909+
class _BasePsycopgAdapter:
910+
isolation_levels: dict[int, str]
911+
isolation_levels_inv: dict[str, int]
912+
def __init__(self) -> None: ...
913+
@overload
914+
def isolation_level_int(self, isolation_level: str) -> int: ...
915+
@overload
916+
def isolation_level_int(self, isolation_level: _T) -> _T: ...
917+
@overload
918+
def isolation_level_str(self, isolation_level: int) -> str: ...
919+
@overload
920+
def isolation_level_str(self, isolation_level: _T) -> _T: ...
921+
922+
class Psycopg2Adapter(_BasePsycopgAdapter):
906923
json_type: Incomplete
907924
jsonb_type: Incomplete
908925
cast_json_case: bool
@@ -916,7 +933,7 @@ class Psycopg2Adapter:
916933
def is_connection_closed(self, conn) -> bool: ...
917934
def extract_date(self, date_part, date_field) -> Function: ...
918935

919-
class Psycopg3Adapter:
936+
class Psycopg3Adapter(_BasePsycopgAdapter):
920937
json_type: Incomplete
921938
jsonb_type: Incomplete
922939
cast_json_case: bool
@@ -973,6 +990,7 @@ class PostgresqlDatabase(Database):
973990
def from_timestamp(self, date_field) -> Function: ...
974991
def get_noop_select(self, ctx): ...
975992
def set_time_zone(self, timezone) -> None: ...
993+
def set_isolation_level(self, isolation_level: int | str) -> None: ...
976994

977995
class MySQLDatabase(Database):
978996
field_types: Incomplete
@@ -1037,7 +1055,7 @@ class _savepoint(_callable_context_manager):
10371055
quoted_sid: Incomplete
10381056
def __init__(self, db, sid=None) -> None: ...
10391057
def commit(self, begin: bool = True) -> None: ...
1040-
def rollback(self) -> None: ...
1058+
def rollback(self, begin: bool = True) -> None: ...
10411059
def __enter__(self) -> Self: ...
10421060
def __exit__(
10431061
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
@@ -1854,6 +1872,7 @@ __all__ = [
18541872
"DateField",
18551873
"DateTimeField",
18561874
"DecimalField",
1875+
"Default",
18571876
"DeferredForeignKey",
18581877
"DeferredThroughModel",
18591878
"DJANGO_MAP",

0 commit comments

Comments
 (0)