|
1 | 1 | from collections import namedtuple
|
2 | 2 | from typing import Any
|
| 3 | +from typing import Generic |
3 | 4 | from typing import Optional
|
| 5 | +from typing import Type |
| 6 | +from typing import TypeVar |
4 | 7 |
|
5 | 8 | from . import collections as collections
|
6 | 9 | from . import interfaces as interfaces
|
@@ -79,17 +82,16 @@ class QueryableAttribute(
|
79 | 82 | def __getattr__(self, key: Any): ...
|
80 | 83 | def property(self): ...
|
81 | 84 |
|
| 85 | +_T = TypeVar("_T") |
| 86 | +_Generic_T = Generic[_T] |
82 | 87 |
|
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: ... |
86 | 90 | @overload
|
87 | 91 | def __get__(self, instance: None, owner: Any) -> Mapped[_T]: ...
|
88 |
| - |
89 | 92 | @overload
|
90 | 93 | 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: ... |
93 | 95 | def __delete__(self, instance: Any) -> None: ...
|
94 | 96 |
|
95 | 97 | class InstrumentedAttribute(Mapped):
|
|
0 commit comments