ez-a-sync 0.22.15__py3-none-any.whl → 0.22.16__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 ez-a-sync might be problematic. Click here for more details.
- a_sync/ENVIRONMENT_VARIABLES.py +34 -3
- a_sync/__init__.py +32 -9
- a_sync/_smart.py +105 -6
- a_sync/_typing.py +56 -3
- a_sync/a_sync/_descriptor.py +174 -12
- a_sync/a_sync/_flags.py +64 -3
- a_sync/a_sync/_helpers.py +40 -8
- a_sync/a_sync/_kwargs.py +30 -6
- a_sync/a_sync/_meta.py +35 -6
- a_sync/a_sync/abstract.py +57 -9
- a_sync/a_sync/config.py +44 -7
- a_sync/a_sync/decorator.py +217 -37
- a_sync/a_sync/function.py +339 -47
- a_sync/a_sync/method.py +241 -52
- a_sync/a_sync/modifiers/__init__.py +39 -1
- a_sync/a_sync/modifiers/cache/__init__.py +75 -5
- a_sync/a_sync/modifiers/cache/memory.py +50 -6
- a_sync/a_sync/modifiers/limiter.py +55 -6
- a_sync/a_sync/modifiers/manager.py +46 -2
- a_sync/a_sync/modifiers/semaphores.py +84 -11
- a_sync/a_sync/singleton.py +43 -19
- a_sync/asyncio/__init__.py +137 -1
- a_sync/asyncio/as_completed.py +44 -38
- a_sync/asyncio/create_task.py +46 -10
- a_sync/asyncio/gather.py +72 -25
- a_sync/exceptions.py +178 -11
- a_sync/executor.py +51 -3
- a_sync/future.py +671 -29
- a_sync/iter.py +64 -7
- a_sync/primitives/_debug.py +59 -5
- a_sync/primitives/_loggable.py +36 -6
- a_sync/primitives/locks/counter.py +74 -7
- a_sync/primitives/locks/prio_semaphore.py +87 -8
- a_sync/primitives/locks/semaphore.py +68 -20
- a_sync/primitives/queue.py +65 -26
- a_sync/task.py +51 -15
- a_sync/utils/iterators.py +52 -16
- {ez_a_sync-0.22.15.dist-info → ez_a_sync-0.22.16.dist-info}/METADATA +1 -1
- ez_a_sync-0.22.16.dist-info/RECORD +74 -0
- {ez_a_sync-0.22.15.dist-info → ez_a_sync-0.22.16.dist-info}/WHEEL +1 -1
- tests/executor.py +150 -12
- tests/test_abstract.py +15 -0
- tests/test_base.py +198 -2
- tests/test_executor.py +23 -0
- tests/test_singleton.py +13 -1
- tests/test_task.py +45 -17
- ez_a_sync-0.22.15.dist-info/RECORD +0 -74
- {ez_a_sync-0.22.15.dist-info → ez_a_sync-0.22.16.dist-info}/LICENSE.txt +0 -0
- {ez_a_sync-0.22.15.dist-info → ez_a_sync-0.22.16.dist-info}/top_level.txt +0 -0
tests/test_task.py
CHANGED
|
@@ -10,6 +10,9 @@ async def test_create_task():
|
|
|
10
10
|
|
|
11
11
|
Verifies that a task can be created using the `create_task`
|
|
12
12
|
function with a coroutine and a specified name.
|
|
13
|
+
|
|
14
|
+
See Also:
|
|
15
|
+
- :func:`a_sync.create_task`
|
|
13
16
|
"""
|
|
14
17
|
t = create_task(coro=asyncio.sleep(0), name="test")
|
|
15
18
|
assert t.get_name() == "test", t
|
|
@@ -17,13 +20,16 @@ async def test_create_task():
|
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
@pytest.mark.asyncio_cooperative
|
|
20
|
-
async def test_persistent_task():
|
|
23
|
+
async def test_persistent_task(): # sourcery skip: simplify-boolean-comparison
|
|
21
24
|
"""Test the persistence of a task without a local reference.
|
|
22
25
|
|
|
23
26
|
Checks if a task created without a local reference
|
|
24
27
|
completes successfully by setting a nonlocal variable.
|
|
25
28
|
The test ensures that the task completes by verifying
|
|
26
29
|
the change in the nonlocal variable.
|
|
30
|
+
|
|
31
|
+
See Also:
|
|
32
|
+
- :func:`a_sync.create_task`
|
|
27
33
|
"""
|
|
28
34
|
check = False
|
|
29
35
|
|
|
@@ -43,7 +49,11 @@ async def test_pruning():
|
|
|
43
49
|
"""Test task creation and handling without errors.
|
|
44
50
|
|
|
45
51
|
Ensures that tasks can be created without causing errors.
|
|
46
|
-
This test does not explicitly check for task pruning
|
|
52
|
+
This test does not explicitly check for task pruning, despite
|
|
53
|
+
its name, but rather focuses on task creation stability.
|
|
54
|
+
|
|
55
|
+
See Also:
|
|
56
|
+
- :func:`a_sync.create_task`
|
|
47
57
|
"""
|
|
48
58
|
|
|
49
59
|
async def task():
|
|
@@ -59,9 +69,12 @@ async def test_pruning():
|
|
|
59
69
|
async def test_task_mapping_init():
|
|
60
70
|
"""Test initialization of TaskMapping.
|
|
61
71
|
|
|
62
|
-
Verifies that the TaskMapping class initializes correctly
|
|
72
|
+
Verifies that the :class:`TaskMapping` class initializes correctly
|
|
63
73
|
with the provided coroutine function and arguments. Checks
|
|
64
74
|
the handling of function arguments and the task name.
|
|
75
|
+
|
|
76
|
+
See Also:
|
|
77
|
+
- :class:`a_sync.TaskMapping`
|
|
65
78
|
"""
|
|
66
79
|
tasks = TaskMapping(_coro_fn)
|
|
67
80
|
assert (
|
|
@@ -78,9 +91,12 @@ async def test_task_mapping_init():
|
|
|
78
91
|
async def test_task_mapping():
|
|
79
92
|
"""Test the functionality of TaskMapping.
|
|
80
93
|
|
|
81
|
-
Checks the behavior of TaskMapping
|
|
94
|
+
Checks the behavior of :class:`TaskMapping`, including task
|
|
82
95
|
creation, retrieval, and execution. Verifies the ability
|
|
83
96
|
to await the mapping and checks the return values of tasks.
|
|
97
|
+
|
|
98
|
+
See Also:
|
|
99
|
+
- :class:`a_sync.TaskMapping`
|
|
84
100
|
"""
|
|
85
101
|
tasks = TaskMapping(_coro_fn)
|
|
86
102
|
# does it return the correct type
|
|
@@ -108,10 +124,13 @@ async def test_task_mapping():
|
|
|
108
124
|
async def test_task_mapping_map_with_sync_iter():
|
|
109
125
|
"""Test TaskMapping with a synchronous iterator.
|
|
110
126
|
|
|
111
|
-
Verifies that TaskMapping can map over a synchronous
|
|
127
|
+
Verifies that :class:`TaskMapping` can map over a synchronous
|
|
112
128
|
iterator and correctly handle keys, values, and items.
|
|
113
|
-
Ensures that mapping in progress raises a RuntimeError
|
|
129
|
+
Ensures that mapping in progress raises a :class:`RuntimeError`
|
|
114
130
|
when attempted concurrently.
|
|
131
|
+
|
|
132
|
+
See Also:
|
|
133
|
+
- :class:`a_sync.TaskMapping`
|
|
115
134
|
"""
|
|
116
135
|
tasks = TaskMapping(_coro_fn)
|
|
117
136
|
i = 0
|
|
@@ -168,10 +187,13 @@ async def test_task_mapping_map_with_sync_iter():
|
|
|
168
187
|
async def test_task_mapping_map_with_async_iter():
|
|
169
188
|
"""Test TaskMapping with an asynchronous iterator.
|
|
170
189
|
|
|
171
|
-
Verifies that TaskMapping can map over an asynchronous
|
|
190
|
+
Verifies that :class:`TaskMapping` can map over an asynchronous
|
|
172
191
|
iterator and correctly handle keys, values, and items.
|
|
173
|
-
Ensures that mapping in progress raises a RuntimeError
|
|
192
|
+
Ensures that mapping in progress raises a :class:`RuntimeError`
|
|
174
193
|
when attempted concurrently.
|
|
194
|
+
|
|
195
|
+
See Also:
|
|
196
|
+
- :class:`a_sync.TaskMapping`
|
|
175
197
|
"""
|
|
176
198
|
|
|
177
199
|
async def async_iter():
|
|
@@ -262,22 +284,19 @@ def test_taskmapping_views_sync():
|
|
|
262
284
|
"""Test synchronous views of TaskMapping.
|
|
263
285
|
|
|
264
286
|
Checks the synchronous access to keys, values, and items
|
|
265
|
-
in TaskMapping
|
|
287
|
+
in :class:`TaskMapping`. Verifies the state of these views before
|
|
266
288
|
and after gathering tasks.
|
|
289
|
+
|
|
290
|
+
See Also:
|
|
291
|
+
- :class:`a_sync.TaskMapping`
|
|
267
292
|
"""
|
|
268
293
|
tasks = TaskMapping(_coro_fn, range(5))
|
|
269
294
|
|
|
270
295
|
# keys are currently empty until the loop has a chance to run
|
|
271
|
-
|
|
272
|
-
assert len(tasks.values()) == 0
|
|
273
|
-
assert len(tasks.items()) == 0
|
|
274
|
-
|
|
296
|
+
_assert_len_dictviews(tasks, 0)
|
|
275
297
|
tasks.gather()
|
|
276
298
|
|
|
277
|
-
|
|
278
|
-
assert len(tasks.values()) == 5
|
|
279
|
-
assert len(tasks.items()) == 5
|
|
280
|
-
|
|
299
|
+
_assert_len_dictviews(tasks, 5)
|
|
281
300
|
for k in tasks.keys():
|
|
282
301
|
assert isinstance(k, int)
|
|
283
302
|
|
|
@@ -295,6 +314,12 @@ def test_taskmapping_views_sync():
|
|
|
295
314
|
assert isinstance(k, int)
|
|
296
315
|
|
|
297
316
|
|
|
317
|
+
def _assert_len_dictviews(tasks, i):
|
|
318
|
+
assert len(tasks.keys()) == i
|
|
319
|
+
assert len(tasks.values()) == i
|
|
320
|
+
assert len(tasks.items()) == i
|
|
321
|
+
|
|
322
|
+
|
|
298
323
|
async def _coro_fn(i: int) -> str:
|
|
299
324
|
"""Coroutine function for testing.
|
|
300
325
|
|
|
@@ -303,6 +328,9 @@ async def _coro_fn(i: int) -> str:
|
|
|
303
328
|
|
|
304
329
|
Returns:
|
|
305
330
|
A string representation of the incremented input.
|
|
331
|
+
|
|
332
|
+
See Also:
|
|
333
|
+
- :func:`a_sync.TaskMapping`
|
|
306
334
|
"""
|
|
307
335
|
i += 1
|
|
308
336
|
return str(i) * i
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
a_sync/ENVIRONMENT_VARIABLES.py,sha256=WNRUCRH5RwqGbVVYST_JuJb2MUOMtdf3GW3lsGomp5s,466
|
|
2
|
-
a_sync/__init__.py,sha256=r9VTp-p3GJND5KcotrQGZRoub5eiA-O_ZpgDw15ua2U,3778
|
|
3
|
-
a_sync/_smart.py,sha256=DyHISh-F_xKwoTuGCw3QY6HaGMoA122A5yh2ZUWCTMc,9331
|
|
4
|
-
a_sync/_typing.py,sha256=6oc5XAt9KNMzX91qrmnaGMXe_EH-uNFcuRwczcCtDkA,5411
|
|
5
|
-
a_sync/aliases.py,sha256=TbLyuLeFfJEmcC5-NP6h4DQ9QXlQjGny2NUP_x1tflw,212
|
|
6
|
-
a_sync/exceptions.py,sha256=Qym1qjw35bcD9QxSFvb8D02PjQ_qRiCWGWHABbC8qbI,7290
|
|
7
|
-
a_sync/executor.py,sha256=f8tbcThk1rhuR6smrh7tmna8qOnAZFoaSLe72TRYSWo,13204
|
|
8
|
-
a_sync/future.py,sha256=2gB_-WMZIrXnwT7zgO75czVDqQso6kqZp7pbKItjHKQ,31748
|
|
9
|
-
a_sync/iter.py,sha256=BSFFH3fp3pEyA-8PHcjh4nqwjmh0OLNtyYKVz_XUcbU,21466
|
|
10
|
-
a_sync/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
a_sync/task.py,sha256=jg0H2Stsxp3iMSda5v2PRM253SINXbNRgK16teKm8SQ,31035
|
|
12
|
-
a_sync/a_sync/__init__.py,sha256=qENRGhOVdj0uwYHqGZwDdTTYDepvpb0qjzVJn7Nco78,1814
|
|
13
|
-
a_sync/a_sync/_descriptor.py,sha256=puij54vKOOf5jDl_lSmOSOTfNiHHk_VKZlEBFo-7eDM,8413
|
|
14
|
-
a_sync/a_sync/_flags.py,sha256=UAzMesvTnvc3bqFzSS7A66kNCMf4S7LbQejdtq7TnNA,1959
|
|
15
|
-
a_sync/a_sync/_helpers.py,sha256=yKInVqquvx0KkY2YlLAi86CumiC8dwsA15TTNLlcrsQ,1808
|
|
16
|
-
a_sync/a_sync/_kwargs.py,sha256=tfx0pVe32PAk1m2LmkyDqBVsHbmnNM9gqQ8s0_DNd-s,1380
|
|
17
|
-
a_sync/a_sync/_meta.py,sha256=xMP9LUsdk8M8It2Rc1_HjBI5NZBDf7Y6bt74ljfNuSg,8245
|
|
18
|
-
a_sync/a_sync/abstract.py,sha256=sBmVssbek0OZyxm1Cc-42IcTpahCS0teiVAGWIxzzpM,5787
|
|
19
|
-
a_sync/a_sync/base.py,sha256=rZolx0B4Dof84ahC3pfTDTQe4laZppNnAcliAmNkjDw,7431
|
|
20
|
-
a_sync/a_sync/config.py,sha256=Wvk9oJa8hPrio-meJX4hsRXx0TSIe_UavH7F1cZ-Ptk,3868
|
|
21
|
-
a_sync/a_sync/decorator.py,sha256=eHTpyMJOEBx42s-8Asu4MCTY-VbDBKWo4AK0XuoaIwQ,12317
|
|
22
|
-
a_sync/a_sync/function.py,sha256=rUq43E5qM8j2hN5iZPAYhbBq1NA57OepDEpeNSHkGsc,33369
|
|
23
|
-
a_sync/a_sync/method.py,sha256=yS9Vn6k4BkSExGlZQLC3KPG_qfRCEacKInnHxNDVZpo,24750
|
|
24
|
-
a_sync/a_sync/property.py,sha256=llVqhVksV717ejaDBne7DHBuuMUmHdlsW83wcTElQJQ,25203
|
|
25
|
-
a_sync/a_sync/singleton.py,sha256=tG8E_gT7Qw5Hzgib53TVdMYZa05D5yhLYiHccSZHItc,1460
|
|
26
|
-
a_sync/a_sync/modifiers/__init__.py,sha256=IBDKhGu7XBp7u4ONy6Kmn0Wxdk7WqZoBwHs3590mQuk,2743
|
|
27
|
-
a_sync/a_sync/modifiers/limiter.py,sha256=K-WW4M45oEVvL84Pf11nUVws3hWwflqhyp-VSwLzDMU,2914
|
|
28
|
-
a_sync/a_sync/modifiers/manager.py,sha256=te5BtXw9wm-Zgxn5m3ffFnEkrS7f1xrtBpPpc5fMlmE,5676
|
|
29
|
-
a_sync/a_sync/modifiers/semaphores.py,sha256=GFVYF0n52eet8b1Y0sR0UhZPu43Joj-aQURV9JrZPf8,3921
|
|
30
|
-
a_sync/a_sync/modifiers/cache/__init__.py,sha256=HDs9tBoQyU_DKfam-UGgQUC7Hb3jdHH7vvR0LonoHdw,2889
|
|
31
|
-
a_sync/a_sync/modifiers/cache/memory.py,sha256=V0o_PbFrUlTkom0x013ZZ0oyFLZ0msjxH9Hf0IsmlA4,4266
|
|
32
|
-
a_sync/asyncio/__init__.py,sha256=8xKXPz8Vk4ytvti9zNUgRtGmI5KF3EndgwGHCB5oBHg,519
|
|
33
|
-
a_sync/asyncio/as_completed.py,sha256=I64-uIDKalh20cHC24Mvg71K_NVGRK4KPbYipvDXBXU,8901
|
|
34
|
-
a_sync/asyncio/create_task.py,sha256=kwaDrb8UIqBFv5fZoFmbJfeZvGt6oCbqX9rHXMwqw1Y,4199
|
|
35
|
-
a_sync/asyncio/gather.py,sha256=x1IzwqhP4YatiBLMiZhI7K6mGtVspMggEdeti9X8itU,5885
|
|
36
|
-
a_sync/asyncio/utils.py,sha256=C9XmHO_zU0-Cgob9_YYmqGfyjYyskKqySqyvUcWo7LU,391
|
|
37
|
-
a_sync/primitives/__init__.py,sha256=zpmDwVSUOknQyIOTedyhwRWygiXSmYvjdl83oFAr1Rk,737
|
|
38
|
-
a_sync/primitives/_debug.py,sha256=7TfPphc3e7I46rkLiiLVqxdAS-bBgRvxr5evRaWYYhQ,3077
|
|
39
|
-
a_sync/primitives/_loggable.py,sha256=ngiLMRxQcQP3S4bt8VmBXA52YO9x5bZ0-XEM8sJojPE,1206
|
|
40
|
-
a_sync/primitives/queue.py,sha256=f3lXhk3RyfOMidv5d8C34VYwVjP_hVv67dG-q36lr0E,28577
|
|
41
|
-
a_sync/primitives/locks/__init__.py,sha256=zKSLeCUgMGSbuXN6ehb2dm0-4lbk-Ze8_ldatWEjy4Y,283
|
|
42
|
-
a_sync/primitives/locks/counter.py,sha256=3_4MMKLQtXUzJuuQfr5mrk-rxrv6O2Y8mO66cMH8H0Q,4876
|
|
43
|
-
a_sync/primitives/locks/event.py,sha256=U1suI0OZEH8X3jxF_MChGUtuhemLzROqqd6a7bpHM8E,2974
|
|
44
|
-
a_sync/primitives/locks/prio_semaphore.py,sha256=UnH1uAwxiERdmxvKH8SyF-kq0T76L15ehskOERs4cBo,11982
|
|
45
|
-
a_sync/primitives/locks/semaphore.py,sha256=TnR49MYI_VTvMRN0WAtvF7T9MKqUrUtWlm3CB9g7_XU,6572
|
|
46
|
-
a_sync/sphinx/__init__.py,sha256=UvdsakVmkn0Lw4vEd3jA3_Acymde95-78o87lel8ikk,49
|
|
47
|
-
a_sync/sphinx/ext.py,sha256=3ktEWH1brCbHZi2m4BGwglfLyA5JjF05cB0e_c-MVTg,8997
|
|
48
|
-
a_sync/utils/__init__.py,sha256=4JiGSyL5Jj2G7cAmeQN6fxwFnzyOtWYd9IeX8BhrR2k,3223
|
|
49
|
-
a_sync/utils/iterators.py,sha256=W1EGSBOZy_k7VOiJZyPafqE6vZxzeLO0aeWHfAKur0w,9787
|
|
50
|
-
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
51
|
-
tests/conftest.py,sha256=cZPQoOF3h1OtsFzEb7Jkx54COExVdf0XfD0LZBrmqcg,57
|
|
52
|
-
tests/executor.py,sha256=vnfaQXP2EmPEQ6SmOgUW0haIq1QSDY-jMxfxyjEeed4,3781
|
|
53
|
-
tests/fixtures.py,sha256=4j3GsopNo6tMFOyhWOb8Hnwcwiw2Xdjee4r1YLH1JBE,5774
|
|
54
|
-
tests/test_abstract.py,sha256=85QVvLeoN7Pvtrjhy0oXmwwmXEctrzvkGWkntXveksQ,542
|
|
55
|
-
tests/test_as_completed.py,sha256=_oy8L4xmK7NvpAaNPLdM6wwPtSD54nGxwQucK9pDvMg,4527
|
|
56
|
-
tests/test_base.py,sha256=aPdg9Oh9wdfcy3pFNyJplbJxwi7x8h2Mmj7jperqTu0,9009
|
|
57
|
-
tests/test_cache.py,sha256=lgcULExF1Nw4cjvujVvxub5CROqatf6TOkluUSVypIY,2562
|
|
58
|
-
tests/test_decorator.py,sha256=OMV2H6JjmGftdIFd5hgHBt80SF29AX8HtvvdyL8covg,3670
|
|
59
|
-
tests/test_executor.py,sha256=s03kTOJBtc8-idsoyCZcS5TGfT9PnioVmJuytKgkcIE,1071
|
|
60
|
-
tests/test_future.py,sha256=9UUFAh6eP1HFkLchprpcnBjKH7TETZr48k-WUt2PKGc,3433
|
|
61
|
-
tests/test_gather.py,sha256=cjl20RIGbLNMn8hhEw9hFQ7qjWpLHIXVDVrAm6H5u4w,1382
|
|
62
|
-
tests/test_helpers.py,sha256=68DBihIMqAIQLkAS89yutfDv3bPsrgIShad7JS6Bqv0,349
|
|
63
|
-
tests/test_iter.py,sha256=jUaRiZMbfOu3HbGPXnijI2C11uXqde62gcPGG71v6m4,8995
|
|
64
|
-
tests/test_limiter.py,sha256=3nyrikkThrTXrx_7J4gR9ZCNXTYIdrgkXF9Av_T1wqc,829
|
|
65
|
-
tests/test_meta.py,sha256=NZyt6tjzypSJO2byY8NuthCXi545SdSeSDp8KBUkp1Q,3663
|
|
66
|
-
tests/test_modified.py,sha256=_O0-HUJLCC4Ok12QtDjT1_OyLJYDgP0K3O0XhrZTGYs,250
|
|
67
|
-
tests/test_semaphore.py,sha256=8WxfS-0eSlrWyRi-x_-KopsGEp_9oX4TgH2QB1DOnCM,1666
|
|
68
|
-
tests/test_singleton.py,sha256=ANhe76xyBIyFzKQcEnSkJTUZICDgf1JGDIMEE4T6dt8,524
|
|
69
|
-
tests/test_task.py,sha256=KFnEFTeKHQHFQD_etxE5_VnfbnGJFsvfSitQ3Mj3U3Q,9616
|
|
70
|
-
ez_a_sync-0.22.15.dist-info/LICENSE.txt,sha256=1on6-17OUMlja6vSPTcmlmeT_DwujCZJijYxaplBvZk,1075
|
|
71
|
-
ez_a_sync-0.22.15.dist-info/METADATA,sha256=PKhUn0WI0kvWKVF2qfRPJKHdPkH7K3CErdT9KhMO8FM,533
|
|
72
|
-
ez_a_sync-0.22.15.dist-info/WHEEL,sha256=a7TGlA-5DaHMRrarXjVbQagU3Man_dCnGIWMJr5kRWo,91
|
|
73
|
-
ez_a_sync-0.22.15.dist-info/top_level.txt,sha256=GVK_7kp7dgBLeHp84iIQdsJmiXnrXd-5sIf2x0Q-VKc,13
|
|
74
|
-
ez_a_sync-0.22.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|