osbot-utils 2.44.0__py3-none-any.whl → 2.46.0__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.
- osbot_utils/utils/Threads.py +10 -7
- osbot_utils/version +1 -1
- {osbot_utils-2.44.0.dist-info → osbot_utils-2.46.0.dist-info}/METADATA +2 -2
- {osbot_utils-2.44.0.dist-info → osbot_utils-2.46.0.dist-info}/RECORD +6 -6
- {osbot_utils-2.44.0.dist-info → osbot_utils-2.46.0.dist-info}/LICENSE +0 -0
- {osbot_utils-2.44.0.dist-info → osbot_utils-2.46.0.dist-info}/WHEEL +0 -0
osbot_utils/utils/Threads.py
CHANGED
@@ -43,21 +43,24 @@ def invoke_in_new_event_loop(target: typing.Coroutine): # Runs a cor
|
|
43
43
|
return result # Return the result from the coroutine
|
44
44
|
|
45
45
|
from concurrent.futures import ThreadPoolExecutor
|
46
|
-
from typing import Callable, List, TypeVar,
|
46
|
+
from typing import Callable, List, TypeVar, Tuple, Optional, Dict
|
47
47
|
|
48
48
|
T = TypeVar('T') # Type of items in the list
|
49
49
|
R = TypeVar('R') # Return type of the function
|
50
50
|
|
51
|
-
def execute_in_thread_pool(target_function
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
) -> List[R]: # List of results
|
51
|
+
def execute_in_thread_pool(target_function : Callable ,
|
52
|
+
calls : List[Tuple[Tuple, Dict]] , # List of (args, kwargs) pairs
|
53
|
+
max_workers : Optional[int] = None ,
|
54
|
+
return_exceptions : bool = False ):
|
56
55
|
"""Execute a function for each item in parallel using ThreadPoolExecutor."""
|
56
|
+
|
57
57
|
results = []
|
58
58
|
with ThreadPoolExecutor(max_workers=max_workers) as executor:
|
59
59
|
|
60
|
-
futures = [
|
60
|
+
futures = []
|
61
|
+
for args, kwargs in calls:
|
62
|
+
future = executor.submit(target_function, *args, **kwargs)
|
63
|
+
futures.append(future) # Submit all tasks to the executor
|
61
64
|
|
62
65
|
for future in futures: # Wait for all to complete and collect results
|
63
66
|
try:
|
osbot_utils/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
v2.
|
1
|
+
v2.46.0
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: osbot_utils
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.46.0
|
4
4
|
Summary: OWASP Security Bot - Utils
|
5
5
|
License: MIT
|
6
6
|
Author: Dinis Cruz
|
@@ -23,7 +23,7 @@ Description-Content-Type: text/markdown
|
|
23
23
|
|
24
24
|
Powerful Python util methods and classes that simplify common apis and tasks.
|
25
25
|
|
26
|
-

|
27
27
|
[](https://codecov.io/gh/owasp-sbot/OSBot-Utils)
|
28
28
|
|
29
29
|
|
@@ -393,13 +393,13 @@ osbot_utils/utils/Python_Logger.py,sha256=M9Oi62LxfnRSlCN8GhaiwiBINvcSdGy39FCWjy
|
|
393
393
|
osbot_utils/utils/Regex.py,sha256=MtHhk69ax7Nwu4CQZK7y4KXHZ6VREwEpIchuioB168c,960
|
394
394
|
osbot_utils/utils/Status.py,sha256=OjqLwUhHqY-j-JeRN-hIaVZQHPRdyjR7y6i6ujsB-Yc,4287
|
395
395
|
osbot_utils/utils/Str.py,sha256=KQVfh0o3BxJKVm24yhAhgIGH5QYfzpP1G-siVv2zQws,3301
|
396
|
-
osbot_utils/utils/Threads.py,sha256=
|
396
|
+
osbot_utils/utils/Threads.py,sha256=9neeD38mW4DFxwJkTG3wv7tu-mSWOGf75Zzs3ES-tEk,4379
|
397
397
|
osbot_utils/utils/Toml.py,sha256=Rxl8gx7mni5CvBAK-Ai02EKw-GwtJdd3yeHT2kMloik,1667
|
398
398
|
osbot_utils/utils/Version.py,sha256=Ww6ChwTxqp1QAcxOnztkTicShlcx6fbNsWX5xausHrg,422
|
399
399
|
osbot_utils/utils/Zip.py,sha256=pR6sKliUY0KZXmqNzKY2frfW-YVQEVbLKiyqQX_lc-8,14052
|
400
400
|
osbot_utils/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
401
|
-
osbot_utils/version,sha256=
|
402
|
-
osbot_utils-2.
|
403
|
-
osbot_utils-2.
|
404
|
-
osbot_utils-2.
|
405
|
-
osbot_utils-2.
|
401
|
+
osbot_utils/version,sha256=5LPx3Q0i9k0BNZ-NbO15YSZZTkKMvOnaD_TNClqq0zY,8
|
402
|
+
osbot_utils-2.46.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
403
|
+
osbot_utils-2.46.0.dist-info/METADATA,sha256=IDKf9zQ6IrKUU833UqEo2AbFBxtBXqK_PIck8qULA14,1329
|
404
|
+
osbot_utils-2.46.0.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
405
|
+
osbot_utils-2.46.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|