|
1 | 1 | from typing import Any
|
| 2 | +from typing import Callable |
| 3 | +from typing import Dict |
| 4 | +from typing import List |
| 5 | +from typing import NoReturn |
2 | 6 | from typing import Optional
|
| 7 | +from typing import Type |
| 8 | +from typing import Union |
3 | 9 |
|
4 |
| -from .. import util as util |
5 |
| -from ..engine import Connection as _LegacyConnection |
6 |
| -from ..engine import Engine as _LegacyEngine |
7 |
| -from ..engine.base import OptionEngineMixin as OptionEngineMixin |
| 10 | +from .. import util |
| 11 | +from ..engine.base import Connection as _LegacyConnection |
| 12 | +from ..engine.base import Engine as _LegacyEngine |
| 13 | +from ..engine.base import NestedTransaction |
| 14 | +from ..engine.base import OptionEngineMixin |
| 15 | +from ..engine.base import Transaction |
| 16 | +from ..engine.create import _Debug |
| 17 | +from ..engine.create import _IsolationLevel |
| 18 | +from ..engine.create import _ParamStyle |
| 19 | +from ..engine.create import _ResetOnReturn |
| 20 | +from ..engine.url import URL |
| 21 | +from ..pool import Pool |
8 | 22 |
|
9 |
| -NO_OPTIONS: Any |
| 23 | +NO_OPTIONS: util.immutabledict[Any, Any] = ... |
10 | 24 |
|
11 |
| -def create_engine(*arg: Any, **kw: Any): ... |
| 25 | +def create_engine( |
| 26 | + url: Union[str, URL], |
| 27 | + *, |
| 28 | + case_sensitive: bool = ..., |
| 29 | + connect_args: Dict[Any, Any] = ..., |
| 30 | + convert_unicode: bool = ..., |
| 31 | + creator: Callable[..., Any] = ..., |
| 32 | + echo: Union[bool, _Debug] = ..., |
| 33 | + echo_pool: Union[bool, _Debug] = ..., |
| 34 | + enable_from_linting: bool = ..., |
| 35 | + encoding: str = ..., |
| 36 | + execution_options: Dict[Any, Any] = ..., |
| 37 | + hide_parameters: bool = ..., |
| 38 | + implicit_returning: bool = ..., |
| 39 | + isolation_level: _IsolationLevel = ..., |
| 40 | + json_deserializer: Callable[..., Any] = ..., |
| 41 | + json_serializer: Callable[..., Any] = ..., |
| 42 | + label_length: Optional[int] = ..., |
| 43 | + listeners: Any = ..., |
| 44 | + logging_name: str = ..., |
| 45 | + max_identifier_length: Optional[int] = ..., |
| 46 | + max_overflow: int = ..., |
| 47 | + module: Optional[Any] = ..., |
| 48 | + paramstyle: Optional[_ParamStyle] = ..., |
| 49 | + pool: Optional[Pool] = ..., |
| 50 | + poolclass: Optional[Type[Pool]] = ..., |
| 51 | + pool_logging_name: str = ..., |
| 52 | + pool_pre_ping: bool = ..., |
| 53 | + pool_size: int = ..., |
| 54 | + pool_recycle: int = ..., |
| 55 | + pool_reset_on_return: Optional[_ResetOnReturn] = ..., |
| 56 | + pool_timeout: float = ..., |
| 57 | + pool_use_lifo: bool = ..., |
| 58 | + plugins: List[str] = ..., |
| 59 | + query_cache_size: int = ..., |
| 60 | + **kw: Any, |
| 61 | +) -> Engine: ... |
12 | 62 |
|
13 | 63 | class Connection(_LegacyConnection):
|
14 |
| - def begin(self): ... |
15 |
| - def begin_nested(self): ... |
| 64 | + def begin(self) -> Transaction: ... |
| 65 | + def begin_nested(self) -> NestedTransaction: ... |
16 | 66 | def commit(self) -> None: ...
|
17 | 67 | def rollback(self) -> None: ...
|
18 | 68 | def close(self) -> None: ...
|
19 |
| - def execute( |
| 69 | + def execute( # type: ignore[override] |
20 | 70 | self,
|
21 | 71 | statement: Any,
|
22 | 72 | parameters: Optional[Any] = ...,
|
23 | 73 | execution_options: Optional[Any] = ...,
|
24 |
| - ): ... |
25 |
| - def scalar( |
| 74 | + ) -> Any: ... |
| 75 | + def scalar( # type: ignore[override] |
26 | 76 | self,
|
27 | 77 | statement: Any,
|
28 | 78 | parameters: Optional[Any] = ...,
|
29 | 79 | execution_options: Optional[Any] = ...,
|
30 |
| - ): ... |
| 80 | + ) -> Any: ... |
31 | 81 |
|
32 | 82 | class Engine(_LegacyEngine):
|
33 |
| - transaction: Any = ... |
34 |
| - run_callable: Any = ... |
35 |
| - execute: Any = ... |
36 |
| - scalar: Any = ... |
37 |
| - table_names: Any = ... |
38 |
| - has_table: Any = ... |
| 83 | + def transaction(self, *arg: Any, **kw: Any) -> NoReturn: ... |
| 84 | + def run_callable(self, *arg: Any, **kw: Any) -> NoReturn: ... |
| 85 | + def execute(self, *arg: Any, **kw: Any) -> NoReturn: ... |
| 86 | + def scalar(self, *arg: Any, **kw: Any) -> NoReturn: ... |
| 87 | + def table_names(self, *arg: Any, **kw: Any) -> NoReturn: ... |
| 88 | + def has_table(self, *arg: Any, **kw: Any) -> NoReturn: ... |
39 | 89 | class _trans_ctx:
|
40 |
| - conn: Any = ... |
41 |
| - def __init__(self, conn: Any) -> None: ... |
42 |
| - transaction: Any = ... |
43 |
| - def __enter__(self): ... |
| 90 | + conn: Connection = ... |
| 91 | + def __init__(self, conn: Connection) -> None: ... |
| 92 | + transaction: Transaction = ... |
| 93 | + def __enter__(self) -> Connection: ... |
44 | 94 | def __exit__(self, type_: Any, value: Any, traceback: Any) -> None: ...
|
45 |
| - def begin(self): ... |
46 |
| - def connect(self): ... |
| 95 | + def begin(self) -> _trans_ctx: ... # type: ignore[override] |
| 96 | + def connect(self) -> Connection: ... # type: ignore[override] |
47 | 97 |
|
48 | 98 | class OptionEngine(OptionEngineMixin, Engine): ...
|
0 commit comments