mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-08 22:36:18 +08:00
[sqlite3] Use TypeAlias for isolation_level (#14460)
This commit is contained in:
+15
-13
@@ -220,6 +220,8 @@ _SqliteData: TypeAlias = str | ReadableBuffer | int | float | None
|
||||
_AdaptedInputData: TypeAlias = _SqliteData | Any
|
||||
# The Mapping must really be a dict, but making it invariant is too annoying.
|
||||
_Parameters: TypeAlias = SupportsLenAndGetItem[_AdaptedInputData] | Mapping[str, _AdaptedInputData]
|
||||
# Controls the legacy transaction handling mode of sqlite3.
|
||||
_IsolationLevel: TypeAlias = Literal["DEFERRED", "EXCLUSIVE", "IMMEDIATE"] | None
|
||||
|
||||
class _AnyParamWindowAggregateClass(Protocol):
|
||||
def step(self, *args: Any) -> object: ...
|
||||
@@ -285,7 +287,7 @@ class Connection:
|
||||
def Warning(self) -> type[Warning]: ...
|
||||
@property
|
||||
def in_transaction(self) -> bool: ...
|
||||
isolation_level: str | None # one of '', 'DEFERRED', 'IMMEDIATE' or 'EXCLUSIVE'
|
||||
isolation_level: _IsolationLevel
|
||||
@property
|
||||
def total_changes(self) -> int: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
@@ -299,26 +301,26 @@ class Connection:
|
||||
def __init__(
|
||||
self,
|
||||
database: StrOrBytesPath,
|
||||
timeout: float = ...,
|
||||
detect_types: int = ...,
|
||||
isolation_level: str | None = ...,
|
||||
check_same_thread: bool = ...,
|
||||
timeout: float = 5.0,
|
||||
detect_types: int = 0,
|
||||
isolation_level: _IsolationLevel = "DEFERRED",
|
||||
check_same_thread: bool = True,
|
||||
factory: type[Connection] | None = ...,
|
||||
cached_statements: int = ...,
|
||||
uri: bool = ...,
|
||||
cached_statements: int = 128,
|
||||
uri: bool = False,
|
||||
autocommit: bool = ...,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
database: StrOrBytesPath,
|
||||
timeout: float = ...,
|
||||
detect_types: int = ...,
|
||||
isolation_level: str | None = ...,
|
||||
check_same_thread: bool = ...,
|
||||
timeout: float = 5.0,
|
||||
detect_types: int = 0,
|
||||
isolation_level: _IsolationLevel = "DEFERRED",
|
||||
check_same_thread: bool = True,
|
||||
factory: type[Connection] | None = ...,
|
||||
cached_statements: int = ...,
|
||||
uri: bool = ...,
|
||||
cached_statements: int = 128,
|
||||
uri: bool = False,
|
||||
) -> None: ...
|
||||
|
||||
def close(self) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user