-
Notifications
You must be signed in to change notification settings - Fork 9
/
types.py
159 lines (113 loc) · 2.83 KB
/
types.py
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
from typing import TypeVar
from numerary.types import CachingProtocolMeta # type: ignore[attr-defined]
from typing_extensions import Protocol
from typing_extensions import runtime_checkable
T_contra = TypeVar("T_contra", contravariant=True)
U_co = TypeVar("U_co", covariant=True)
@runtime_checkable
class _SupportsLt(Protocol[T_contra]):
def __lt__(self, other: T_contra) -> bool:
...
class SupportsLt(
_SupportsLt[T_contra],
Protocol[T_contra],
metaclass=CachingProtocolMeta,
):
...
@runtime_checkable
class _SupportsLe(Protocol[T_contra]):
def __le__(self, other: T_contra) -> bool:
...
class SupportsLe(
_SupportsLe[T_contra],
Protocol[T_contra],
metaclass=CachingProtocolMeta,
):
...
@runtime_checkable
class _SupportsGt(Protocol[T_contra]):
def __gt__(self, other: T_contra) -> bool:
...
class SupportsGt(
_SupportsGt[T_contra],
Protocol[T_contra],
metaclass=CachingProtocolMeta,
):
...
@runtime_checkable
class _SupportsGe(Protocol[T_contra]):
def __ge__(self, other: T_contra) -> bool:
...
class SupportsGe(
_SupportsGe[T_contra],
Protocol[T_contra],
metaclass=CachingProtocolMeta,
):
...
@runtime_checkable
class _SupportsEq(Protocol):
def __eq__(self, other: object) -> bool:
...
class SupportsEq(Protocol, metaclass=CachingProtocolMeta):
...
@runtime_checkable
class _Comparable(
SupportsLt[T_contra],
SupportsLe[T_contra],
SupportsGt[T_contra],
SupportsGe[T_contra],
SupportsEq,
Protocol[T_contra],
):
...
class Comparable(
_Comparable[T_contra],
Protocol[T_contra],
metaclass=CachingProtocolMeta,
):
...
@runtime_checkable
class _SupportsLeGe(SupportsLe[T_contra], SupportsGe[T_contra], Protocol[T_contra]):
...
class SupportsLeGe(
_SupportsLeGe[T_contra],
Protocol[T_contra],
metaclass=CachingProtocolMeta,
):
...
@runtime_checkable
class _SupportsLeGt(SupportsLe[T_contra], SupportsGt[T_contra], Protocol[T_contra]):
...
class SupportsLeGt(
_SupportsLeGt[T_contra],
Protocol[T_contra],
metaclass=CachingProtocolMeta,
):
...
@runtime_checkable
class _SupportsLtGe(SupportsLt[T_contra], SupportsGe[T_contra], Protocol[T_contra]):
...
class SupportsLtGe(
_SupportsLtGe[T_contra],
Protocol[T_contra],
metaclass=CachingProtocolMeta,
):
...
class _SupportsLtGt(SupportsLt[T_contra], SupportsGt[T_contra], Protocol[T_contra]):
...
class SupportsLtGt(
_SupportsLtGt[T_contra],
Protocol[T_contra],
metaclass=CachingProtocolMeta,
):
...
@runtime_checkable
class _SupportsMod(Protocol[T_contra, U_co]):
def __mod__(self, other: T_contra) -> U_co:
...
class SupportsMod(
_SupportsMod[T_contra, U_co],
Protocol[T_contra, U_co],
metaclass=CachingProtocolMeta,
):
...