ez-a-sync 0.32.9__cp310-cp310-win32.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.

Files changed (177) hide show
  1. a_sync/ENVIRONMENT_VARIABLES.py +42 -0
  2. a_sync/__init__.pxd +2 -0
  3. a_sync/__init__.py +144 -0
  4. a_sync/_smart.c +22623 -0
  5. a_sync/_smart.cp310-win32.pyd +0 -0
  6. a_sync/_smart.pxd +2 -0
  7. a_sync/_smart.pyi +202 -0
  8. a_sync/_smart.pyx +652 -0
  9. a_sync/_typing.py +258 -0
  10. a_sync/a_sync/__init__.py +60 -0
  11. a_sync/a_sync/_descriptor.c +19745 -0
  12. a_sync/a_sync/_descriptor.cp310-win32.pyd +0 -0
  13. a_sync/a_sync/_descriptor.pyi +34 -0
  14. a_sync/a_sync/_descriptor.pyx +422 -0
  15. a_sync/a_sync/_flags.c +5687 -0
  16. a_sync/a_sync/_flags.cp310-win32.pyd +0 -0
  17. a_sync/a_sync/_flags.pxd +3 -0
  18. a_sync/a_sync/_flags.pyx +92 -0
  19. a_sync/a_sync/_helpers.c +13718 -0
  20. a_sync/a_sync/_helpers.cp310-win32.pyd +0 -0
  21. a_sync/a_sync/_helpers.pxd +3 -0
  22. a_sync/a_sync/_helpers.pyi +10 -0
  23. a_sync/a_sync/_helpers.pyx +167 -0
  24. a_sync/a_sync/_kwargs.c +10672 -0
  25. a_sync/a_sync/_kwargs.cp310-win32.pyd +0 -0
  26. a_sync/a_sync/_kwargs.pxd +2 -0
  27. a_sync/a_sync/_kwargs.pyx +64 -0
  28. a_sync/a_sync/_meta.py +210 -0
  29. a_sync/a_sync/abstract.c +11350 -0
  30. a_sync/a_sync/abstract.cp310-win32.pyd +0 -0
  31. a_sync/a_sync/abstract.pyi +141 -0
  32. a_sync/a_sync/abstract.pyx +221 -0
  33. a_sync/a_sync/base.c +14066 -0
  34. a_sync/a_sync/base.cp310-win32.pyd +0 -0
  35. a_sync/a_sync/base.pyi +60 -0
  36. a_sync/a_sync/base.pyx +271 -0
  37. a_sync/a_sync/config.py +168 -0
  38. a_sync/a_sync/decorator.py +562 -0
  39. a_sync/a_sync/flags.c +4471 -0
  40. a_sync/a_sync/flags.cp310-win32.pyd +0 -0
  41. a_sync/a_sync/flags.pxd +72 -0
  42. a_sync/a_sync/flags.pyi +74 -0
  43. a_sync/a_sync/flags.pyx +72 -0
  44. a_sync/a_sync/function.c +37747 -0
  45. a_sync/a_sync/function.cp310-win32.pyd +0 -0
  46. a_sync/a_sync/function.pxd +24 -0
  47. a_sync/a_sync/function.pyi +556 -0
  48. a_sync/a_sync/function.pyx +1363 -0
  49. a_sync/a_sync/method.c +28387 -0
  50. a_sync/a_sync/method.cp310-win32.pyd +0 -0
  51. a_sync/a_sync/method.pxd +2 -0
  52. a_sync/a_sync/method.pyi +524 -0
  53. a_sync/a_sync/method.pyx +999 -0
  54. a_sync/a_sync/modifiers/__init__.pxd +1 -0
  55. a_sync/a_sync/modifiers/__init__.py +101 -0
  56. a_sync/a_sync/modifiers/cache/__init__.py +160 -0
  57. a_sync/a_sync/modifiers/cache/memory.py +165 -0
  58. a_sync/a_sync/modifiers/limiter.py +132 -0
  59. a_sync/a_sync/modifiers/manager.c +15262 -0
  60. a_sync/a_sync/modifiers/manager.cp310-win32.pyd +0 -0
  61. a_sync/a_sync/modifiers/manager.pxd +5 -0
  62. a_sync/a_sync/modifiers/manager.pyi +219 -0
  63. a_sync/a_sync/modifiers/manager.pyx +296 -0
  64. a_sync/a_sync/modifiers/semaphores.py +173 -0
  65. a_sync/a_sync/property.c +27952 -0
  66. a_sync/a_sync/property.cp310-win32.pyd +0 -0
  67. a_sync/a_sync/property.pyi +376 -0
  68. a_sync/a_sync/property.pyx +813 -0
  69. a_sync/a_sync/singleton.py +63 -0
  70. a_sync/aliases.py +3 -0
  71. a_sync/async_property/__init__.pxd +1 -0
  72. a_sync/async_property/__init__.py +1 -0
  73. a_sync/async_property/cached.c +20542 -0
  74. a_sync/async_property/cached.cp310-win32.pyd +0 -0
  75. a_sync/async_property/cached.pxd +10 -0
  76. a_sync/async_property/cached.pyi +45 -0
  77. a_sync/async_property/cached.pyx +178 -0
  78. a_sync/async_property/proxy.c +36410 -0
  79. a_sync/async_property/proxy.cp310-win32.pyd +0 -0
  80. a_sync/async_property/proxy.pxd +2 -0
  81. a_sync/async_property/proxy.pyi +124 -0
  82. a_sync/async_property/proxy.pyx +474 -0
  83. a_sync/asyncio/__init__.pxd +6 -0
  84. a_sync/asyncio/__init__.py +164 -0
  85. a_sync/asyncio/as_completed.c +18198 -0
  86. a_sync/asyncio/as_completed.cp310-win32.pyd +0 -0
  87. a_sync/asyncio/as_completed.pxd +8 -0
  88. a_sync/asyncio/as_completed.pyi +109 -0
  89. a_sync/asyncio/as_completed.pyx +269 -0
  90. a_sync/asyncio/create_task.c +15032 -0
  91. a_sync/asyncio/create_task.cp310-win32.pyd +0 -0
  92. a_sync/asyncio/create_task.pxd +2 -0
  93. a_sync/asyncio/create_task.pyi +51 -0
  94. a_sync/asyncio/create_task.pyx +268 -0
  95. a_sync/asyncio/gather.c +15735 -0
  96. a_sync/asyncio/gather.cp310-win32.pyd +0 -0
  97. a_sync/asyncio/gather.pyi +107 -0
  98. a_sync/asyncio/gather.pyx +218 -0
  99. a_sync/asyncio/igather.c +12334 -0
  100. a_sync/asyncio/igather.cp310-win32.pyd +0 -0
  101. a_sync/asyncio/igather.pxd +1 -0
  102. a_sync/asyncio/igather.pyi +7 -0
  103. a_sync/asyncio/igather.pyx +175 -0
  104. a_sync/asyncio/sleep.c +8916 -0
  105. a_sync/asyncio/sleep.cp310-win32.pyd +0 -0
  106. a_sync/asyncio/sleep.pyi +14 -0
  107. a_sync/asyncio/sleep.pyx +49 -0
  108. a_sync/debugging.c +15156 -0
  109. a_sync/debugging.cp310-win32.pyd +0 -0
  110. a_sync/debugging.pyi +73 -0
  111. a_sync/debugging.pyx +107 -0
  112. a_sync/exceptions.c +12952 -0
  113. a_sync/exceptions.cp310-win32.pyd +0 -0
  114. a_sync/exceptions.pyi +376 -0
  115. a_sync/exceptions.pyx +443 -0
  116. a_sync/executor.py +575 -0
  117. a_sync/functools.c +11489 -0
  118. a_sync/functools.cp310-win32.pyd +0 -0
  119. a_sync/functools.pxd +7 -0
  120. a_sync/functools.pyi +33 -0
  121. a_sync/functools.pyx +139 -0
  122. a_sync/future.py +1497 -0
  123. a_sync/iter.c +37567 -0
  124. a_sync/iter.cp310-win32.pyd +0 -0
  125. a_sync/iter.pxd +9 -0
  126. a_sync/iter.pyi +366 -0
  127. a_sync/iter.pyx +981 -0
  128. a_sync/primitives/__init__.pxd +1 -0
  129. a_sync/primitives/__init__.py +53 -0
  130. a_sync/primitives/_debug.c +14737 -0
  131. a_sync/primitives/_debug.cp310-win32.pyd +0 -0
  132. a_sync/primitives/_debug.pxd +12 -0
  133. a_sync/primitives/_debug.pyi +52 -0
  134. a_sync/primitives/_debug.pyx +223 -0
  135. a_sync/primitives/_loggable.c +10569 -0
  136. a_sync/primitives/_loggable.cp310-win32.pyd +0 -0
  137. a_sync/primitives/_loggable.pxd +4 -0
  138. a_sync/primitives/_loggable.pyi +66 -0
  139. a_sync/primitives/_loggable.pyx +102 -0
  140. a_sync/primitives/locks/__init__.pxd +8 -0
  141. a_sync/primitives/locks/__init__.py +17 -0
  142. a_sync/primitives/locks/counter.c +16972 -0
  143. a_sync/primitives/locks/counter.cp310-win32.pyd +0 -0
  144. a_sync/primitives/locks/counter.pxd +12 -0
  145. a_sync/primitives/locks/counter.pyi +151 -0
  146. a_sync/primitives/locks/counter.pyx +260 -0
  147. a_sync/primitives/locks/event.c +16127 -0
  148. a_sync/primitives/locks/event.cp310-win32.pyd +0 -0
  149. a_sync/primitives/locks/event.pxd +22 -0
  150. a_sync/primitives/locks/event.pyi +43 -0
  151. a_sync/primitives/locks/event.pyx +183 -0
  152. a_sync/primitives/locks/prio_semaphore.c +24084 -0
  153. a_sync/primitives/locks/prio_semaphore.cp310-win32.pyd +0 -0
  154. a_sync/primitives/locks/prio_semaphore.pxd +24 -0
  155. a_sync/primitives/locks/prio_semaphore.pyi +217 -0
  156. a_sync/primitives/locks/prio_semaphore.pyx +554 -0
  157. a_sync/primitives/locks/semaphore.c +25816 -0
  158. a_sync/primitives/locks/semaphore.cp310-win32.pyd +0 -0
  159. a_sync/primitives/locks/semaphore.pxd +21 -0
  160. a_sync/primitives/locks/semaphore.pyi +196 -0
  161. a_sync/primitives/locks/semaphore.pyx +452 -0
  162. a_sync/primitives/queue.py +1018 -0
  163. a_sync/py.typed +0 -0
  164. a_sync/sphinx/__init__.py +3 -0
  165. a_sync/sphinx/ext.py +289 -0
  166. a_sync/task.py +916 -0
  167. a_sync/utils/__init__.py +105 -0
  168. a_sync/utils/iterators.py +297 -0
  169. a_sync/utils/repr.c +14354 -0
  170. a_sync/utils/repr.cp310-win32.pyd +0 -0
  171. a_sync/utils/repr.pyi +2 -0
  172. a_sync/utils/repr.pyx +73 -0
  173. ez_a_sync-0.32.9.dist-info/METADATA +367 -0
  174. ez_a_sync-0.32.9.dist-info/RECORD +177 -0
  175. ez_a_sync-0.32.9.dist-info/WHEEL +5 -0
  176. ez_a_sync-0.32.9.dist-info/licenses/LICENSE.txt +17 -0
  177. ez_a_sync-0.32.9.dist-info/top_level.txt +1 -0
Binary file
@@ -0,0 +1 @@
1
+ cdef object cigather(object coros_or_futures, bint return_exceptions=*)
@@ -0,0 +1,7 @@
1
+ from typing import Awaitable, Iterable, List, TypeVar
2
+
3
+ __T = TypeVar("__T")
4
+
5
+ def igather(
6
+ coros_or_futures: Iterable[Awaitable[__T]], return_exceptions: bool = False
7
+ ) -> Awaitable[List[__T]]: ...
@@ -0,0 +1,175 @@
1
+ import asyncio
2
+ from asyncio import futures, tasks
3
+ from typing import Awaitable, Iterable, List, TypeVar
4
+
5
+ from a_sync import _smart
6
+ from a_sync.a_sync._helpers cimport get_event_loop
7
+
8
+
9
+ __T = TypeVar("__T")
10
+
11
+
12
+ cdef object current_task = asyncio.current_task
13
+ cdef object ensure_future = asyncio.ensure_future
14
+ cdef object CancelledError = asyncio.CancelledError
15
+ cdef object _get_loop = futures._get_loop
16
+ cdef object _GatheringFuture = tasks._GatheringFuture
17
+
18
+ cdef object smart_task_factory = _smart.smart_task_factory
19
+
20
+
21
+ def igather(
22
+ coros_or_futures: Iterable[Awaitable[__T]], bint return_exceptions = False
23
+ ) -> Awaitable[List[__T]]:
24
+ """A clone of asyncio.gather that takes a single iterator of coroutines instead of an unpacked tuple."""
25
+ return cigather(coros_or_futures, return_exceptions=return_exceptions)
26
+
27
+
28
+ cdef object cigather(object coros_or_futures, bint return_exceptions = False):
29
+ """A clone of asyncio.gather that takes a single iterator of coroutines instead of an unpacked tuple."""
30
+ # NOTE: closures inside cpdef functions not yet supported, so we have this cdef helper
31
+ cdef long long nfuts, nfinished
32
+ cdef dict arg_to_fut = {}
33
+ cdef list children = []
34
+ loop = None
35
+ for arg in coros_or_futures:
36
+ if arg not in arg_to_fut:
37
+ fut = ensure_future(arg, loop=loop)
38
+ if loop is None:
39
+ loop = _get_loop(fut)
40
+ if fut is not arg:
41
+ # 'arg' was not a Future, therefore, 'fut' is a new
42
+ # Future created specifically for 'arg'. Since the caller
43
+ # can't control it, disable the "destroy pending task"
44
+ # warning.
45
+ fut._log_destroy_pending = False
46
+
47
+ arg_to_fut[arg] = fut
48
+
49
+ else:
50
+ # There's a duplicate Future object in coros_or_futures.
51
+ fut = arg_to_fut[arg]
52
+
53
+ children.append(fut)
54
+
55
+ if not children:
56
+ return _get_empty_result_set_fut(get_event_loop())
57
+
58
+ nfuts = len(arg_to_fut)
59
+ nfinished = 0
60
+ outer = None # bpo-46672
61
+
62
+ if return_exceptions:
63
+
64
+ def _done_callback(fut: asyncio.Future) -> None:
65
+ # for some reason this wouldn't work until I added `return_exceptions=return_exceptions` to the func def
66
+ nonlocal nfinished
67
+ nfinished += 1
68
+
69
+ if outer is None or outer.done():
70
+ if not fut.cancelled():
71
+ # Mark exception retrieved.
72
+ fut.exception()
73
+ return
74
+
75
+ if nfinished == nfuts:
76
+ # All futures are done; create a list of results
77
+ # and set it to the 'outer' future.
78
+
79
+ if outer._cancel_requested:
80
+ # If gather is being cancelled we must propagate the
81
+ # cancellation regardless of *return_exceptions* argument.
82
+ # See issue 32684.
83
+ try:
84
+ exc = fut._make_cancelled_error()
85
+ except AttributeError:
86
+ exc = CancelledError()
87
+ outer.set_exception(exc)
88
+ else:
89
+ outer.set_result([_get_result_or_exc(child) for child in children])
90
+
91
+ else:
92
+
93
+ def _done_callback(fut: asyncio.Future) -> None:
94
+ # for some reason this wouldn't work until I added `return_exceptions=return_exceptions` to the func def
95
+ nonlocal nfinished
96
+ nfinished += 1
97
+
98
+ if outer is None or outer.done():
99
+ if not fut.cancelled():
100
+ # Mark exception retrieved.
101
+ fut.exception()
102
+ return
103
+
104
+ if fut.cancelled():
105
+ # Check if 'fut' is cancelled first, as
106
+ # 'fut.exception()' will *raise* a CancelledError
107
+ # instead of returning it.
108
+ try:
109
+ exc = fut._make_cancelled_error()
110
+ except AttributeError:
111
+ exc = CancelledError()
112
+ outer.set_exception(exc)
113
+ return
114
+ else:
115
+ exc = fut.exception()
116
+ if exc is not None:
117
+ outer.set_exception(exc)
118
+ return
119
+
120
+ if nfinished == nfuts:
121
+ # All futures are done; create a list of results
122
+ # and set it to the 'outer' future.
123
+
124
+ if outer._cancel_requested:
125
+ # If gather is being cancelled we must propagate the
126
+ # cancellation regardless of *return_exceptions* argument.
127
+ # See issue 32684.
128
+ try:
129
+ exc = fut._make_cancelled_error()
130
+ except AttributeError:
131
+ exc = CancelledError()
132
+ outer.set_exception(exc)
133
+ else:
134
+ outer.set_result([_get_result_or_exc(child) for child in children])
135
+
136
+ if loop._task_factory is smart_task_factory:
137
+ current = current_task()
138
+ for fut in arg_to_fut.values():
139
+ fut.add_done_callback(_done_callback)
140
+ waiters = getattr(fut, "_waiters", None)
141
+ if waiters is not None:
142
+ waiters.add(current)
143
+ else:
144
+ for fut in arg_to_fut.values():
145
+ fut.add_done_callback(_done_callback)
146
+
147
+ outer = _GatheringFuture(children, loop=loop)
148
+
149
+ return outer
150
+
151
+
152
+ cdef dict[object, object] _no_results_futs = {}
153
+
154
+
155
+ cdef object _get_empty_result_set_fut(loop):
156
+ fut = _no_results_futs.get(loop)
157
+ if fut is None:
158
+ fut = _no_results_futs[loop] = loop.create_future()
159
+ fut.set_result([])
160
+ return fut
161
+
162
+
163
+ cdef object _get_result_or_exc(fut: asyncio.Future):
164
+ if fut.cancelled():
165
+ # Check if 'fut' is cancelled first, as 'fut.exception()'
166
+ # will *raise* a CancelledError instead of returning it.
167
+ # Also, since we're adding the exception return value
168
+ # to 'results' instead of raising it, don't bother
169
+ # setting __context__. This also lets us preserve
170
+ # calling '_make_cancelled_error()' at most once.
171
+ return CancelledError("" if fut._cancel_message is None else fut._cancel_message)
172
+ res = fut.exception()
173
+ if res is None:
174
+ return fut.result()
175
+ return res