Skip to content

Commit 768d7c8

Browse files
committed
dev
1 parent ca98a92 commit 768d7c8

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

sqlalchemy-stubs/engine/create.pyi

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
from typing import Any
2+
from typing import Union
23

34
from . import base as base
5+
from .base import Engine
46
from .mock import create_mock_engine as create_mock_engine
7+
from .url import URL
58
from .. import event as event
69
from .. import exc as exc
710
from .. import util as util
811
from ..sql import compiler as compiler
912

10-
def create_engine(url: Any, **kwargs: Any): ...
13+
def create_engine(url: Union[str, URL], **kwargs: Any) -> Engine: ...
1114
def engine_from_config(
1215
configuration: Any, prefix: str = ..., **kwargs: Any
13-
): ...
16+
) -> Engine: ...

sqlalchemy-stubs/engine/url.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ class URL:
5959
def get_dialect(self): ...
6060
def translate_connect_args(self, names: Any = ..., **kw: Any): ...
6161

62-
def make_url(name_or_url: Any): ...
62+
def make_url(name_or_url: Union[str, URL]) -> URL: ...

sqlalchemy-stubs/inspection.pyi

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
from typing import Any
2+
from typing import overload
3+
from typing import Type
24

35
from . import exc as exc
46
from . import util as util
7+
from .engine.base import Connection
8+
from .engine.base import Engine
9+
from .engine.reflection import Inspector
10+
from .orm import InstanceState
11+
from .orm import Mapper
512

6-
def inspect(subject: Any, raiseerr: bool = ...): ...
13+
# this doesn't really seem to work...
14+
@overload
15+
def inspect(subject: Any, raiseerr: bool = ...) -> Any: ...
16+
@overload
17+
def inspect(subject: Engine, raiseerr: bool = ...) -> Inspector: ...
18+
@overload
19+
def inspect(subject: Connection, raiseerr: bool = ...) -> Inspector: ...
20+
@overload
21+
def inspect(subject: object, raiseerr: bool = ...) -> InstanceState: ...
22+
@overload
23+
def inspect(subject: Type, raiseerr: bool = ...) -> Mapper: ...

0 commit comments

Comments
 (0)