Skip to content

Commit e931c09

Browse files
authored
Merge pull request #24 from bryanforbes/improve-sql-annotation
Improve `sql.annotation` typings
2 parents bd14b97 + d29a1d1 commit e931c09

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

sqlalchemy-stubs/sql/annotation.pyi

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
from typing import Any
2+
from typing import Dict
3+
from typing import Tuple
4+
from typing import Type
5+
from typing import TypeVar
26

3-
from . import operators as operators
4-
from .base import HasCacheKey as HasCacheKey
5-
from .traversals import anon_map as anon_map
6-
from .visitors import InternalTraversal as InternalTraversal
7-
from .. import util as util
7+
from .. import util
88

9-
EMPTY_ANNOTATIONS: Any
9+
_A = TypeVar("_A", bound=Annotated)
10+
_T = TypeVar("_T")
11+
12+
EMPTY_ANNOTATIONS: util.immutabledict[None, None]
1013

1114
class SupportsAnnotations: ...
1215
class SupportsCloneAnnotations(SupportsAnnotations): ...
1316
class SupportsWrappingAnnotations(SupportsAnnotations): ...
1417

1518
class Annotated:
16-
def __new__(cls, *args: Any): ...
17-
__dict__: Any = ...
19+
def __new__(cls: Type[_T], *args: Any) -> _T: ...
20+
__dict__: Dict[Any, Any] = ...
1821
def __init__(self, element: Any, values: Any) -> None: ...
19-
def __reduce__(self): ...
20-
def __hash__(self) -> Any: ...
21-
def __eq__(self, other: Any) -> Any: ...
22+
def __reduce__(self: _A) -> Tuple[Type[_A], Tuple[Any, Any]]: ...
23+
def __hash__(self) -> int: ...
24+
def __eq__(self, other: Any) -> bool: ...
2225
@property
23-
def entity_namespace(self): ...
26+
def entity_namespace(self) -> Any: ...
2427

25-
annotated_classes: Any
28+
annotated_classes: Dict[Type[Any], Any]

0 commit comments

Comments
 (0)