blob: e735ce531d4b7f3be20e3a57de5bb4dacca30cf1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
from typing import Any
from typing import Callable # noqa
from typing import Generic
from typing import overload
from typing import Type
from typing import TypeVar
from . import compat
if compat.py38:
from typing import Literal
from typing import Protocol
from typing import TypedDict
else:
from typing_extensions import Literal # noqa
from typing_extensions import Protocol # noqa
from typing_extensions import TypedDict # noqa
if compat.py310:
from typing import Concatenate
from typing import ParamSpec
else:
from typing_extensions import Concatenate # noqa
from typing_extensions import ParamSpec # noqa
if compat.py311:
from typing import NotRequired # noqa
else:
from typing_extensions import NotRequired # noqa
_T = TypeVar("_T")
class _TypeToInstance(Generic[_T]):
@overload
def __get__(self, instance: None, owner: Any) -> Type[_T]:
...
@overload
def __get__(self, instance: object, owner: Any) -> _T:
...
@overload
def __set__(self, instance: None, value: Type[_T]) -> None:
...
@overload
def __set__(self, instance: object, value: _T) -> None:
...
|