dycw-utilities 0.136.2__py3-none-any.whl → 0.136.3__py3-none-any.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.
- {dycw_utilities-0.136.2.dist-info → dycw_utilities-0.136.3.dist-info}/METADATA +1 -1
- {dycw_utilities-0.136.2.dist-info → dycw_utilities-0.136.3.dist-info}/RECORD +6 -6
- utilities/__init__.py +1 -1
- utilities/asyncio.py +13 -3
- {dycw_utilities-0.136.2.dist-info → dycw_utilities-0.136.3.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.136.2.dist-info → dycw_utilities-0.136.3.dist-info}/licenses/LICENSE +0 -0
@@ -1,8 +1,8 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=BmPyeyqP4do_46ks7_IMxZ-pOQGgO4-MnFQ9bw0zx_E,60
|
2
2
|
utilities/aiolimiter.py,sha256=mD0wEiqMgwpty4XTbawFpnkkmJS6R4JRsVXFUaoitSU,628
|
3
3
|
utilities/altair.py,sha256=HeZBVUocjkrTNwwKrClppsIqgNFF-ykv05HfZSoHYno,9104
|
4
4
|
utilities/arq.py,sha256=S-sfBfY-E1ErRKf4sSXt2YyCjKvu-pBlOECDfjBebRA,6399
|
5
|
-
utilities/asyncio.py,sha256=
|
5
|
+
utilities/asyncio.py,sha256=dcGeKQzjLBXxKzZkVIk5oZsFXEcynVbRB9iNB5XEDZk,38526
|
6
6
|
utilities/atomicwrites.py,sha256=geFjn9Pwn-tTrtoGjDDxWli9NqbYfy3gGL6ZBctiqSo,5393
|
7
7
|
utilities/atools.py,sha256=9im2g8OCf-Iynqa8bAv8N0Ycj9QvrJmGO7yLCZEdgII,986
|
8
8
|
utilities/cachetools.py,sha256=v1-9sXHLdOLiwmkq6NB0OUbxeKBuVVN6wmAWefWoaHI,2744
|
@@ -89,7 +89,7 @@ utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
|
|
89
89
|
utilities/whenever.py,sha256=A-yoOqBqrcVD1yDINDsTFDw7dq9-zgUGn_f8CxVUQJs,23332
|
90
90
|
utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
|
91
91
|
utilities/zoneinfo.py,sha256=oEH-nL3t4h9uawyZqWDtNtDAl6M-CLpLYGI_nI6DulM,1971
|
92
|
-
dycw_utilities-0.136.
|
93
|
-
dycw_utilities-0.136.
|
94
|
-
dycw_utilities-0.136.
|
95
|
-
dycw_utilities-0.136.
|
92
|
+
dycw_utilities-0.136.3.dist-info/METADATA,sha256=Hi7aRq1msI4KXQLVrnun8CojINzZHpxfP26XxstkH7w,1637
|
93
|
+
dycw_utilities-0.136.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
94
|
+
dycw_utilities-0.136.3.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
95
|
+
dycw_utilities-0.136.3.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/asyncio.py
CHANGED
@@ -220,6 +220,7 @@ class EnhancedQueue[T](Queue[T]):
|
|
220
220
|
class EnhancedTaskGroup(TaskGroup):
|
221
221
|
"""Task group with enhanced features."""
|
222
222
|
|
223
|
+
_max_tasks: int | None
|
223
224
|
_semaphore: Semaphore | None
|
224
225
|
_timeout: TimeDelta | None
|
225
226
|
_error: MaybeType[BaseException]
|
@@ -237,7 +238,11 @@ class EnhancedTaskGroup(TaskGroup):
|
|
237
238
|
debug: MaybeCallableBool = False,
|
238
239
|
) -> None:
|
239
240
|
super().__init__()
|
240
|
-
self.
|
241
|
+
self._max_tasks = max_tasks
|
242
|
+
if (max_tasks is None) or (max_tasks <= 0):
|
243
|
+
self._semaphore = None
|
244
|
+
else:
|
245
|
+
self._semaphore = Semaphore(max_tasks)
|
241
246
|
self._timeout = timeout
|
242
247
|
self._error = error
|
243
248
|
self._debug = debug
|
@@ -257,7 +262,7 @@ class EnhancedTaskGroup(TaskGroup):
|
|
257
262
|
tb: TracebackType | None,
|
258
263
|
) -> None:
|
259
264
|
_ = await self._stack.__aexit__(et, exc, tb)
|
260
|
-
match
|
265
|
+
match self._is_debug():
|
261
266
|
case True:
|
262
267
|
with suppress(Exception):
|
263
268
|
_ = await super().__aexit__(et, exc, tb)
|
@@ -293,7 +298,7 @@ class EnhancedTaskGroup(TaskGroup):
|
|
293
298
|
name: str | None = None,
|
294
299
|
context: Context | None = None,
|
295
300
|
) -> T | Task[T]:
|
296
|
-
match
|
301
|
+
match self._is_debug():
|
297
302
|
case True:
|
298
303
|
return await coro
|
299
304
|
case False:
|
@@ -301,6 +306,11 @@ class EnhancedTaskGroup(TaskGroup):
|
|
301
306
|
case _ as never:
|
302
307
|
assert_never(never)
|
303
308
|
|
309
|
+
def _is_debug(self) -> bool:
|
310
|
+
return to_bool(bool_=self._debug) or (
|
311
|
+
(self._max_tasks is not None) and (self._max_tasks <= 0)
|
312
|
+
)
|
313
|
+
|
304
314
|
async def _wrap_with_semaphore[T](
|
305
315
|
self, semaphore: Semaphore, coroutine: _CoroutineLike[T], /
|
306
316
|
) -> T:
|
File without changes
|
File without changes
|