Skip to content

Commit e6ae4cc

Browse files
authored
Improve miscellaneous engine modules (#89)
1 parent afe5bb4 commit e6ae4cc

File tree

4 files changed

+25
-24
lines changed

4 files changed

+25
-24
lines changed
Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
11
import abc
22
from typing import Any
33

4-
from ..util import ABC as ABC
4+
from .interfaces import _DBAPIConnection
5+
from .interfaces import Dialect
6+
from ..util import ABC
57

68
class ConnectionCharacteristic(ABC, metaclass=abc.ABCMeta):
79
transactional: bool = ...
810
@abc.abstractmethod
9-
def reset_characteristic(self, dialect: Any, dbapi_conn: Any) -> Any: ...
11+
def reset_characteristic(
12+
self, dialect: Dialect, dbapi_conn: _DBAPIConnection
13+
) -> None: ...
1014
@abc.abstractmethod
1115
def set_characteristic(
12-
self, dialect: Any, dbapi_conn: Any, value: Any
13-
) -> Any: ...
16+
self, dialect: Dialect, dbapi_conn: _DBAPIConnection, value: Any
17+
) -> None: ...
1418
@abc.abstractmethod
15-
def get_characteristic(self, dialect: Any, dbapi_conn: Any) -> Any: ...
19+
def get_characteristic(
20+
self, dialect: Dialect, dbapi_conn: _DBAPIConnection
21+
) -> Any: ...
1622

1723
class IsolationLevelCharacteristic(ConnectionCharacteristic):
1824
transactional: bool = ...
19-
def reset_characteristic(self, dialect: Any, dbapi_conn: Any) -> None: ...
25+
def reset_characteristic(
26+
self, dialect: Dialect, dbapi_conn: _DBAPIConnection
27+
) -> None: ...
2028
def set_characteristic(
21-
self, dialect: Any, dbapi_conn: Any, value: Any
29+
self, dialect: Dialect, dbapi_conn: _DBAPIConnection, value: Any
2230
) -> None: ...
23-
def get_characteristic(self, dialect: Any, dbapi_conn: Any): ...
31+
def get_characteristic(
32+
self, dialect: Dialect, dbapi_conn: _DBAPIConnection
33+
) -> Any: ...

sqlalchemy-stubs/engine/events.pyi

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
from typing import Any
22

3-
from .base import Engine as Engine
4-
from .interfaces import Connectable as Connectable
5-
from .interfaces import Dialect as Dialect
6-
from .. import event as event
7-
from .. import exc as exc
3+
from .interfaces import Dialect
4+
from .. import event
85

96
class ConnectionEvents(event.Events):
107
def before_execute(
@@ -70,7 +67,7 @@ class ConnectionEvents(event.Events):
7067

7168
class DialectEvents(event.Events):
7269
def do_connect(
73-
self, dialect: Any, conn_rec: Any, cargs: Any, cparams: Any
70+
self, dialect: Dialect, conn_rec: Any, cargs: Any, cparams: Any
7471
) -> None: ...
7572
def do_executemany(
7673
self, cursor: Any, statement: Any, parameters: Any, context: Any
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from typing import Any
1+
from typing import Type
22

3-
from .mock import MockConnection as MockConnection
3+
from .mock import MockConnection as _MockConnection
44

55
class MockEngineStrategy:
6-
MockConnection: Any = ...
6+
MockConnection: Type[_MockConnection] = ...

sqlalchemy-stubs/engine/util.pyi

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
11
from typing import Any
22

3-
from .. import exc as exc
4-
from .. import util as util
5-
from ..util import collections_abc as collections_abc
6-
from ..util import immutabledict as immutabledict
7-
8-
def connection_memoize(key: Any): ...
9-
def py_fallback(): ...
3+
def connection_memoize(key: Any) -> Any: ...

0 commit comments

Comments
 (0)