dycw-utilities 0.114.7__py3-none-any.whl → 0.115.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.
- {dycw_utilities-0.114.7.dist-info → dycw_utilities-0.115.1.dist-info}/METADATA +1 -1
- {dycw_utilities-0.114.7.dist-info → dycw_utilities-0.115.1.dist-info}/RECORD +7 -7
- utilities/__init__.py +1 -1
- utilities/asyncio.py +10 -9
- utilities/redis.py +4 -4
- {dycw_utilities-0.114.7.dist-info → dycw_utilities-0.115.1.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.114.7.dist-info → dycw_utilities-0.115.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,7 +1,7 @@
|
|
1
|
-
utilities/__init__.py,sha256
|
1
|
+
utilities/__init__.py,sha256=TbTtbGuM9AadB_WkxBUd94oWTm59iHPdjdluFVXZ-HI,60
|
2
2
|
utilities/altair.py,sha256=Gpja-flOo-Db0PIPJLJsgzAlXWoKUjPU1qY-DQ829ek,9156
|
3
3
|
utilities/astor.py,sha256=xuDUkjq0-b6fhtwjhbnebzbqQZAjMSHR1IIS5uOodVg,777
|
4
|
-
utilities/asyncio.py,sha256=
|
4
|
+
utilities/asyncio.py,sha256=rDsYSQUhl2YZQKtkbeCNK4Mrbh5heVaqWLvLn2ppMJg,21534
|
5
5
|
utilities/atomicwrites.py,sha256=geFjn9Pwn-tTrtoGjDDxWli9NqbYfy3gGL6ZBctiqSo,5393
|
6
6
|
utilities/atools.py,sha256=IYMuFSFGSKyuQmqD6v5IUtDlz8PPw0Sr87Cub_gRU3M,1168
|
7
7
|
utilities/cachetools.py,sha256=C1zqOg7BYz0IfQFK8e3qaDDgEZxDpo47F15RTfJM37Q,2910
|
@@ -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=0LAmbQFkwbJ3w6teTqGw1fNCSs1tDivL3DVAqob0S5c,26732
|
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.
|
91
|
-
dycw_utilities-0.
|
92
|
-
dycw_utilities-0.
|
93
|
-
dycw_utilities-0.
|
90
|
+
dycw_utilities-0.115.1.dist-info/METADATA,sha256=Bqi_67m9vtvYTiPadk63p01uSHmZlqyxM7_6YEuoo3A,12943
|
91
|
+
dycw_utilities-0.115.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
92
|
+
dycw_utilities-0.115.1.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
93
|
+
dycw_utilities-0.115.1.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/asyncio.py
CHANGED
@@ -45,6 +45,7 @@ from utilities.errors import ImpossibleCaseError
|
|
45
45
|
from utilities.functions import ensure_int, ensure_not_none, get_class_name
|
46
46
|
from utilities.sentinel import Sentinel, sentinel
|
47
47
|
from utilities.types import (
|
48
|
+
Coroutine1,
|
48
49
|
MaybeCallableEvent,
|
49
50
|
MaybeType,
|
50
51
|
THashable,
|
@@ -344,10 +345,10 @@ class InfiniteLooper(ABC, Generic[THashable]):
|
|
344
345
|
|
345
346
|
async def __call__(self) -> None:
|
346
347
|
"""Create a coroutine to run the looper."""
|
347
|
-
|
348
|
-
if len(
|
348
|
+
coroutines = list(self._yield_coroutines())
|
349
|
+
if len(coroutines) == 0:
|
349
350
|
return await self._run_looper()
|
350
|
-
return await self.
|
351
|
+
return await self._run_looper_with_coroutines(*coroutines)
|
351
352
|
|
352
353
|
async def _run_looper(self) -> None:
|
353
354
|
"""Run the looper by itself."""
|
@@ -378,14 +379,14 @@ class InfiniteLooper(ABC, Generic[THashable]):
|
|
378
379
|
self._error_upon_core(error)
|
379
380
|
await sleep_dur(duration=self.sleep_restart)
|
380
381
|
|
381
|
-
async def
|
382
|
+
async def _run_looper_with_coroutines(self, *coroutines: Coroutine1) -> None:
|
382
383
|
"""Run multiple loopers."""
|
383
384
|
while True:
|
384
385
|
self._reset_events()
|
385
386
|
try:
|
386
387
|
async with TaskGroup() as tg:
|
387
388
|
_ = tg.create_task(self._run_looper())
|
388
|
-
_ =
|
389
|
+
_ = list(map(tg.create_task, coroutines))
|
389
390
|
except Exception as error: # noqa: BLE001
|
390
391
|
self._error_upon_core(error) # pragma: no cover
|
391
392
|
await sleep_dur(duration=self.sleep_restart) # pragma: no cover
|
@@ -436,16 +437,16 @@ class InfiniteLooper(ABC, Generic[THashable]):
|
|
436
437
|
raise InfiniteLooperError(event=event) from None
|
437
438
|
event_obj.set()
|
438
439
|
|
440
|
+
def _yield_coroutines(self) -> Iterator[Coroutine1[None]]:
|
441
|
+
"""Yield any other coroutines which must also be run."""
|
442
|
+
yield from []
|
443
|
+
|
439
444
|
def _yield_events_and_exceptions(
|
440
445
|
self,
|
441
446
|
) -> Iterator[tuple[THashable, MaybeType[BaseException]]]:
|
442
447
|
"""Yield the events & exceptions."""
|
443
448
|
yield from []
|
444
449
|
|
445
|
-
def _yield_loopers(self) -> Iterator[InfiniteLooper]:
|
446
|
-
"""Yield any other infinite loopers which must also be run."""
|
447
|
-
yield from []
|
448
|
-
|
449
450
|
|
450
451
|
@dataclass(kw_only=True, slots=True)
|
451
452
|
class InfiniteLooperError(Exception):
|
utilities/redis.py
CHANGED
@@ -648,7 +648,7 @@ _SUBSCRIBE_SLEEP: Duration = MILLISECOND
|
|
648
648
|
|
649
649
|
|
650
650
|
@overload
|
651
|
-
|
651
|
+
def subscribe(
|
652
652
|
pubsub: PubSub,
|
653
653
|
channels: MaybeIterable[str],
|
654
654
|
/,
|
@@ -658,7 +658,7 @@ async def subscribe(
|
|
658
658
|
sleep: Duration = _SUBSCRIBE_SLEEP,
|
659
659
|
) -> AsyncIterator[_T]: ...
|
660
660
|
@overload
|
661
|
-
|
661
|
+
def subscribe(
|
662
662
|
pubsub: PubSub,
|
663
663
|
channels: MaybeIterable[str],
|
664
664
|
/,
|
@@ -667,7 +667,7 @@ async def subscribe(
|
|
667
667
|
timeout: Duration | None = _SUBSCRIBE_TIMEOUT,
|
668
668
|
sleep: Duration = _SUBSCRIBE_SLEEP,
|
669
669
|
) -> AsyncIterator[bytes]: ...
|
670
|
-
async def subscribe(
|
670
|
+
async def subscribe( # pyright: ignore[reportInconsistentOverload]
|
671
671
|
pubsub: PubSub,
|
672
672
|
channels: MaybeIterable[str],
|
673
673
|
/,
|
@@ -675,7 +675,7 @@ async def subscribe(
|
|
675
675
|
deserializer: Callable[[bytes], _T] | None = None,
|
676
676
|
timeout: Duration | None = _SUBSCRIBE_TIMEOUT,
|
677
677
|
sleep: Duration = _SUBSCRIBE_SLEEP,
|
678
|
-
) -> AsyncIterator[
|
678
|
+
) -> AsyncIterator[_T] | AsyncIterator[bytes]:
|
679
679
|
"""Subscribe to the data of a given channel(s)."""
|
680
680
|
channels = list(always_iterable(channels)) # skipif-ci-and-not-linux
|
681
681
|
messages = subscribe_messages( # skipif-ci-and-not-linux
|
File without changes
|
File without changes
|