ez-a-sync 0.32.29__cp310-cp310-win_amd64.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 +42 -0
- a_sync/__init__.pxd +2 -0
- a_sync/__init__.py +145 -0
- a_sync/_smart.c +22803 -0
- a_sync/_smart.cp310-win_amd64.pyd +0 -0
- a_sync/_smart.pxd +2 -0
- a_sync/_smart.pyi +202 -0
- a_sync/_smart.pyx +674 -0
- a_sync/_typing.py +258 -0
- a_sync/a_sync/__init__.py +60 -0
- a_sync/a_sync/_descriptor.c +20528 -0
- a_sync/a_sync/_descriptor.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/_descriptor.pyi +33 -0
- a_sync/a_sync/_descriptor.pyx +422 -0
- a_sync/a_sync/_flags.c +6074 -0
- a_sync/a_sync/_flags.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/_flags.pxd +3 -0
- a_sync/a_sync/_flags.pyx +92 -0
- a_sync/a_sync/_helpers.c +14521 -0
- a_sync/a_sync/_helpers.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/_helpers.pxd +3 -0
- a_sync/a_sync/_helpers.pyi +10 -0
- a_sync/a_sync/_helpers.pyx +167 -0
- a_sync/a_sync/_kwargs.c +12194 -0
- a_sync/a_sync/_kwargs.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/_kwargs.pxd +2 -0
- a_sync/a_sync/_kwargs.pyx +64 -0
- a_sync/a_sync/_meta.py +210 -0
- a_sync/a_sync/abstract.c +12411 -0
- a_sync/a_sync/abstract.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/abstract.pyi +141 -0
- a_sync/a_sync/abstract.pyx +221 -0
- a_sync/a_sync/base.c +14932 -0
- a_sync/a_sync/base.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/base.pyi +60 -0
- a_sync/a_sync/base.pyx +271 -0
- a_sync/a_sync/config.py +168 -0
- a_sync/a_sync/decorator.py +651 -0
- a_sync/a_sync/flags.c +5272 -0
- a_sync/a_sync/flags.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/flags.pxd +72 -0
- a_sync/a_sync/flags.pyi +74 -0
- a_sync/a_sync/flags.pyx +72 -0
- a_sync/a_sync/function.c +37846 -0
- a_sync/a_sync/function.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/function.pxd +28 -0
- a_sync/a_sync/function.pyi +571 -0
- a_sync/a_sync/function.pyx +1381 -0
- a_sync/a_sync/method.c +29774 -0
- a_sync/a_sync/method.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/method.pxd +9 -0
- a_sync/a_sync/method.pyi +525 -0
- a_sync/a_sync/method.pyx +1023 -0
- a_sync/a_sync/modifiers/__init__.pxd +1 -0
- a_sync/a_sync/modifiers/__init__.py +101 -0
- a_sync/a_sync/modifiers/cache/__init__.py +160 -0
- a_sync/a_sync/modifiers/cache/memory.py +165 -0
- a_sync/a_sync/modifiers/limiter.py +132 -0
- a_sync/a_sync/modifiers/manager.c +16149 -0
- a_sync/a_sync/modifiers/manager.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/modifiers/manager.pxd +5 -0
- a_sync/a_sync/modifiers/manager.pyi +219 -0
- a_sync/a_sync/modifiers/manager.pyx +299 -0
- a_sync/a_sync/modifiers/semaphores.py +173 -0
- a_sync/a_sync/property.c +27260 -0
- a_sync/a_sync/property.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/property.pyi +376 -0
- a_sync/a_sync/property.pyx +819 -0
- a_sync/a_sync/singleton.py +63 -0
- a_sync/aliases.py +3 -0
- a_sync/async_property/__init__.pxd +1 -0
- a_sync/async_property/__init__.py +1 -0
- a_sync/async_property/cached.c +20386 -0
- a_sync/async_property/cached.cp310-win_amd64.pyd +0 -0
- a_sync/async_property/cached.pxd +10 -0
- a_sync/async_property/cached.pyi +45 -0
- a_sync/async_property/cached.pyx +178 -0
- a_sync/async_property/proxy.c +34654 -0
- a_sync/async_property/proxy.cp310-win_amd64.pyd +0 -0
- a_sync/async_property/proxy.pxd +2 -0
- a_sync/async_property/proxy.pyi +124 -0
- a_sync/async_property/proxy.pyx +474 -0
- a_sync/asyncio/__init__.pxd +6 -0
- a_sync/asyncio/__init__.py +164 -0
- a_sync/asyncio/as_completed.c +18841 -0
- a_sync/asyncio/as_completed.cp310-win_amd64.pyd +0 -0
- a_sync/asyncio/as_completed.pxd +8 -0
- a_sync/asyncio/as_completed.pyi +109 -0
- a_sync/asyncio/as_completed.pyx +269 -0
- a_sync/asyncio/create_task.c +15902 -0
- a_sync/asyncio/create_task.cp310-win_amd64.pyd +0 -0
- a_sync/asyncio/create_task.pxd +2 -0
- a_sync/asyncio/create_task.pyi +51 -0
- a_sync/asyncio/create_task.pyx +271 -0
- a_sync/asyncio/gather.c +16679 -0
- a_sync/asyncio/gather.cp310-win_amd64.pyd +0 -0
- a_sync/asyncio/gather.pyi +107 -0
- a_sync/asyncio/gather.pyx +218 -0
- a_sync/asyncio/igather.c +12676 -0
- a_sync/asyncio/igather.cp310-win_amd64.pyd +0 -0
- a_sync/asyncio/igather.pxd +1 -0
- a_sync/asyncio/igather.pyi +7 -0
- a_sync/asyncio/igather.pyx +182 -0
- a_sync/asyncio/sleep.c +9593 -0
- a_sync/asyncio/sleep.cp310-win_amd64.pyd +0 -0
- a_sync/asyncio/sleep.pyi +14 -0
- a_sync/asyncio/sleep.pyx +49 -0
- a_sync/debugging.c +15362 -0
- a_sync/debugging.cp310-win_amd64.pyd +0 -0
- a_sync/debugging.pyi +76 -0
- a_sync/debugging.pyx +107 -0
- a_sync/exceptions.c +13312 -0
- a_sync/exceptions.cp310-win_amd64.pyd +0 -0
- a_sync/exceptions.pyi +376 -0
- a_sync/exceptions.pyx +446 -0
- a_sync/executor.py +619 -0
- a_sync/functools.c +12738 -0
- a_sync/functools.cp310-win_amd64.pyd +0 -0
- a_sync/functools.pxd +7 -0
- a_sync/functools.pyi +33 -0
- a_sync/functools.pyx +139 -0
- a_sync/future.py +1497 -0
- a_sync/iter.c +37271 -0
- a_sync/iter.cp310-win_amd64.pyd +0 -0
- a_sync/iter.pxd +11 -0
- a_sync/iter.pyi +370 -0
- a_sync/iter.pyx +981 -0
- a_sync/primitives/__init__.pxd +1 -0
- a_sync/primitives/__init__.py +53 -0
- a_sync/primitives/_debug.c +15757 -0
- a_sync/primitives/_debug.cp310-win_amd64.pyd +0 -0
- a_sync/primitives/_debug.pxd +12 -0
- a_sync/primitives/_debug.pyi +52 -0
- a_sync/primitives/_debug.pyx +223 -0
- a_sync/primitives/_loggable.c +11529 -0
- a_sync/primitives/_loggable.cp310-win_amd64.pyd +0 -0
- a_sync/primitives/_loggable.pxd +4 -0
- a_sync/primitives/_loggable.pyi +66 -0
- a_sync/primitives/_loggable.pyx +102 -0
- a_sync/primitives/locks/__init__.pxd +8 -0
- a_sync/primitives/locks/__init__.py +17 -0
- a_sync/primitives/locks/counter.c +17679 -0
- a_sync/primitives/locks/counter.cp310-win_amd64.pyd +0 -0
- a_sync/primitives/locks/counter.pxd +12 -0
- a_sync/primitives/locks/counter.pyi +151 -0
- a_sync/primitives/locks/counter.pyx +260 -0
- a_sync/primitives/locks/event.c +17063 -0
- a_sync/primitives/locks/event.cp310-win_amd64.pyd +0 -0
- a_sync/primitives/locks/event.pxd +22 -0
- a_sync/primitives/locks/event.pyi +43 -0
- a_sync/primitives/locks/event.pyx +185 -0
- a_sync/primitives/locks/prio_semaphore.c +25590 -0
- a_sync/primitives/locks/prio_semaphore.cp310-win_amd64.pyd +0 -0
- a_sync/primitives/locks/prio_semaphore.pxd +25 -0
- a_sync/primitives/locks/prio_semaphore.pyi +217 -0
- a_sync/primitives/locks/prio_semaphore.pyx +597 -0
- a_sync/primitives/locks/semaphore.c +26509 -0
- a_sync/primitives/locks/semaphore.cp310-win_amd64.pyd +0 -0
- a_sync/primitives/locks/semaphore.pxd +21 -0
- a_sync/primitives/locks/semaphore.pyi +197 -0
- a_sync/primitives/locks/semaphore.pyx +454 -0
- a_sync/primitives/queue.py +1022 -0
- a_sync/py.typed +0 -0
- a_sync/sphinx/__init__.py +3 -0
- a_sync/sphinx/ext.py +289 -0
- a_sync/task.py +932 -0
- a_sync/utils/__init__.py +105 -0
- a_sync/utils/iterators.py +297 -0
- a_sync/utils/repr.c +15799 -0
- a_sync/utils/repr.cp310-win_amd64.pyd +0 -0
- a_sync/utils/repr.pyi +2 -0
- a_sync/utils/repr.pyx +73 -0
- ez_a_sync-0.32.29.dist-info/METADATA +367 -0
- ez_a_sync-0.32.29.dist-info/RECORD +177 -0
- ez_a_sync-0.32.29.dist-info/WHEEL +5 -0
- ez_a_sync-0.32.29.dist-info/licenses/LICENSE.txt +17 -0
- ez_a_sync-0.32.29.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This package provides custom utilities and extensions to the built-in `asyncio` package.
|
|
3
|
+
|
|
4
|
+
These utilities include enhanced versions of common asyncio functions, offering additional
|
|
5
|
+
features and improved functionality for asynchronous programming.
|
|
6
|
+
|
|
7
|
+
Modules:
|
|
8
|
+
- :func:`create_task`: Extends `asyncio.create_task` to support any `Awaitable`, manage task lifecycle, and enhance error handling.
|
|
9
|
+
- :func:`gather`: Provides an enhanced version of `asyncio.gather` with additional features like progress reporting and exclusion of results based on a condition.
|
|
10
|
+
- :func:`as_completed`: Extends `asyncio.as_completed` with additional functionality such as progress reporting using `tqdm`.
|
|
11
|
+
- :func:`get_event_loop`: Utility to get the current event loop, creating a new one if none exists.
|
|
12
|
+
|
|
13
|
+
See Also:
|
|
14
|
+
- `asyncio <https://docs.python.org/3/library/asyncio.html>`_: The standard asyncio library documentation for more details on the original functions.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from a_sync.a_sync._helpers import get_event_loop
|
|
18
|
+
from a_sync.asyncio.create_task import create_task
|
|
19
|
+
from a_sync.asyncio.as_completed import as_completed
|
|
20
|
+
from a_sync.asyncio.igather import igather
|
|
21
|
+
from a_sync.asyncio.gather import gather, cgather
|
|
22
|
+
from a_sync.asyncio.sleep import sleep0
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"create_task",
|
|
26
|
+
"gather",
|
|
27
|
+
"cgather",
|
|
28
|
+
"igather",
|
|
29
|
+
"as_completed",
|
|
30
|
+
"get_event_loop",
|
|
31
|
+
"sleep0",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# Function: create_task
|
|
36
|
+
"""
|
|
37
|
+
Extends `asyncio.create_task` to support any `Awaitable`, manage task lifecycle, and enhance error handling.
|
|
38
|
+
|
|
39
|
+
This function accepts any `Awaitable`, ensuring broader compatibility. If the `Awaitable` is not a coroutine,
|
|
40
|
+
it attempts to convert it to one. It optionally prevents the task from being garbage-collected until completion
|
|
41
|
+
and provides enhanced error management by wrapping exceptions in a custom exception when `skip_gc_until_done` is True.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
coro: An `Awaitable` object from which to create the task. If not a coroutine, it will be converted.
|
|
45
|
+
name: Optional name for the task, aiding in debugging.
|
|
46
|
+
skip_gc_until_done: If True, the task is kept alive until it completes, preventing garbage collection.
|
|
47
|
+
Exceptions are wrapped in `PersistedTaskException` for special handling.
|
|
48
|
+
log_destroy_pending: If False, asyncio's default error log when a pending task is destroyed is suppressed.
|
|
49
|
+
|
|
50
|
+
Examples:
|
|
51
|
+
Basic usage:
|
|
52
|
+
```
|
|
53
|
+
task = create_task(some_coroutine())
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
With options:
|
|
57
|
+
```
|
|
58
|
+
task = create_task(some_coroutine(), name="MyTask", skip_gc_until_done=True)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
See Also:
|
|
62
|
+
- :func:`asyncio.create_task`: The original asyncio function.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# Function: gather
|
|
67
|
+
"""
|
|
68
|
+
Provides an enhanced version of :func:`asyncio.gather`.
|
|
69
|
+
|
|
70
|
+
This function extends Python's `asyncio.gather`, providing additional features for handling either individual awaitable objects or a mapping of awaitables.
|
|
71
|
+
|
|
72
|
+
Differences from `asyncio.gather`:
|
|
73
|
+
- Uses type hints for use with static type checkers.
|
|
74
|
+
- Supports gathering either individual awaitables or a k:v mapping of awaitables.
|
|
75
|
+
- Provides progress reporting using `tqdm` if 'tqdm' is set to True.
|
|
76
|
+
- Allows exclusion of results based on a condition using the 'exclude_if' parameter.
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
*awaitables: The awaitables to await concurrently. It can be a list of individual awaitables or a mapping of awaitables.
|
|
80
|
+
return_exceptions: If True, exceptions are returned as results instead of raising them. Defaults to False.
|
|
81
|
+
exclude_if: A callable that takes a result and returns True if the result should be excluded from the final output. Defaults to None.
|
|
82
|
+
tqdm: If True, enables progress reporting using `tqdm`. Defaults to False.
|
|
83
|
+
**tqdm_kwargs: Additional keyword arguments for `tqdm` if progress reporting is enabled.
|
|
84
|
+
|
|
85
|
+
Examples:
|
|
86
|
+
Awaiting individual awaitables:
|
|
87
|
+
```
|
|
88
|
+
results = await gather(thing1(), thing2())
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Awaiting a mapping of awaitables:
|
|
92
|
+
```
|
|
93
|
+
mapping = {'key1': thing1(), 'key2': thing2()}
|
|
94
|
+
results = await gather(mapping)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
See Also:
|
|
98
|
+
- :func:`asyncio.gather`: The original asyncio function.
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# Function: as_completed
|
|
103
|
+
"""
|
|
104
|
+
Extends Python's :func:`asyncio.as_completed` with additional functionality.
|
|
105
|
+
|
|
106
|
+
This function extends Python's `asyncio.as_completed`, providing additional features for mixed use cases of individual awaitable objects and mappings of awaitables.
|
|
107
|
+
|
|
108
|
+
Differences from `asyncio.as_completed`:
|
|
109
|
+
- Uses type hints for use with static type checkers.
|
|
110
|
+
- Supports either individual awaitables or a k:v mapping of awaitables.
|
|
111
|
+
- Can be used as an async iterator which yields the result values.
|
|
112
|
+
- Provides progress reporting using `tqdm` if 'tqdm' is set to True.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
fs: The awaitables to await concurrently. It can be a list of individual awaitables or a mapping of awaitables.
|
|
116
|
+
timeout: The maximum time, in seconds, to wait for the completion of awaitables. Defaults to None (no timeout).
|
|
117
|
+
return_exceptions: If True, exceptions are returned as results instead of raising them. Defaults to False.
|
|
118
|
+
aiter: If True, returns an async iterator of results. Defaults to False.
|
|
119
|
+
tqdm: If True, enables progress reporting using `tqdm`. Defaults to False.
|
|
120
|
+
**tqdm_kwargs: Additional keyword arguments for `tqdm` if progress reporting is enabled.
|
|
121
|
+
|
|
122
|
+
Examples:
|
|
123
|
+
Awaiting individual awaitables:
|
|
124
|
+
```
|
|
125
|
+
awaitables = [async_function1(), async_function2()]
|
|
126
|
+
for coro in as_completed(awaitables):
|
|
127
|
+
val = await coro
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Awaiting mappings of awaitables:
|
|
131
|
+
```
|
|
132
|
+
mapping = {'key1': async_function1(), 'key2': async_function2()}
|
|
133
|
+
for coro in as_completed(mapping):
|
|
134
|
+
k, v = await coro
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
See Also:
|
|
138
|
+
- :func:`asyncio.as_completed`: The original asyncio function.
|
|
139
|
+
"""
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
# Function: get_event_loop
|
|
143
|
+
"""
|
|
144
|
+
Utility to get the current event loop, creating a new one if none exists.
|
|
145
|
+
|
|
146
|
+
This function attempts to get the current event loop. If no event loop is found (which can occur in multi-threaded applications), it creates a new event loop and sets it as the current event loop.
|
|
147
|
+
|
|
148
|
+
Examples:
|
|
149
|
+
Basic usage:
|
|
150
|
+
```
|
|
151
|
+
loop = get_event_loop()
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Handling in multi-threaded applications:
|
|
155
|
+
```
|
|
156
|
+
try:
|
|
157
|
+
loop = get_event_loop()
|
|
158
|
+
except RuntimeError:
|
|
159
|
+
print("No current event loop found.")
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
See Also:
|
|
163
|
+
- :func:`asyncio.get_event_loop`: The original asyncio function.
|
|
164
|
+
"""
|