ez-a-sync 0.32.21__cp313-cp313-musllinux_1_2_x86_64.whl → 0.32.22__cp313-cp313-musllinux_1_2_x86_64.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.

@@ -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],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ez_a_sync
3
- Version: 0.32.21
3
+ Version: 0.32.22
4
4
  Summary: A library that makes it easy to define objects that can be used for both sync and async use cases.
5
5
  Home-page: https://github.com/BobTheBuidler/a-sync
6
6
  Author: BobTheBuidler
@@ -58,7 +58,7 @@ a_sync/a_sync/base.cpython-313-x86_64-linux-musl.so,sha256=8M2pisO2z-71yjndafFB1
58
58
  a_sync/a_sync/base.pyi,sha256=t7AsaZzf74djHjkAA7Dnzf12sG1ppoxpwm0Iyn1GM3w,2326
59
59
  a_sync/a_sync/base.pyx,sha256=73vU-pr2XClsKLcGlQbhAhjLFHMoBQrb6UH-YuCBhxU,10603
60
60
  a_sync/a_sync/config.py,sha256=siXP4CFLQ_vswuG5K-G6cOSjQ6xKc1gN7-XNHFN2tFU,6221
61
- a_sync/a_sync/decorator.py,sha256=CdZuy_ql4oxzg4qbxCHTtHrGnMkxJKs1LwzlmLdX3Uc,17188
61
+ a_sync/a_sync/decorator.py,sha256=mCSp2KxOsPObANAwR6VK4UzhuelxAOwPDGQ8-jxe8dk,19750
62
62
  a_sync/a_sync/flags.c,sha256=pnoCgI2Cochd4fMayKEKI82lw8f83fwhhUkNajLvxJk,175737
63
63
  a_sync/a_sync/flags.cpython-313-x86_64-linux-musl.so,sha256=FcPM8dKEPf40NdXKr2u4SupX4fRAN6NEwBwl6aIyMLs,68840
64
64
  a_sync/a_sync/flags.pxd,sha256=Jxe9hvWn-mPfGXHXLEvRPM2i44c4y2D4iq4ZqZZst80,2238
@@ -170,8 +170,8 @@ a_sync/utils/repr.c,sha256=4HDcDzNN4_R5Z_QrhMy9kxWXK7iALDKpa--_D0k6_-Y,571751
170
170
  a_sync/utils/repr.cpython-313-x86_64-linux-musl.so,sha256=8rGXE4HiblBAb_83Z7DJZPJO29jmXQz2DC6OUdblEuM,660856
171
171
  a_sync/utils/repr.pyi,sha256=PWdsa6sF9_3nBqEgLaxtaHty7o7gwL--jPqvcelHY10,131
172
172
  a_sync/utils/repr.pyx,sha256=xdsVdK75Zi5pAoh-8qRG0q7F0ySAq1zDkksZw37FoL4,2632
173
- ez_a_sync-0.32.21.dist-info/METADATA,sha256=lo0ppv5dvFgHlmVRYiPXVPgMdSC6MXS68CePUKbTh_8,13197
174
- ez_a_sync-0.32.21.dist-info/WHEEL,sha256=4VbEOkf4fdBUBHdV24POjoH-zuik_eIDLSImZZCAQpQ,112
175
- ez_a_sync-0.32.21.dist-info/top_level.txt,sha256=ew2xVyFeZE_a5XMEL64h7-vJIbaBQieaFcvBAWUpU_s,7
176
- ez_a_sync-0.32.21.dist-info/RECORD,,
177
- ez_a_sync-0.32.21.dist-info/licenses/LICENSE.txt,sha256=1on6-17OUMlja6vSPTcmlmeT_DwujCZJijYxaplBvZk,1075
173
+ ez_a_sync-0.32.22.dist-info/METADATA,sha256=-ufQh9qrGBFLw3S-PW0gyYp2eLLtZSx1lgnwJEjxOQM,13197
174
+ ez_a_sync-0.32.22.dist-info/WHEEL,sha256=4VbEOkf4fdBUBHdV24POjoH-zuik_eIDLSImZZCAQpQ,112
175
+ ez_a_sync-0.32.22.dist-info/top_level.txt,sha256=ew2xVyFeZE_a5XMEL64h7-vJIbaBQieaFcvBAWUpU_s,7
176
+ ez_a_sync-0.32.22.dist-info/RECORD,,
177
+ ez_a_sync-0.32.22.dist-info/licenses/LICENSE.txt,sha256=1on6-17OUMlja6vSPTcmlmeT_DwujCZJijYxaplBvZk,1075