ez-a-sync 0.32.29__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 +145 -0
  4. a_sync/_smart.c +22803 -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 +674 -0
  9. a_sync/_typing.py +258 -0
  10. a_sync/a_sync/__init__.py +60 -0
  11. a_sync/a_sync/_descriptor.c +20528 -0
  12. a_sync/a_sync/_descriptor.cp310-win32.pyd +0 -0
  13. a_sync/a_sync/_descriptor.pyi +33 -0
  14. a_sync/a_sync/_descriptor.pyx +422 -0
  15. a_sync/a_sync/_flags.c +6074 -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 +14521 -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 +12194 -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 +12411 -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 +14932 -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 +651 -0
  39. a_sync/a_sync/flags.c +5272 -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 +37846 -0
  45. a_sync/a_sync/function.cp310-win32.pyd +0 -0
  46. a_sync/a_sync/function.pxd +28 -0
  47. a_sync/a_sync/function.pyi +571 -0
  48. a_sync/a_sync/function.pyx +1381 -0
  49. a_sync/a_sync/method.c +29774 -0
  50. a_sync/a_sync/method.cp310-win32.pyd +0 -0
  51. a_sync/a_sync/method.pxd +9 -0
  52. a_sync/a_sync/method.pyi +525 -0
  53. a_sync/a_sync/method.pyx +1023 -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 +16149 -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 +299 -0
  64. a_sync/a_sync/modifiers/semaphores.py +173 -0
  65. a_sync/a_sync/property.c +27260 -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 +819 -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 +20386 -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 +34654 -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 +18841 -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 +15902 -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 +271 -0
  95. a_sync/asyncio/gather.c +16679 -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 +12676 -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 +182 -0
  104. a_sync/asyncio/sleep.c +9593 -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 +15362 -0
  109. a_sync/debugging.cp310-win32.pyd +0 -0
  110. a_sync/debugging.pyi +76 -0
  111. a_sync/debugging.pyx +107 -0
  112. a_sync/exceptions.c +13312 -0
  113. a_sync/exceptions.cp310-win32.pyd +0 -0
  114. a_sync/exceptions.pyi +376 -0
  115. a_sync/exceptions.pyx +446 -0
  116. a_sync/executor.py +619 -0
  117. a_sync/functools.c +12738 -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 +37271 -0
  124. a_sync/iter.cp310-win32.pyd +0 -0
  125. a_sync/iter.pxd +11 -0
  126. a_sync/iter.pyi +370 -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 +15757 -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 +11529 -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 +17679 -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 +17063 -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 +185 -0
  152. a_sync/primitives/locks/prio_semaphore.c +25590 -0
  153. a_sync/primitives/locks/prio_semaphore.cp310-win32.pyd +0 -0
  154. a_sync/primitives/locks/prio_semaphore.pxd +25 -0
  155. a_sync/primitives/locks/prio_semaphore.pyi +217 -0
  156. a_sync/primitives/locks/prio_semaphore.pyx +597 -0
  157. a_sync/primitives/locks/semaphore.c +26509 -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 +197 -0
  161. a_sync/primitives/locks/semaphore.pyx +454 -0
  162. a_sync/primitives/queue.py +1022 -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 +932 -0
  167. a_sync/utils/__init__.py +105 -0
  168. a_sync/utils/iterators.py +297 -0
  169. a_sync/utils/repr.c +15799 -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.29.dist-info/METADATA +367 -0
  174. ez_a_sync-0.32.29.dist-info/RECORD +177 -0
  175. ez_a_sync-0.32.29.dist-info/WHEEL +5 -0
  176. ez_a_sync-0.32.29.dist-info/licenses/LICENSE.txt +17 -0
  177. ez_a_sync-0.32.29.dist-info/top_level.txt +1 -0
Binary file
@@ -0,0 +1,28 @@
1
+ from a_sync.a_sync.modifiers.manager cimport ModifierManager
2
+
3
+ cdef class _ModifiedMixin:
4
+ cdef readonly ModifierManager modifiers
5
+ cdef public object __wrapped__
6
+ cdef object _asyncify(self, object func)
7
+
8
+ cdef str __default
9
+ cdef object __await
10
+ cdef str get_default(self)
11
+ cdef object get_await(self)
12
+
13
+ cdef class _ASyncFunction(_ModifiedMixin):
14
+ cdef readonly object _fn
15
+ cdef bint __sync_default
16
+ cdef bint __sync_default_cached
17
+ cdef bint __async_def
18
+ cdef bint __async_def_cached
19
+ cdef object __asyncified
20
+ cdef object __modified_fn
21
+ cdef object __async_wrap
22
+ cdef object __sync_wrap
23
+ cdef object get_fn(self)
24
+ cpdef bint is_async_def(self)
25
+ cpdef bint is_sync_default(self)
26
+ cdef inline bint _run_sync(self, dict kwargs)
27
+
28
+ cdef void _validate_wrapped_fn(object fn)
@@ -0,0 +1,571 @@
1
+ import functools
2
+ from logging import Logger
3
+ from typing import Any
4
+ from a_sync import TaskMapping
5
+ from a_sync._typing import *
6
+ from a_sync.a_sync.method import (
7
+ ASyncBoundMethod,
8
+ ASyncBoundMethodAsyncDefault,
9
+ ASyncBoundMethodSyncDefault,
10
+ )
11
+ from a_sync.a_sync.modifiers.manager import ModifierManager
12
+
13
+ logger: Logger
14
+
15
+ class _ModifiedMixin:
16
+ """
17
+ A mixin class for internal use that provides functionality for applying modifiers to functions.
18
+
19
+ This class is used as a base for :class:`~ASyncFunction` and its variants, such as
20
+ `ASyncFunctionAsyncDefault` and `ASyncFunctionSyncDefault`, to handle the application
21
+ of async and sync modifiers to functions. Modifiers can alter the behavior of functions,
22
+ such as converting sync functions to async, applying caching, or rate limiting.
23
+
24
+ See Also:
25
+ - :class:`~ASyncFunction`
26
+ - :class:`~ModifierManager`
27
+ """
28
+
29
+ modifiers: ModifierManager
30
+ @functools.cached_property
31
+ def default(self) -> DefaultMode:
32
+ """
33
+ Gets the default execution mode (sync, async, or None) for the function.
34
+
35
+ Returns:
36
+ The default execution mode.
37
+
38
+ See Also:
39
+ - :attr:`ModifierManager.default`
40
+ """
41
+
42
+ class ASyncFunction(_ModifiedMixin, Generic[P, T]):
43
+ """
44
+ A callable wrapper object that can be executed both synchronously and asynchronously.
45
+
46
+ This class wraps a function or coroutine function, allowing it to be called in both
47
+ synchronous and asynchronous contexts. It provides a flexible interface for handling
48
+ different execution modes and applying various modifiers to the function\'s behavior.
49
+
50
+ The class supports various modifiers that can alter the behavior of the function,
51
+ such as caching, rate limiting, and execution in specific contexts (e.g., thread pools).
52
+
53
+ Note:
54
+ The logic for determining whether to execute the function synchronously or asynchronously
55
+ is handled by the `self.fn` property, which checks for flags in the `kwargs` and defers
56
+ to the default execution mode if no flags are specified.
57
+
58
+ Example:
59
+ async def my_coroutine(x: int) -> str:
60
+ return str(x)
61
+
62
+ func = ASyncFunction(my_coroutine)
63
+
64
+ # Synchronous call
65
+ result = func(5, sync=True) # returns "5"
66
+
67
+ # Asynchronous call
68
+ result = await func(5) # returns "5"
69
+
70
+ See Also:
71
+ - :class:`_ModifiedMixin`
72
+ - :class:`ModifierManager`
73
+ """
74
+
75
+ @overload
76
+ def __init__(self, fn: CoroFn[P, T], **modifiers: Unpack[ModifierKwargs]) -> None:
77
+ """
78
+ Initializes an ASyncFunction instance for a coroutine function.
79
+
80
+ Args:
81
+ fn: The coroutine function to wrap.
82
+ **modifiers: Keyword arguments for function modifiers.
83
+
84
+ Example:
85
+ async def my_coroutine(x: int) -> str:
86
+ return str(x)
87
+
88
+ func = ASyncFunction(my_coroutine, cache_type='memory')
89
+ """
90
+
91
+ @overload
92
+ def __init__(self, fn: SyncFn[P, T], **modifiers: Unpack[ModifierKwargs]) -> None:
93
+ """
94
+ Initializes an ASyncFunction instance for a synchronous function.
95
+
96
+ Args:
97
+ fn: The synchronous function to wrap.
98
+ **modifiers: Keyword arguments for function modifiers.
99
+
100
+ Example:
101
+ def my_function(x: int) -> str:
102
+ return str(x)
103
+
104
+ func = ASyncFunction(my_function, runs_per_minute=60)
105
+ """
106
+
107
+ @overload
108
+ def __call__(self, *args: P.args, sync: Literal[True], **kwargs: P.kwargs) -> T:
109
+ """
110
+ Calls the wrapped function synchronously.
111
+
112
+ Args:
113
+ *args: Positional arguments to pass to the wrapped function.
114
+ sync: Must be True to indicate synchronous execution.
115
+ **kwargs: Keyword arguments to pass to the wrapped function.
116
+
117
+ Example:
118
+ result = func(5, sync=True)
119
+ """
120
+
121
+ @overload
122
+ def __call__(
123
+ self, *args: P.args, sync: Literal[False], **kwargs: P.kwargs
124
+ ) -> Coroutine[Any, Any, T]:
125
+ """
126
+ Calls the wrapped function asynchronously.
127
+
128
+ Args:
129
+ *args: Positional arguments to pass to the wrapped function.
130
+ sync: Must be False to indicate asynchronous execution.
131
+ **kwargs: Keyword arguments to pass to the wrapped function.
132
+
133
+ Example:
134
+ result = await func(5, sync=False)
135
+ """
136
+
137
+ @overload
138
+ def __call__(self, *args: P.args, asynchronous: Literal[False], **kwargs: P.kwargs) -> T:
139
+ """
140
+ Calls the wrapped function synchronously.
141
+
142
+ Args:
143
+ *args: Positional arguments to pass to the wrapped function.
144
+ asynchronous: Must be False to indicate synchronous execution.
145
+ **kwargs: Keyword arguments to pass to the wrapped function.
146
+
147
+ Example:
148
+ result = func(5, asynchronous=False)
149
+ """
150
+
151
+ @overload
152
+ def __call__(
153
+ self, *args: P.args, asynchronous: Literal[True], **kwargs: P.kwargs
154
+ ) -> Coroutine[Any, Any, T]:
155
+ """
156
+ Calls the wrapped function asynchronously.
157
+
158
+ Args:
159
+ *args: Positional arguments to pass to the wrapped function.
160
+ asynchronous: Must be True to indicate asynchronous execution.
161
+ **kwargs: Keyword arguments to pass to the wrapped function.
162
+
163
+ Example:
164
+ result = await func(5, asynchronous=True)
165
+ """
166
+
167
+ @overload
168
+ def __call__(self, *args: P.args, **kwargs: P.kwargs) -> MaybeCoro[T]:
169
+ """
170
+ Calls the wrapped function using the default execution mode.
171
+
172
+ Args:
173
+ *args: Positional arguments to pass to the wrapped function.
174
+ **kwargs: Keyword arguments to pass to the wrapped function.
175
+
176
+ Example:
177
+ result = func(5)
178
+ """
179
+
180
+ @functools.cached_property
181
+ def fn(self):
182
+ """
183
+ Returns the final wrapped version of :attr:`ASyncFunction._fn` decorated with all of the a_sync goodness.
184
+
185
+ Returns:
186
+ The final wrapped function.
187
+
188
+ See Also:
189
+ - :meth:`_async_wrap`
190
+ - :meth:`_sync_wrap`
191
+ """
192
+
193
+ def map(
194
+ self,
195
+ *iterables: AnyIterable[P.args],
196
+ concurrency: Optional[int] = None,
197
+ task_name: str = "",
198
+ **function_kwargs: P.kwargs
199
+ ) -> TaskMapping[P, T]:
200
+ """
201
+ Creates a TaskMapping for the wrapped function with the given iterables.
202
+
203
+ Args:
204
+ *iterables: Iterable objects to be used as arguments for the function.
205
+ concurrency: Optional maximum number of concurrent tasks.
206
+ task_name: Optional name for the tasks.
207
+ **function_kwargs: Additional keyword arguments to pass to the function.
208
+
209
+ Returns:
210
+ A TaskMapping object for managing concurrent execution.
211
+
212
+ See Also:
213
+ - :class:`TaskMapping`
214
+ """
215
+
216
+ async def any(
217
+ self,
218
+ *iterables: AnyIterable[P.args],
219
+ concurrency: Optional[int] = None,
220
+ task_name: str = "",
221
+ **function_kwargs: P.kwargs
222
+ ) -> bool:
223
+ """
224
+ Checks if any result of the function applied to the iterables is truthy.
225
+
226
+ Args:
227
+ *iterables: Iterable objects to be used as arguments for the function.
228
+ concurrency: Optional maximum number of concurrent tasks.
229
+ task_name: Optional name for the tasks.
230
+ **function_kwargs: Additional keyword arguments to pass to the function.
231
+
232
+ Returns:
233
+ True if any result is truthy, otherwise False.
234
+
235
+ See Also:
236
+ - :meth:`map`
237
+ """
238
+
239
+ async def all(
240
+ self,
241
+ *iterables: AnyIterable[P.args],
242
+ concurrency: Optional[int] = None,
243
+ task_name: str = "",
244
+ **function_kwargs: P.kwargs
245
+ ) -> bool:
246
+ """
247
+ Checks if all results of the function applied to the iterables are truthy.
248
+
249
+ Args:
250
+ *iterables: Iterable objects to be used as arguments for the function.
251
+ concurrency: Optional maximum number of concurrent tasks.
252
+ task_name: Optional name for the tasks.
253
+ **function_kwargs: Additional keyword arguments to pass to the function.
254
+
255
+ Returns:
256
+ True if all results are truthy, otherwise False.
257
+
258
+ See Also:
259
+ - :meth:`map`
260
+ """
261
+
262
+ async def min(
263
+ self,
264
+ *iterables: AnyIterable[P.args],
265
+ concurrency: Optional[int] = None,
266
+ task_name: str = "",
267
+ **function_kwargs: P.kwargs
268
+ ) -> T:
269
+ """
270
+ Finds the minimum result of the function applied to the iterables.
271
+
272
+ Args:
273
+ *iterables: Iterable objects to be used as arguments for the function.
274
+ concurrency: Optional maximum number of concurrent tasks.
275
+ task_name: Optional name for the tasks.
276
+ **function_kwargs: Additional keyword arguments to pass to the function.
277
+
278
+ Returns:
279
+ The minimum result.
280
+
281
+ See Also:
282
+ - :meth:`map`
283
+ """
284
+
285
+ async def max(
286
+ self,
287
+ *iterables: AnyIterable[P.args],
288
+ concurrency: Optional[int] = None,
289
+ task_name: str = "",
290
+ **function_kwargs: P.kwargs
291
+ ) -> T:
292
+ """
293
+ Finds the maximum result of the function applied to the iterables.
294
+
295
+ Args:
296
+ *iterables: Iterable objects to be used as arguments for the function.
297
+ concurrency: Optional maximum number of concurrent tasks.
298
+ task_name: Optional name for the tasks.
299
+ **function_kwargs: Additional keyword arguments to pass to the function.
300
+
301
+ Returns:
302
+ The maximum result.
303
+
304
+ See Also:
305
+ - :meth:`map`
306
+ """
307
+
308
+ async def sum(
309
+ self,
310
+ *iterables: AnyIterable[P.args],
311
+ concurrency: Optional[int] = None,
312
+ task_name: str = "",
313
+ **function_kwargs: P.kwargs
314
+ ) -> T:
315
+ """
316
+ Calculates the sum of the results of the function applied to the iterables.
317
+
318
+ Args:
319
+ *iterables: Iterable objects to be used as arguments for the function.
320
+ concurrency: Optional maximum number of concurrent tasks.
321
+ task_name: Optional name for the tasks.
322
+ **function_kwargs: Additional keyword arguments to pass to the function.
323
+
324
+ Returns:
325
+ The sum of the results.
326
+
327
+ See Also:
328
+ - :meth:`map`
329
+ """
330
+ __docstring_append__: str
331
+
332
+ class ASyncDecorator(_ModifiedMixin):
333
+ modifiers: ModifierManager
334
+ def __init__(self, **modifiers: Unpack[ModifierKwargs]) -> None:
335
+ """
336
+ Initializes an ASyncDecorator instance.
337
+
338
+ Args:
339
+ **modifiers: Keyword arguments for function modifiers.
340
+
341
+ Raises:
342
+ ValueError: If 'default' is not 'sync', 'async', or None.
343
+
344
+ See Also:
345
+ - :class:`ModifierManager`
346
+ """
347
+
348
+ def validate_inputs(self) -> None:
349
+ """
350
+ Validates the input modifiers.
351
+
352
+ Raises:
353
+ ValueError: If 'default' is not 'sync', 'async', or None.
354
+
355
+ See Also:
356
+ - :attr:`ModifierManager.default`
357
+ """
358
+
359
+ @overload
360
+ def __call__(self, func: AnyFn[Concatenate[B, P], T]) -> ASyncBoundMethod[B, P, T]:
361
+ """
362
+ Decorates a bound method with async or sync behavior based on the default modifier.
363
+
364
+ Args:
365
+ func: The bound method to decorate.
366
+
367
+ Returns:
368
+ An ASyncBoundMethod instance with the appropriate default behavior.
369
+
370
+ See Also:
371
+ - :class:`ASyncBoundMethod`
372
+ """
373
+
374
+ @overload
375
+ def __call__(self, func: CoroFn[P, T]) -> ASyncFunctionAsyncDefault[P, T]:
376
+ """
377
+ Decorates a function with async or sync behavior based on the default modifier.
378
+
379
+ Args:
380
+ func: The function to decorate.
381
+
382
+ Returns:
383
+ An ASyncFunctionAsyncDefault instance.
384
+
385
+ See Also:
386
+ - :class:`ASyncFunction`
387
+ """
388
+
389
+ @overload
390
+ def __call__(self, func: SyncFn[P, T]) -> ASyncFunctionSyncDefault[P, T]:
391
+ """
392
+ Decorates a function with async or sync behavior based on the default modifier.
393
+
394
+ Args:
395
+ func: The function to decorate.
396
+
397
+ Returns:
398
+ An ASyncFunctionSyncDefault instance.
399
+
400
+ See Also:
401
+ - :class:`ASyncFunction`
402
+ """
403
+
404
+ class ASyncFunctionSyncDefault(ASyncFunction[P, T]):
405
+ """A specialized :class:`~ASyncFunction` that defaults to synchronous execution.
406
+
407
+ This class is used when the :func:`~a_sync` decorator is applied with `default=\'sync\'`.
408
+ It provides type hints to indicate that the default call behavior is synchronous and
409
+ supports IDE type checking for most use cases.
410
+
411
+ The wrapped function can still be called asynchronously by passing `sync=False`
412
+ or `asynchronous=True` as a keyword argument.
413
+
414
+ Example:
415
+ @a_sync(default=\'sync\')
416
+ async def my_function(x: int) -> str:
417
+ return str(x)
418
+
419
+ # Synchronous call (default behavior)
420
+ result = my_function(5) # returns "5"
421
+
422
+ # Asynchronous call
423
+ result = await my_function(5, sync=False) # returns "5"
424
+ """
425
+
426
+ @overload
427
+ def __call__(self, *args: P.args, sync: Literal[True], **kwargs: P.kwargs) -> T: ...
428
+ @overload
429
+ def __call__(
430
+ self, *args: P.args, sync: Literal[False], **kwargs: P.kwargs
431
+ ) -> Coroutine[Any, Any, T]: ...
432
+ @overload
433
+ def __call__(self, *args: P.args, asynchronous: Literal[False], **kwargs: P.kwargs) -> T: ...
434
+ @overload
435
+ def __call__(
436
+ self, *args: P.args, asynchronous: Literal[True], **kwargs: P.kwargs
437
+ ) -> Coroutine[Any, Any, T]: ...
438
+ @overload
439
+ def __call__(self, *args: P.args, **kwargs: P.kwargs) -> T: ...
440
+ __docstring_append__: str
441
+
442
+ class ASyncFunctionAsyncDefault(ASyncFunction[P, T]):
443
+ """
444
+ A specialized :class:`~ASyncFunction` that defaults to asynchronous execution.
445
+
446
+ This class is used when the :func:`~a_sync` decorator is applied with `default=\'async\'`.
447
+ It provides type hints to indicate that the default call behavior is asynchronous
448
+ and supports IDE type checking for most use cases.
449
+
450
+ The wrapped function can still be called synchronously by passing `sync=True`
451
+ or `asynchronous=False` as a keyword argument.
452
+
453
+ Example:
454
+ @a_sync(default=\'async\')
455
+ async def my_function(x: int) -> str:
456
+ return str(x)
457
+
458
+ # Asynchronous call (default behavior)
459
+ result = await my_function(5) # returns "5"
460
+
461
+ # Synchronous call
462
+ result = my_function(5, sync=True) # returns "5"
463
+ """
464
+
465
+ @overload
466
+ def __call__(self, *args: P.args, sync: Literal[True], **kwargs: P.kwargs) -> T: ...
467
+ @overload
468
+ def __call__(
469
+ self, *args: P.args, sync: Literal[False], **kwargs: P.kwargs
470
+ ) -> Coroutine[Any, Any, T]: ...
471
+ @overload
472
+ def __call__(self, *args: P.args, asynchronous: Literal[False], **kwargs: P.kwargs) -> T: ...
473
+ @overload
474
+ def __call__(
475
+ self, *args: P.args, asynchronous: Literal[True], **kwargs: P.kwargs
476
+ ) -> Coroutine[Any, Any, T]: ...
477
+ @overload
478
+ def __call__(self, *args: P.args, **kwargs: P.kwargs) -> Coroutine[Any, Any, T]: ...
479
+ __docstring_append__: str
480
+
481
+ class ASyncDecoratorSyncDefault(ASyncDecorator):
482
+ @overload
483
+ def __call__(self, func: AnyFn[Concatenate[B, P], T]) -> ASyncBoundMethodSyncDefault[P, T]:
484
+ """
485
+ Decorates a bound method with synchronous default behavior.
486
+
487
+ Args:
488
+ func: The bound method to decorate.
489
+
490
+ Returns:
491
+ An ASyncBoundMethodSyncDefault instance with synchronous default behavior.
492
+
493
+ See Also:
494
+ - :class:`ASyncBoundMethodSyncDefault`
495
+ """
496
+
497
+ @overload
498
+ def __call__(self, func: AnyBoundMethod[P, T]) -> ASyncFunctionSyncDefault[P, T]:
499
+ """
500
+ Decorates a bound method with synchronous default behavior.
501
+
502
+ Args:
503
+ func: The bound method to decorate.
504
+
505
+ Returns:
506
+ An ASyncFunctionSyncDefault instance with synchronous default behavior.
507
+
508
+ See Also:
509
+ - :class:`ASyncFunctionSyncDefault`
510
+ """
511
+
512
+ @overload
513
+ def __call__(self, func: AnyFn[P, T]) -> ASyncFunctionSyncDefault[P, T]:
514
+ """
515
+ Decorates a function with synchronous default behavior.
516
+
517
+ Args:
518
+ func: The function to decorate.
519
+
520
+ Returns:
521
+ An ASyncFunctionSyncDefault instance with synchronous default behavior.
522
+
523
+ See Also:
524
+ - :class:`ASyncFunctionSyncDefault`
525
+ """
526
+
527
+ class ASyncDecoratorAsyncDefault(ASyncDecorator):
528
+ @overload
529
+ def __call__(self, func: AnyFn[Concatenate[B, P], T]) -> ASyncBoundMethodAsyncDefault[P, T]:
530
+ """
531
+ Decorates a bound method with asynchronous default behavior.
532
+
533
+ Args:
534
+ func: The bound method to decorate.
535
+
536
+ Returns:
537
+ An ASyncBoundMethodAsyncDefault instance with asynchronous default behavior.
538
+
539
+ See Also:
540
+ - :class:`ASyncBoundMethodAsyncDefault`
541
+ """
542
+
543
+ @overload
544
+ def __call__(self, func: AnyBoundMethod[P, T]) -> ASyncFunctionAsyncDefault[P, T]:
545
+ """
546
+ Decorates a bound method with asynchronous default behavior.
547
+
548
+ Args:
549
+ func: The bound method to decorate.
550
+
551
+ Returns:
552
+ An ASyncFunctionAsyncDefault instance with asynchronous default behavior.
553
+
554
+ See Also:
555
+ - :class:`ASyncFunctionAsyncDefault`
556
+ """
557
+
558
+ @overload
559
+ def __call__(self, func: AnyFn[P, T]) -> ASyncFunctionAsyncDefault[P, T]:
560
+ """
561
+ Decorates a function with asynchronous default behavior.
562
+
563
+ Args:
564
+ func: The function to decorate.
565
+
566
+ Returns:
567
+ An ASyncFunctionAsyncDefault instance with asynchronous default behavior.
568
+
569
+ See Also:
570
+ - :class:`ASyncFunctionAsyncDefault`
571
+ """