ez-a-sync 0.32.21__cp310-cp310-win_amd64.whl → 0.32.23__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.

Files changed (40) hide show
  1. a_sync/_smart.c +1266 -1194
  2. a_sync/_smart.cp310-win_amd64.pyd +0 -0
  3. a_sync/_smart.pyx +1 -0
  4. a_sync/a_sync/_descriptor.cp310-win_amd64.pyd +0 -0
  5. a_sync/a_sync/_flags.cp310-win_amd64.pyd +0 -0
  6. a_sync/a_sync/_helpers.cp310-win_amd64.pyd +0 -0
  7. a_sync/a_sync/_kwargs.cp310-win_amd64.pyd +0 -0
  8. a_sync/a_sync/abstract.cp310-win_amd64.pyd +0 -0
  9. a_sync/a_sync/base.cp310-win_amd64.pyd +0 -0
  10. a_sync/a_sync/decorator.py +89 -0
  11. a_sync/a_sync/flags.cp310-win_amd64.pyd +0 -0
  12. a_sync/a_sync/function.cp310-win_amd64.pyd +0 -0
  13. a_sync/a_sync/method.cp310-win_amd64.pyd +0 -0
  14. a_sync/a_sync/modifiers/manager.cp310-win_amd64.pyd +0 -0
  15. a_sync/a_sync/property.cp310-win_amd64.pyd +0 -0
  16. a_sync/async_property/cached.cp310-win_amd64.pyd +0 -0
  17. a_sync/async_property/proxy.cp310-win_amd64.pyd +0 -0
  18. a_sync/asyncio/as_completed.cp310-win_amd64.pyd +0 -0
  19. a_sync/asyncio/create_task.cp310-win_amd64.pyd +0 -0
  20. a_sync/asyncio/gather.cp310-win_amd64.pyd +0 -0
  21. a_sync/asyncio/igather.cp310-win_amd64.pyd +0 -0
  22. a_sync/asyncio/sleep.cp310-win_amd64.pyd +0 -0
  23. a_sync/debugging.cp310-win_amd64.pyd +0 -0
  24. a_sync/exceptions.c +480 -263
  25. a_sync/exceptions.cp310-win_amd64.pyd +0 -0
  26. a_sync/exceptions.pyx +3 -0
  27. a_sync/functools.cp310-win_amd64.pyd +0 -0
  28. a_sync/iter.cp310-win_amd64.pyd +0 -0
  29. a_sync/primitives/_debug.cp310-win_amd64.pyd +0 -0
  30. a_sync/primitives/_loggable.cp310-win_amd64.pyd +0 -0
  31. a_sync/primitives/locks/counter.cp310-win_amd64.pyd +0 -0
  32. a_sync/primitives/locks/event.cp310-win_amd64.pyd +0 -0
  33. a_sync/primitives/locks/prio_semaphore.cp310-win_amd64.pyd +0 -0
  34. a_sync/primitives/locks/semaphore.cp310-win_amd64.pyd +0 -0
  35. a_sync/utils/repr.cp310-win_amd64.pyd +0 -0
  36. {ez_a_sync-0.32.21.dist-info → ez_a_sync-0.32.23.dist-info}/METADATA +1 -1
  37. {ez_a_sync-0.32.21.dist-info → ez_a_sync-0.32.23.dist-info}/RECORD +40 -40
  38. {ez_a_sync-0.32.21.dist-info → ez_a_sync-0.32.23.dist-info}/WHEEL +0 -0
  39. {ez_a_sync-0.32.21.dist-info → ez_a_sync-0.32.23.dist-info}/licenses/LICENSE.txt +0 -0
  40. {ez_a_sync-0.32.21.dist-info → ez_a_sync-0.32.23.dist-info}/top_level.txt +0 -0
Binary file
a_sync/_smart.pyx CHANGED
@@ -10,6 +10,7 @@ import typing
10
10
  import weakref
11
11
  from logging import getLogger
12
12
  from types import TracebackType
13
+ from typing import Awaitable, Generator, Optional, Set
13
14
 
14
15
  cimport cython
15
16
  from cpython.object cimport PyObject
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,5 +1,6 @@
1
1
  # mypy: disable-error-code=valid-type
2
2
  # mypy: disable-error-code=misc
3
+ from concurrent.futures import Executor
3
4
  from a_sync._typing import *
4
5
  from a_sync.a_sync import config
5
6
  from a_sync.a_sync.function import (
@@ -24,6 +25,36 @@ from a_sync.a_sync.function import (
24
25
  # pass
25
26
 
26
27
 
28
+ @overload
29
+ def a_sync(
30
+ default: Literal["async"],
31
+ executor: Executor,
32
+ **modifiers: Unpack[ModifierKwargs],
33
+ ) -> ASyncDecoratorAsyncDefault:
34
+ """
35
+ Creates an asynchronous default decorator to run a sync function in an executor.
36
+
37
+ Args:
38
+ default: Specifies the default execution mode as 'async'.
39
+ executor: The executor that will be used to call the sync function.
40
+ **modifiers: Additional keyword arguments to modify the behavior of the decorated function.
41
+
42
+ Examples:
43
+ Basic usage with an asynchronous default:
44
+
45
+ >>> @a_sync(default='async', executor=ThreadPoolExecutor(4))
46
+ ... def my_function():
47
+ ... return True
48
+ >>> await my_function()
49
+ True
50
+ >>> my_function(sync=True)
51
+ True
52
+
53
+ See Also:
54
+ :class:`ASyncDecoratorAsyncDefault`
55
+ """
56
+
57
+
27
58
  @overload
28
59
  def a_sync(
29
60
  default: Literal["async"],
@@ -52,6 +83,36 @@ def a_sync(
52
83
  """
53
84
 
54
85
 
86
+ @overload
87
+ def a_sync(
88
+ default: Literal["sync"],
89
+ executor: Executor,
90
+ **modifiers: Unpack[ModifierKwargs],
91
+ ) -> ASyncDecoratorSyncDefault:
92
+ """
93
+ Creates a synchronous default decorator to run a sync function in an executor when called asynchronously.
94
+
95
+ Args:
96
+ default: Specifies the default execution mode as 'sync'.
97
+ executor: The executor that will be used to call the sync function.
98
+ **modifiers: Additional keyword arguments to modify the behavior of the decorated function.
99
+
100
+ Examples:
101
+ Usage with an executor without specifying a default mode:
102
+
103
+ >>> @a_sync(default="sync", executor=ThreadPoolExecutor(4))
104
+ ... def my_function():
105
+ ... return True
106
+ >>> my_function()
107
+ True
108
+ >>> await my_function(sync=False)
109
+ True
110
+
111
+ See Also:
112
+ :class:`ASyncDecoratorSyncDefault`
113
+ """
114
+
115
+
55
116
  @overload
56
117
  def a_sync(
57
118
  default: Literal["sync"],
@@ -80,6 +141,34 @@ def a_sync(
80
141
  """
81
142
 
82
143
 
144
+ @overload
145
+ def a_sync(
146
+ executor: Executor,
147
+ **modifiers: Unpack[ModifierKwargs],
148
+ ) -> ASyncDecoratorSyncDefault:
149
+ """
150
+ Creates a synchronous default decorator to run a sync function in an executor when called asynchronously.
151
+
152
+ Args:
153
+ executor: The executor that will be used to call the sync function.
154
+ **modifiers: Additional keyword arguments to modify the behavior of the decorated function.
155
+
156
+ Examples:
157
+ Usage with an executor without specifying a default mode:
158
+
159
+ >>> @a_sync(executor=ThreadPoolExecutor(4))
160
+ ... def my_function():
161
+ ... return True
162
+ >>> my_function()
163
+ True
164
+ >>> await my_function(sync=False)
165
+ True
166
+
167
+ See Also:
168
+ :class:`ASyncDecoratorSyncDefault`
169
+ """
170
+
171
+
83
172
  @overload
84
173
  def a_sync(
85
174
  **modifiers: Unpack[ModifierKwargs],
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file