dycw-utilities 0.113.1__py3-none-any.whl → 0.113.2__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.113.1.dist-info → dycw_utilities-0.113.2.dist-info}/METADATA +4 -4
- {dycw_utilities-0.113.1.dist-info → dycw_utilities-0.113.2.dist-info}/RECORD +7 -7
- utilities/__init__.py +1 -1
- utilities/asyncio.py +42 -2
- utilities/types.py +3 -0
- {dycw_utilities-0.113.1.dist-info → dycw_utilities-0.113.2.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.113.1.dist-info → dycw_utilities-0.113.2.dist-info}/licenses/LICENSE +0 -0
@@ -1,12 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: dycw-utilities
|
3
|
-
Version: 0.113.
|
3
|
+
Version: 0.113.2
|
4
4
|
Author-email: Derek Wan <d.wan@icloud.com>
|
5
5
|
License-File: LICENSE
|
6
6
|
Requires-Python: >=3.12
|
7
7
|
Requires-Dist: typing-extensions<4.14,>=4.13.1
|
8
8
|
Provides-Extra: test
|
9
|
-
Requires-Dist: hypothesis<6.132,>=6.131.
|
9
|
+
Requires-Dist: hypothesis<6.132,>=6.131.10; extra == 'test'
|
10
10
|
Requires-Dist: pytest-asyncio<0.27,>=0.26.0; extra == 'test'
|
11
11
|
Requires-Dist: pytest-cov<6.2,>=6.1.1; extra == 'test'
|
12
12
|
Requires-Dist: pytest-instafail<0.6,>=0.5.0; extra == 'test'
|
@@ -16,7 +16,7 @@ Requires-Dist: pytest-randomly<3.17,>=3.16.0; extra == 'test'
|
|
16
16
|
Requires-Dist: pytest-regressions<2.8,>=2.7.0; extra == 'test'
|
17
17
|
Requires-Dist: pytest-rerunfailures<16,>=15.0; extra == 'test'
|
18
18
|
Requires-Dist: pytest-rng<1.1,>=1.0.0; extra == 'test'
|
19
|
-
Requires-Dist: pytest-timeout<2.
|
19
|
+
Requires-Dist: pytest-timeout<2.5,>=2.4.0; extra == 'test'
|
20
20
|
Requires-Dist: pytest-xdist<3.7,>=3.6.1; extra == 'test'
|
21
21
|
Requires-Dist: pytest<8.4,>=8.3.5; extra == 'test'
|
22
22
|
Requires-Dist: setuptools>=78.0.2; extra == 'test'
|
@@ -80,7 +80,7 @@ Provides-Extra: zzz-test-hypothesis
|
|
80
80
|
Requires-Dist: aiosqlite<0.22,>=0.21.0; extra == 'zzz-test-hypothesis'
|
81
81
|
Requires-Dist: asyncpg<0.31,>=0.30.0; extra == 'zzz-test-hypothesis'
|
82
82
|
Requires-Dist: greenlet<3.3,>=3.2.0; extra == 'zzz-test-hypothesis'
|
83
|
-
Requires-Dist: hypothesis<6.132,>=6.131.
|
83
|
+
Requires-Dist: hypothesis<6.132,>=6.131.10; extra == 'zzz-test-hypothesis'
|
84
84
|
Requires-Dist: luigi<3.7,>=3.6.0; extra == 'zzz-test-hypothesis'
|
85
85
|
Requires-Dist: numpy<2.3,>=2.2.5; extra == 'zzz-test-hypothesis'
|
86
86
|
Requires-Dist: pathvalidate<3.3,>=3.2.3; extra == 'zzz-test-hypothesis'
|
@@ -1,7 +1,7 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=gPP9gUduOhrk3TNScyIM28aOLTbYa1tnDF9Vu80gxZU,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=6Pv0xK2jP55iF6EYjY1g6_rFGOeJyihxRNxXnOsWv14,15691
|
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
|
@@ -77,7 +77,7 @@ utilities/text.py,sha256=Fo12N4aA7k2rnb4W4vH9iiDh88Q5_nvRssTkfNsvVM8,10965
|
|
77
77
|
utilities/threading.py,sha256=GvBOp4CyhHfN90wGXZuA2VKe9fGzMaEa7oCl4f3nnPU,1009
|
78
78
|
utilities/timer.py,sha256=Rkc49KSpHuC8s7vUxGO9DU55U9I6yDKnchsQqrUCVBs,4075
|
79
79
|
utilities/traceback.py,sha256=secexUnBsecfWV4ZuqP1W4pGF3prOeO1CRyJK-8zQDU,27402
|
80
|
-
utilities/types.py,sha256=
|
80
|
+
utilities/types.py,sha256=FhE1b8v_s_IlmXucwY7jAMWAq9cfpzyKssQwgwb3jnM,18267
|
81
81
|
utilities/typing.py,sha256=H6ysJkI830aRwLsMKz0SZIw4cpcsm7d6KhQOwr-SDh0,13817
|
82
82
|
utilities/tzdata.py,sha256=yCf70NICwAeazN3_JcXhWvRqCy06XJNQ42j7r6gw3HY,1217
|
83
83
|
utilities/tzlocal.py,sha256=3upDNFBvGh1l9njmLR2z2S6K6VxQSb7QizYGUbAH3JU,960
|
@@ -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.113.
|
91
|
-
dycw_utilities-0.113.
|
92
|
-
dycw_utilities-0.113.
|
93
|
-
dycw_utilities-0.113.
|
90
|
+
dycw_utilities-0.113.2.dist-info/METADATA,sha256=QgO7W2WhDgyW3k4-rB8FUJXk-vqpi7MfZfthSYdAD2o,12943
|
91
|
+
dycw_utilities-0.113.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
92
|
+
dycw_utilities-0.113.2.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
93
|
+
dycw_utilities-0.113.2.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/asyncio.py
CHANGED
@@ -17,6 +17,7 @@ from asyncio import (
|
|
17
17
|
sleep,
|
18
18
|
timeout,
|
19
19
|
)
|
20
|
+
from collections.abc import Callable
|
20
21
|
from contextlib import (
|
21
22
|
AsyncExitStack,
|
22
23
|
_AsyncGeneratorContextManager,
|
@@ -27,12 +28,22 @@ from dataclasses import dataclass, field
|
|
27
28
|
from io import StringIO
|
28
29
|
from subprocess import PIPE
|
29
30
|
from sys import stderr, stdout
|
30
|
-
from typing import
|
31
|
+
from typing import (
|
32
|
+
TYPE_CHECKING,
|
33
|
+
Generic,
|
34
|
+
Self,
|
35
|
+
TextIO,
|
36
|
+
TypeVar,
|
37
|
+
assert_never,
|
38
|
+
overload,
|
39
|
+
override,
|
40
|
+
)
|
31
41
|
|
32
42
|
from utilities.datetime import MILLISECOND, datetime_duration_to_float
|
33
43
|
from utilities.errors import ImpossibleCaseError
|
34
44
|
from utilities.functions import ensure_int, ensure_not_none
|
35
|
-
from utilities.
|
45
|
+
from utilities.sentinel import Sentinel, sentinel
|
46
|
+
from utilities.types import MaybeCallableEvent, THashable, TSupportsRichComparison
|
36
47
|
|
37
48
|
if TYPE_CHECKING:
|
38
49
|
from asyncio import _CoroutineLike
|
@@ -356,6 +367,34 @@ class UniqueQueue(Queue[THashable]):
|
|
356
367
|
##
|
357
368
|
|
358
369
|
|
370
|
+
@overload
|
371
|
+
def get_event(*, event: MaybeCallableEvent) -> Event: ...
|
372
|
+
@overload
|
373
|
+
def get_event(*, event: None) -> None: ...
|
374
|
+
@overload
|
375
|
+
def get_event(*, event: Sentinel) -> Sentinel: ...
|
376
|
+
@overload
|
377
|
+
def get_event(*, event: MaybeCallableEvent | Sentinel) -> Event | Sentinel: ...
|
378
|
+
@overload
|
379
|
+
def get_event(
|
380
|
+
*, event: MaybeCallableEvent | None | Sentinel = sentinel
|
381
|
+
) -> Event | None | Sentinel: ...
|
382
|
+
def get_event(
|
383
|
+
*, event: MaybeCallableEvent | None | Sentinel = sentinel
|
384
|
+
) -> Event | None | Sentinel:
|
385
|
+
"""Get the event."""
|
386
|
+
match event:
|
387
|
+
case Event() | None | Sentinel():
|
388
|
+
return event
|
389
|
+
case Callable() as func:
|
390
|
+
return get_event(event=func())
|
391
|
+
case _ as never:
|
392
|
+
assert_never(never)
|
393
|
+
|
394
|
+
|
395
|
+
##
|
396
|
+
|
397
|
+
|
359
398
|
async def get_items(
|
360
399
|
queue: Queue[_T], /, *, max_size: int | None = None, lock: Lock | None = None
|
361
400
|
) -> list[_T]:
|
@@ -490,6 +529,7 @@ __all__ = [
|
|
490
529
|
"StreamCommandOutput",
|
491
530
|
"UniquePriorityQueue",
|
492
531
|
"UniqueQueue",
|
532
|
+
"get_event",
|
493
533
|
"get_items",
|
494
534
|
"get_items_nowait",
|
495
535
|
"sleep_dur",
|
utilities/types.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
import datetime as dt
|
4
|
+
from asyncio import Event
|
4
5
|
from collections.abc import Awaitable, Callable, Coroutine, Hashable, Iterable, Mapping
|
5
6
|
from enum import Enum
|
6
7
|
from logging import Logger
|
@@ -57,6 +58,7 @@ type TupleOrStrMapping = tuple[Any, ...] | StrMapping
|
|
57
58
|
# asyncio
|
58
59
|
type Coroutine1[_T] = Coroutine[Any, Any, _T]
|
59
60
|
type MaybeAwaitable[_T] = _T | Awaitable[_T]
|
61
|
+
type MaybeCallableEvent = MaybeCallable[Event]
|
60
62
|
type MaybeCoroutine1[_T] = _T | Coroutine1[_T]
|
61
63
|
|
62
64
|
|
@@ -277,6 +279,7 @@ __all__ = [
|
|
277
279
|
"MaybeCallable",
|
278
280
|
"MaybeCallableDate",
|
279
281
|
"MaybeCallableDateTime",
|
282
|
+
"MaybeCallableEvent",
|
280
283
|
"MaybeCoroutine1",
|
281
284
|
"MaybeIterable",
|
282
285
|
"MaybeIterableHashable",
|
File without changes
|
File without changes
|