Skip to content

Commit 95cbbae

Browse files
authored
Improve ext.declarative (#62)
* Improve `ext.declarative` * Tweaks based on PR feedback
1 parent ec51773 commit 95cbbae

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
from typing import Any
2-
31
from .extensions import AbstractConcreteBase as AbstractConcreteBase
42
from .extensions import ConcreteBase as ConcreteBase
53
from .extensions import DeferredReflection as DeferredReflection
64
from .extensions import instrument_declarative as instrument_declarative
5+
from ...orm.decl_api import as_declarative as as_declarative
6+
from ...orm.decl_api import declarative_base as declarative_base
77
from ...orm.decl_api import DeclarativeMeta as DeclarativeMeta
88
from ...orm.decl_api import declared_attr as declared_attr
9-
10-
def declarative_base(*arg: Any, **kw: Any): ...
11-
def as_declarative(*arg: Any, **kw: Any): ...
12-
def has_inherited_table(*arg: Any, **kw: Any): ...
13-
def synonym_for(*arg: Any, **kw: Any): ...
9+
from ...orm.decl_api import has_inherited_table as has_inherited_table
10+
from ...orm.decl_api import synonym_for as synonym_for

sqlalchemy-stubs/ext/declarative/extensions.pyi

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
from typing import Any
2+
from typing import Dict
3+
from typing import Type
24

3-
from ... import inspection as inspection
4-
from ... import util as util
5-
from ...orm import registry as registry
6-
from ...orm import relationships as relationships
7-
from ...orm.util import polymorphic_union as polymorphic_union
8-
from ...schema import Table as Table
9-
from ...util import OrderedDict as OrderedDict
5+
from ... import MetaData
106

11-
def instrument_declarative(cls, cls_registry: Any, metadata: Any): ...
7+
def instrument_declarative(
8+
cls: Type[Any], cls_registry: Dict[str, Type[Any]], metadata: MetaData
9+
) -> Any: ...
1210

1311
class ConcreteBase:
1412
@classmethod

0 commit comments

Comments
 (0)