Skip to content

Commit 19c7dc2

Browse files
committed
adjustments to Mapped
1 parent 38165f1 commit 19c7dc2

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

sqlalchemy-stubs/orm/attributes.pyi

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
from collections import namedtuple
22
from typing import Any
3+
from typing import Generic
34
from typing import Optional
5+
from typing import Type
6+
from typing import TypeVar
47

58
from . import collections as collections
69
from . import interfaces as interfaces
@@ -79,17 +82,16 @@ class QueryableAttribute(
7982
def __getattr__(self, key: Any): ...
8083
def property(self): ...
8184

85+
_T = TypeVar("_T")
86+
_Generic_T = Generic[_T]
8287

83-
class Mapped(QueryableAttribute):
84-
def __init__(self, type: _T) -> None: ...
85-
88+
class Mapped(QueryableAttribute, Generic[_T]):
89+
def __init__(self, type: Type[_T]) -> None: ...
8690
@overload
8791
def __get__(self, instance: None, owner: Any) -> Mapped[_T]: ...
88-
8992
@overload
9093
def __get__(self, instance: object, owner: Any) -> Union[_T, None]: ...
91-
92-
def __set__(self, instance: Any, value: Any) -> None: ...
94+
def __set__(self, instance: Any, value: _T) -> None: ...
9395
def __delete__(self, instance: Any) -> None: ...
9496

9597
class InstrumentedAttribute(Mapped):

sqlalchemy-stubs/orm/decl_api.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class DeclarativeMeta(type):
2020
) -> None: ...
2121
def __setattr__(cls, key: Any, value: Any) -> None: ...
2222
def __delattr__(cls, key: Any) -> None: ...
23+
metadata: MetaData
2324

2425
def synonym_for(name: Any, map_column: bool = ...): ...
2526

0 commit comments

Comments
 (0)