dycw-utilities 0.112.12__py3-none-any.whl → 0.112.14__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.
- {dycw_utilities-0.112.12.dist-info → dycw_utilities-0.112.14.dist-info}/METADATA +1 -1
- {dycw_utilities-0.112.12.dist-info → dycw_utilities-0.112.14.dist-info}/RECORD +7 -7
- utilities/__init__.py +1 -1
- utilities/more_itertools.py +31 -1
- utilities/redis.py +8 -4
- {dycw_utilities-0.112.12.dist-info → dycw_utilities-0.112.14.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.112.12.dist-info → dycw_utilities-0.112.14.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=CIhTEeq-pbU3Wh1aAi3xUU9ERIQ-sVu7LwD2EjBeNps,61
|
2
2
|
utilities/altair.py,sha256=Gpja-flOo-Db0PIPJLJsgzAlXWoKUjPU1qY-DQ829ek,9156
|
3
3
|
utilities/astor.py,sha256=xuDUkjq0-b6fhtwjhbnebzbqQZAjMSHR1IIS5uOodVg,777
|
4
4
|
utilities/asyncio.py,sha256=41oQUurWMvadFK5gFnaG21hMM0Vmfn2WS6OpC0R9mas,14757
|
@@ -35,7 +35,7 @@ utilities/luigi.py,sha256=fpH9MbxJDuo6-k9iCXRayFRtiVbUtibCJKugf7ygpv0,5988
|
|
35
35
|
utilities/math.py,sha256=TexfvLCI12d9Sw5_W4pKVBZ3nRr3zk2iPkcEU7xdEWU,26771
|
36
36
|
utilities/memory_profiler.py,sha256=tf2C51P2lCujPGvRt2Rfc7VEw5LDXmVPCG3z_AvBmbU,962
|
37
37
|
utilities/modules.py,sha256=iuvLluJya-hvl1Q25-Jk3dLgx2Es3ck4SjJiEkAlVTs,3195
|
38
|
-
utilities/more_itertools.py,sha256=
|
38
|
+
utilities/more_itertools.py,sha256=6T0225gBFZtv47-B0JRFOKMz836Wg3Hct79ePPLGpuo,5827
|
39
39
|
utilities/numpy.py,sha256=Xn23sA2ZbVNqwUYEgNJD3XBYH6IbCri_WkHSNhg3NkY,26122
|
40
40
|
utilities/operator.py,sha256=0M2yZJ0PODH47ogFEnkGMBe_cfxwZR02T_92LZVZvHo,3715
|
41
41
|
utilities/optuna.py,sha256=loyJGWTzljgdJaoLhP09PT8Jz6o_pwBOwehY33lHkhw,1923
|
@@ -58,7 +58,7 @@ utilities/pytest_regressions.py,sha256=-SVT9647Dg6-JcdsiaDKXe3NdOmmrvGevLKWwGjxq
|
|
58
58
|
utilities/python_dotenv.py,sha256=iWcnpXbH7S6RoXHiLlGgyuH6udCupAcPd_gQ0eAenQ0,3190
|
59
59
|
utilities/random.py,sha256=lYdjgxB7GCfU_fwFVl5U-BIM_HV3q6_urL9byjrwDM8,4157
|
60
60
|
utilities/re.py,sha256=5J4d8VwIPFVrX2Eb8zfoxImDv7IwiN_U7mJ07wR2Wvs,3958
|
61
|
-
utilities/redis.py,sha256=
|
61
|
+
utilities/redis.py,sha256=jpBq5dEKthxLgS68Bj-dksfGqFl-RrRGK-x5-6owDVI,25438
|
62
62
|
utilities/reprlib.py,sha256=Re9bk3n-kC__9DxQmRlevqFA86pE6TtVfWjUgpbVOv0,1849
|
63
63
|
utilities/rich.py,sha256=t50MwwVBsoOLxzmeVFSVpjno4OW6Ufum32skXbV8-Bs,1911
|
64
64
|
utilities/scipy.py,sha256=X6ROnHwiUhAmPhM0jkfEh0-Fd9iRvwiqtCQMOLmOQF8,945
|
@@ -87,7 +87,7 @@ utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
|
|
87
87
|
utilities/whenever.py,sha256=iLRP_-8CZtBpHKbGZGu-kjSMg1ZubJ-VSmgSy7Eudxw,17787
|
88
88
|
utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
|
89
89
|
utilities/zoneinfo.py,sha256=-Xm57PMMwDTYpxJdkiJG13wnbwK--I7XItBh5WVhD-o,1874
|
90
|
-
dycw_utilities-0.112.
|
91
|
-
dycw_utilities-0.112.
|
92
|
-
dycw_utilities-0.112.
|
93
|
-
dycw_utilities-0.112.
|
90
|
+
dycw_utilities-0.112.14.dist-info/METADATA,sha256=j1h-dnkoSmxpcQeVqNPWmJynfitGt61YQFT3liw1LuU,13005
|
91
|
+
dycw_utilities-0.112.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
92
|
+
dycw_utilities-0.112.14.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
93
|
+
dycw_utilities-0.112.14.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/more_itertools.py
CHANGED
@@ -32,6 +32,9 @@ _T = TypeVar("_T")
|
|
32
32
|
_U = TypeVar("_U")
|
33
33
|
|
34
34
|
|
35
|
+
##
|
36
|
+
|
37
|
+
|
35
38
|
@overload
|
36
39
|
def bucket_mapping(
|
37
40
|
iterable: Iterable[_T], func: Callable[[_T], THashable], /, *, list: Literal[True]
|
@@ -55,6 +58,20 @@ def bucket_mapping(
|
|
55
58
|
return mapping
|
56
59
|
|
57
60
|
|
61
|
+
##
|
62
|
+
|
63
|
+
|
64
|
+
def partition_list(
|
65
|
+
pred: Callable[[_T], bool], iterable: Iterable[_T], /
|
66
|
+
) -> tuple[list[_T], list[_T]]:
|
67
|
+
"""Partition with lists."""
|
68
|
+
false, true = partition(pred, iterable)
|
69
|
+
return list(false), list(true)
|
70
|
+
|
71
|
+
|
72
|
+
##
|
73
|
+
|
74
|
+
|
58
75
|
def partition_typeguard(
|
59
76
|
pred: Callable[[_T], TypeGuard[_U]], iterable: Iterable[_T], /
|
60
77
|
) -> tuple[Iterator[_T], Iterator[_U]]:
|
@@ -64,6 +81,9 @@ def partition_typeguard(
|
|
64
81
|
return false, true
|
65
82
|
|
66
83
|
|
84
|
+
##
|
85
|
+
|
86
|
+
|
67
87
|
class peekable(_peekable, Generic[_T]): # noqa: N801
|
68
88
|
"""Peekable which supports dropwhile/takewhile methods."""
|
69
89
|
|
@@ -98,6 +118,9 @@ class peekable(_peekable, Generic[_T]): # noqa: N801
|
|
98
118
|
yield next(self)
|
99
119
|
|
100
120
|
|
121
|
+
##
|
122
|
+
|
123
|
+
|
101
124
|
@dataclass(kw_only=True, slots=True)
|
102
125
|
class Split(Generic[_T]):
|
103
126
|
"""An iterable split into head/tail."""
|
@@ -184,4 +207,11 @@ def _yield_splits3(
|
|
184
207
|
)
|
185
208
|
|
186
209
|
|
187
|
-
__all__ = [
|
210
|
+
__all__ = [
|
211
|
+
"Split",
|
212
|
+
"bucket_mapping",
|
213
|
+
"partition_list",
|
214
|
+
"partition_typeguard",
|
215
|
+
"peekable",
|
216
|
+
"yield_splits",
|
217
|
+
]
|
utilities/redis.py
CHANGED
@@ -88,20 +88,24 @@ class RedisHashMapKey(Generic[_K, _V]):
|
|
88
88
|
|
89
89
|
async def delete(self, redis: Redis, key: _K, /) -> int:
|
90
90
|
"""Delete a key from a hashmap in `redis`."""
|
91
|
+
ser = _serialize( # skipif-ci-and-not-linux
|
92
|
+
key, serializer=self.key_serializer
|
93
|
+
).decode()
|
91
94
|
async with timeout_dur( # skipif-ci-and-not-linux
|
92
95
|
duration=self.timeout, error=self.error
|
93
96
|
):
|
94
|
-
return await cast("Awaitable[int]", redis.hdel(self.name,
|
97
|
+
return await cast("Awaitable[int]", redis.hdel(self.name, ser))
|
95
98
|
raise ImpossibleCaseError(case=[f"{redis=}", f"{key=}"]) # pragma: no cover
|
96
99
|
|
97
100
|
async def exists(self, redis: Redis, key: _K, /) -> bool:
|
98
101
|
"""Check if the key exists in a hashmap in `redis`."""
|
102
|
+
ser = _serialize( # skipif-ci-and-not-linux
|
103
|
+
key, serializer=self.key_serializer
|
104
|
+
).decode()
|
99
105
|
async with timeout_dur( # skipif-ci-and-not-linux
|
100
106
|
duration=self.timeout, error=self.error
|
101
107
|
):
|
102
|
-
return await cast(
|
103
|
-
"Awaitable[bool]", redis.hexists(self.name, cast("str", key))
|
104
|
-
)
|
108
|
+
return await cast("Awaitable[bool]", redis.hexists(self.name, ser))
|
105
109
|
|
106
110
|
async def get(self, redis: Redis, key: _K, /) -> _V:
|
107
111
|
"""Get a value from a hashmap in `redis`."""
|
File without changes
|
File without changes
|