dycw-utilities 0.151.12__py3-none-any.whl → 0.152.0__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.151.12.dist-info → dycw_utilities-0.152.0.dist-info}/METADATA +2 -2
- {dycw_utilities-0.151.12.dist-info → dycw_utilities-0.152.0.dist-info}/RECORD +9 -9
- utilities/__init__.py +1 -1
- utilities/iterables.py +1 -12
- utilities/redis.py +2 -2
- utilities/types.py +6 -22
- {dycw_utilities-0.151.12.dist-info → dycw_utilities-0.152.0.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.151.12.dist-info → dycw_utilities-0.152.0.dist-info}/entry_points.txt +0 -0
- {dycw_utilities-0.151.12.dist-info → dycw_utilities-0.152.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: dycw-utilities
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.152.0
|
4
4
|
Author-email: Derek Wan <d.wan@icloud.com>
|
5
5
|
License-File: LICENSE
|
6
6
|
Requires-Python: >=3.12
|
@@ -12,7 +12,7 @@ Provides-Extra: logging
|
|
12
12
|
Requires-Dist: coloredlogs<15.1,>=15.0.1; extra == 'logging'
|
13
13
|
Provides-Extra: test
|
14
14
|
Requires-Dist: dycw-pytest-only<2.2,>=2.1.1; extra == 'test'
|
15
|
-
Requires-Dist: hypothesis<6.137,>=6.136.
|
15
|
+
Requires-Dist: hypothesis<6.137,>=6.136.6; extra == 'test'
|
16
16
|
Requires-Dist: pudb<2025.2,>=2025.1; extra == 'test'
|
17
17
|
Requires-Dist: pytest-asyncio<1.2,>=1.1.0; extra == 'test'
|
18
18
|
Requires-Dist: pytest-cov<6.3,>=6.2.1; extra == 'test'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=yPinoOXl37WGTDQPnlJyr4YW7B9ojeL_vWBwenSrkaQ,60
|
2
2
|
utilities/altair.py,sha256=92E2lCdyHY4Zb-vCw6rEJIsWdKipuu-Tu2ab1ufUfAk,9079
|
3
3
|
utilities/asyncio.py,sha256=r75HVwm6QoCOz7bEe3_KO47G4_IIhNCYcPDrJTi4i_4,16777
|
4
4
|
utilities/atomicwrites.py,sha256=tPo6r-Rypd9u99u66B9z86YBPpnLrlHtwox_8Z7T34Y,5790
|
@@ -26,7 +26,7 @@ utilities/hypothesis.py,sha256=m44niSfuzuhgn7IQ1UOwUGgiu68xz4a6LHxB0IE6fNE,40341
|
|
26
26
|
utilities/importlib.py,sha256=mV1xT_O_zt_GnZZ36tl3xOmMaN_3jErDWY54fX39F6Y,429
|
27
27
|
utilities/inflect.py,sha256=v7YkOWSu8NAmVghPcf4F3YBZQoJCS47_DLf9jbfWIs0,581
|
28
28
|
utilities/ipython.py,sha256=V2oMYHvEKvlNBzxDXdLvKi48oUq2SclRg5xasjaXStw,763
|
29
|
-
utilities/iterables.py,sha256=
|
29
|
+
utilities/iterables.py,sha256=VGqnVk-Wq13WHZZQ8L6BCCwFzEOoKGRpd7xkiQaXbiY,43642
|
30
30
|
utilities/json.py,sha256=-WcGtSsCr9Y42wHZzAMnfvU6ihAfVftylFfRUORaDFo,2102
|
31
31
|
utilities/jupyter.py,sha256=ft5JA7fBxXKzP-L9W8f2-wbF0QeYc_2uLQNFDVk4Z-M,2917
|
32
32
|
utilities/libcst.py,sha256=TKgKN4bNmtBNEE-TUfhTyd1BrTncfsl_7tTuhpesGYY,5585
|
@@ -58,7 +58,7 @@ utilities/pytest.py,sha256=xR-xG5aTfU9U7Qcb8Lle8uhLP1V0zc8EqZFfU0F8zfg,7899
|
|
58
58
|
utilities/pytest_regressions.py,sha256=ocjHTtfOeiGfQAKIei8pKNd61sxN9dawrJJ9gPt2wzA,4097
|
59
59
|
utilities/random.py,sha256=YWYzWxQDeyJRiuHGnO1OxF6dDucpq7qc1tH_ealwCRg,4130
|
60
60
|
utilities/re.py,sha256=S4h-DLL6ScMPqjboZ_uQ1BVTJajrqV06r_81D--_HCE,4573
|
61
|
-
utilities/redis.py,sha256=
|
61
|
+
utilities/redis.py,sha256=2fdveFbqL2pEAeyiVuN_Je8nSM_IZHeahPduMHhFRzY,28381
|
62
62
|
utilities/reprlib.py,sha256=ssYTcBW-TeRh3fhCJv57sopTZHF5FrPyyUg9yp5XBlo,3953
|
63
63
|
utilities/scipy.py,sha256=wZJM7fEgBAkLSYYvSmsg5ac-QuwAI0BGqHVetw1_Hb0,947
|
64
64
|
utilities/sentinel.py,sha256=3jIwgpMekWgDAxPDA_hXMP2St43cPhciKN3LWiZ7kv0,1248
|
@@ -75,7 +75,7 @@ utilities/threading.py,sha256=GvBOp4CyhHfN90wGXZuA2VKe9fGzMaEa7oCl4f3nnPU,1009
|
|
75
75
|
utilities/timer.py,sha256=oXfTii6ymu57niP0BDGZjFD55LEHi2a19kqZKiTgaFQ,2588
|
76
76
|
utilities/traceback.py,sha256=zofhzIedpUHrzDNiRJDVzm_wuu_tlTQvVqK4quxVlgM,9151
|
77
77
|
utilities/typed_settings.py,sha256=ZzzlMgPntnGv6kAn0mGp43nHJCnU99V_8152QmpH9tY,4476
|
78
|
-
utilities/types.py,sha256
|
78
|
+
utilities/types.py,sha256=-DUlUxqkVGaSVU_uTbfMIXWUDDUXnPuIDwQIsPE_mY8,18244
|
79
79
|
utilities/typing.py,sha256=Z-_XDaWyT_6wIo3qfNK-hvRlzxP2Jxa9PgXzm5rDYRA,13790
|
80
80
|
utilities/tzdata.py,sha256=fgNVj66yUbCSI_-vrRVzSD3gtf-L_8IEJEPjP_Jel5Y,266
|
81
81
|
utilities/tzlocal.py,sha256=KyCXEgCTjqGFx-389JdTuhMRUaT06U1RCMdWoED-qro,728
|
@@ -88,8 +88,8 @@ utilities/zoneinfo.py,sha256=FBMcUQ4662Aq8SsuCL1OAhDQiyANmVjtb-C30DRrWoE,1966
|
|
88
88
|
utilities/pytest_plugins/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
89
89
|
utilities/pytest_plugins/pytest_randomly.py,sha256=NXzCcGKbpgYouz5yehKb4jmxmi2SexKKpgF4M65bi10,414
|
90
90
|
utilities/pytest_plugins/pytest_regressions.py,sha256=Iwhfv_OJH7UCPZCfoh7ugZ2Xjqjil-BBBsOb8sDwiGI,1471
|
91
|
-
dycw_utilities-0.
|
92
|
-
dycw_utilities-0.
|
93
|
-
dycw_utilities-0.
|
94
|
-
dycw_utilities-0.
|
95
|
-
dycw_utilities-0.
|
91
|
+
dycw_utilities-0.152.0.dist-info/METADATA,sha256=JV_YGZDAfL333osSK-mawT3eeu0RHzt2PNkd-09o0yM,1696
|
92
|
+
dycw_utilities-0.152.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
93
|
+
dycw_utilities-0.152.0.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
|
94
|
+
dycw_utilities-0.152.0.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
95
|
+
dycw_utilities-0.152.0.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/iterables.py
CHANGED
@@ -46,7 +46,7 @@ from utilities.types import SupportsAdd, SupportsLT
|
|
46
46
|
if TYPE_CHECKING:
|
47
47
|
from types import NoneType
|
48
48
|
|
49
|
-
from utilities.types import MaybeIterable,
|
49
|
+
from utilities.types import MaybeIterable, Sign, StrMapping
|
50
50
|
|
51
51
|
|
52
52
|
##
|
@@ -66,16 +66,6 @@ def always_iterable[T](obj: MaybeIterable[T], /) -> Iterable[T]:
|
|
66
66
|
##
|
67
67
|
|
68
68
|
|
69
|
-
def always_iterable_hashable[T](
|
70
|
-
obj: MaybeIterable[T] | None, /
|
71
|
-
) -> MaybeIterableHashable[T] | None:
|
72
|
-
"""Ensure an object is always hashable."""
|
73
|
-
return None if obj is None else tuple(always_iterable(obj))
|
74
|
-
|
75
|
-
|
76
|
-
##
|
77
|
-
|
78
|
-
|
79
69
|
def apply_bijection[T, U](
|
80
70
|
func: Callable[[T], U], iterable: Iterable[T], /
|
81
71
|
) -> Mapping[T, U]:
|
@@ -1489,7 +1479,6 @@ __all__ = [
|
|
1489
1479
|
"ResolveIncludeAndExcludeError",
|
1490
1480
|
"SortIterableError",
|
1491
1481
|
"always_iterable",
|
1492
|
-
"always_iterable_hashable",
|
1493
1482
|
"apply_bijection",
|
1494
1483
|
"apply_to_tuple",
|
1495
1484
|
"apply_to_varargs",
|
utilities/redis.py
CHANGED
@@ -35,7 +35,7 @@ if TYPE_CHECKING:
|
|
35
35
|
from redis.typing import EncodableT
|
36
36
|
|
37
37
|
from utilities.iterables import MaybeIterable
|
38
|
-
from utilities.types import Delta,
|
38
|
+
from utilities.types import Delta, MaybeSequence, MaybeType, TypeLike
|
39
39
|
|
40
40
|
|
41
41
|
_PUBLISH_TIMEOUT: Delta = SECOND
|
@@ -583,7 +583,7 @@ class PublishError(Exception):
|
|
583
583
|
async def publish_many[T](
|
584
584
|
redis: Redis,
|
585
585
|
channel: str,
|
586
|
-
data: MaybeSequence[bytes |
|
586
|
+
data: MaybeSequence[bytes | str | T],
|
587
587
|
/,
|
588
588
|
*,
|
589
589
|
serializer: Callable[[T], EncodableT] | None = None,
|
utilities/types.py
CHANGED
@@ -2,15 +2,7 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
import datetime as dt
|
4
4
|
from asyncio import Event
|
5
|
-
from collections.abc import
|
6
|
-
Callable,
|
7
|
-
Collection,
|
8
|
-
Coroutine,
|
9
|
-
Hashable,
|
10
|
-
Iterable,
|
11
|
-
Mapping,
|
12
|
-
Sequence,
|
13
|
-
)
|
5
|
+
from collections.abc import Callable, Collection, Coroutine, Iterable, Mapping
|
14
6
|
from enum import Enum
|
15
7
|
from ipaddress import IPv4Address, IPv6Address
|
16
8
|
from logging import Logger
|
@@ -123,20 +115,16 @@ IPv6AddressLike = MaybeStr[IPv6Address]
|
|
123
115
|
|
124
116
|
|
125
117
|
# iterables
|
126
|
-
type IterableHashable[T: Hashable] = tuple[T, ...] | frozenset[T]
|
127
118
|
type MaybeCollection[T] = T | Collection[T]
|
128
|
-
type MaybeIterableHashable[T: Hashable] = T | IterableHashable[T]
|
129
119
|
type MaybeIterable[T] = T | Iterable[T]
|
130
|
-
type
|
131
|
-
type
|
120
|
+
type MaybeSequence[T] = T | SequenceLT[T]
|
121
|
+
type SequenceLT[T] = list[T] | tuple[T, ...]
|
132
122
|
# iterables - str
|
133
|
-
type
|
134
|
-
|
135
|
-
|
123
|
+
type SequenceStr = SequenceLT[str]
|
124
|
+
type CollectionStr = dict[str, Any] | frozenset[str] | set[str] | SequenceStr
|
125
|
+
# iterables - maybe str
|
136
126
|
type MaybeCollectionStr = str | CollectionStr
|
137
|
-
type MaybeListStr = MaybeList[str]
|
138
127
|
type MaybeSequenceStr = str | SequenceStr
|
139
|
-
type SequenceStr = list[str] | tuple[str, ...]
|
140
128
|
|
141
129
|
|
142
130
|
# logging
|
@@ -288,7 +276,6 @@ __all__ = [
|
|
288
276
|
"ExceptionTypeLike",
|
289
277
|
"IPv4AddressLike",
|
290
278
|
"IPv6AddressLike",
|
291
|
-
"IterableHashable",
|
292
279
|
"LogLevel",
|
293
280
|
"LoggerOrName",
|
294
281
|
"MathRoundMode",
|
@@ -303,9 +290,6 @@ __all__ = [
|
|
303
290
|
"MaybeCollectionStr",
|
304
291
|
"MaybeCoro",
|
305
292
|
"MaybeIterable",
|
306
|
-
"MaybeIterableHashable",
|
307
|
-
"MaybeList",
|
308
|
-
"MaybeListStr",
|
309
293
|
"MaybeSequence",
|
310
294
|
"MaybeSequenceStr",
|
311
295
|
"MaybeStr",
|
File without changes
|
File without changes
|
File without changes
|