jetpytools 1.7.4__py3-none-any.whl → 2.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of jetpytools might be problematic. Click here for more details.
- jetpytools/_metadata.py +1 -1
- jetpytools/enums/base.py +1 -7
- jetpytools/enums/other.py +5 -5
- jetpytools/exceptions/base.py +8 -31
- jetpytools/exceptions/generic.py +2 -2
- jetpytools/functions/funcs.py +18 -19
- jetpytools/functions/normalize.py +16 -18
- jetpytools/types/builtins.py +12 -70
- jetpytools/types/file.py +2 -6
- jetpytools/types/funcs.py +5 -6
- jetpytools/types/generic.py +5 -5
- jetpytools/types/supports.py +24 -39
- jetpytools/types/utils.py +413 -278
- jetpytools/utils/funcs.py +13 -10
- jetpytools/utils/math.py +3 -5
- jetpytools/utils/ranges.py +9 -50
- {jetpytools-1.7.4.dist-info → jetpytools-2.0.1.dist-info}/METADATA +3 -3
- jetpytools-2.0.1.dist-info/RECORD +33 -0
- jetpytools-1.7.4.dist-info/RECORD +0 -33
- {jetpytools-1.7.4.dist-info → jetpytools-2.0.1.dist-info}/WHEEL +0 -0
- {jetpytools-1.7.4.dist-info → jetpytools-2.0.1.dist-info}/licenses/LICENSE +0 -0
jetpytools/types/supports.py
CHANGED
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from abc import abstractmethod
|
|
4
|
-
from typing import
|
|
5
|
-
Any,
|
|
6
|
-
Callable,
|
|
7
|
-
Iterable,
|
|
8
|
-
Protocol,
|
|
9
|
-
SupportsFloat,
|
|
10
|
-
SupportsIndex,
|
|
11
|
-
TypeAlias,
|
|
12
|
-
TypeVar,
|
|
13
|
-
overload,
|
|
14
|
-
runtime_checkable,
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
from .builtins import T0, T1, T2, T_co, T_contra
|
|
4
|
+
from typing import Any, Callable, Iterable, Protocol, SupportsFloat, SupportsIndex, TypeVar, overload, runtime_checkable
|
|
18
5
|
|
|
19
6
|
__all__ = [
|
|
20
7
|
"ComparatorFunc",
|
|
@@ -36,17 +23,13 @@ __all__ = [
|
|
|
36
23
|
]
|
|
37
24
|
|
|
38
25
|
|
|
39
|
-
_KT = TypeVar("_KT")
|
|
40
|
-
_VT_co = TypeVar("_VT_co", covariant=True)
|
|
41
|
-
|
|
42
|
-
|
|
43
26
|
@runtime_checkable
|
|
44
|
-
class SupportsAdd
|
|
27
|
+
class SupportsAdd[T_contra, T_co](Protocol):
|
|
45
28
|
def __add__(self, x: T_contra, /) -> T_co: ...
|
|
46
29
|
|
|
47
30
|
|
|
48
31
|
@runtime_checkable
|
|
49
|
-
class SupportsRAdd
|
|
32
|
+
class SupportsRAdd[T_contra, T_co](Protocol):
|
|
50
33
|
def __radd__(self, x: T_contra, /) -> T_co: ...
|
|
51
34
|
|
|
52
35
|
|
|
@@ -68,22 +51,22 @@ class SupportsString(Protocol):
|
|
|
68
51
|
|
|
69
52
|
|
|
70
53
|
@runtime_checkable
|
|
71
|
-
class SupportsDunderLT
|
|
54
|
+
class SupportsDunderLT[T_contra](Protocol):
|
|
72
55
|
def __lt__(self, other: T_contra) -> bool: ...
|
|
73
56
|
|
|
74
57
|
|
|
75
58
|
@runtime_checkable
|
|
76
|
-
class SupportsDunderGT
|
|
59
|
+
class SupportsDunderGT[T_contra](Protocol):
|
|
77
60
|
def __gt__(self, other: T_contra) -> bool: ...
|
|
78
61
|
|
|
79
62
|
|
|
80
63
|
@runtime_checkable
|
|
81
|
-
class SupportsDunderLE
|
|
64
|
+
class SupportsDunderLE[T_contra](Protocol):
|
|
82
65
|
def __le__(self, other: T_contra) -> bool: ...
|
|
83
66
|
|
|
84
67
|
|
|
85
68
|
@runtime_checkable
|
|
86
|
-
class SupportsDunderGE
|
|
69
|
+
class SupportsDunderGE[T_contra](Protocol):
|
|
87
70
|
def __ge__(self, other: T_contra) -> bool: ...
|
|
88
71
|
|
|
89
72
|
|
|
@@ -93,7 +76,7 @@ class SupportsAllComparisons(
|
|
|
93
76
|
): ...
|
|
94
77
|
|
|
95
78
|
|
|
96
|
-
SupportsRichComparison
|
|
79
|
+
type SupportsRichComparison = SupportsDunderLT[Any] | SupportsDunderGT[Any]
|
|
97
80
|
SupportsRichComparisonT = TypeVar("SupportsRichComparisonT", bound=SupportsRichComparison)
|
|
98
81
|
|
|
99
82
|
|
|
@@ -109,7 +92,7 @@ class ComparatorFunc(Protocol):
|
|
|
109
92
|
) -> SupportsRichComparisonT: ...
|
|
110
93
|
|
|
111
94
|
@overload
|
|
112
|
-
def __call__(self, arg1:
|
|
95
|
+
def __call__[T](self, arg1: T, arg2: T, /, *_args: T, key: Callable[[T], SupportsRichComparison]) -> T: ...
|
|
113
96
|
|
|
114
97
|
@overload
|
|
115
98
|
def __call__(
|
|
@@ -117,27 +100,29 @@ class ComparatorFunc(Protocol):
|
|
|
117
100
|
) -> SupportsRichComparisonT: ...
|
|
118
101
|
|
|
119
102
|
@overload
|
|
120
|
-
def __call__(self, iterable: Iterable[
|
|
103
|
+
def __call__[T](self, iterable: Iterable[T], /, *, key: Callable[[T], SupportsRichComparison]) -> T: ...
|
|
121
104
|
|
|
122
105
|
@overload
|
|
123
|
-
def __call__(
|
|
124
|
-
self, iterable: Iterable[SupportsRichComparisonT], /, *, key: None = ..., default:
|
|
125
|
-
) -> SupportsRichComparisonT |
|
|
106
|
+
def __call__[T, SupportsRichComparisonT: SupportsRichComparison](
|
|
107
|
+
self, iterable: Iterable[SupportsRichComparisonT], /, *, key: None = ..., default: T
|
|
108
|
+
) -> SupportsRichComparisonT | T: ...
|
|
126
109
|
|
|
127
110
|
@overload
|
|
128
|
-
def __call__(
|
|
129
|
-
self, iterable: Iterable[
|
|
130
|
-
) ->
|
|
111
|
+
def __call__[T0, T1](
|
|
112
|
+
self, iterable: Iterable[T0], /, *, key: Callable[[T0], SupportsRichComparison], default: T1
|
|
113
|
+
) -> T0 | T1: ...
|
|
131
114
|
|
|
132
115
|
|
|
133
|
-
|
|
134
|
-
|
|
116
|
+
@runtime_checkable
|
|
117
|
+
class SupportsIndexing[T](Protocol):
|
|
118
|
+
def __getitem__(self, k: int) -> T: ...
|
|
135
119
|
|
|
136
120
|
|
|
137
|
-
|
|
138
|
-
|
|
121
|
+
@runtime_checkable
|
|
122
|
+
class SupportsKeysAndGetItem[KT, VT](Protocol):
|
|
123
|
+
def keys(self) -> Iterable[KT]: ...
|
|
139
124
|
|
|
140
|
-
def __getitem__(self, k:
|
|
125
|
+
def __getitem__(self, k: KT) -> VT: ...
|
|
141
126
|
|
|
142
127
|
|
|
143
|
-
SupportsFloatOrIndex
|
|
128
|
+
SupportsFloatOrIndex = SupportsFloat | SupportsIndex
|