isi-util 0.1.0__tar.gz

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.
@@ -0,0 +1,30 @@
1
+ # .env file used to set local paths for Docker and scripts
2
+ .env
3
+
4
+ # directory used by web server to store uploaded files
5
+ uploads
6
+
7
+ # files that appear to be due to installing dependencies, try un-ignoring these if needed
8
+ share
9
+ etc
10
+
11
+ # Byte-compiled / optimized / DLL files
12
+ __pycache__/
13
+ *.py[cod]
14
+ *$py.class
15
+
16
+ # Virtualenv
17
+ # http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
18
+ .Python
19
+ [Bb]in
20
+ [Ii]nclude
21
+ [Ll]ib
22
+ [Ll]ib64
23
+ [Ll]ocal
24
+ [Ss]cripts
25
+ pyvenv.cfg
26
+ .venv
27
+ pip-selfcheck.json
28
+
29
+ # package builds
30
+ dist
@@ -0,0 +1,4 @@
1
+ Metadata-Version: 2.3
2
+ Name: isi-util
3
+ Version: 0.1.0
4
+ Requires-Python: >=3.10
@@ -0,0 +1,8 @@
1
+ [project]
2
+ name = "isi-util"
3
+ version = "0.1.0"
4
+ requires-python = ">=3.10"
5
+
6
+ [build-system]
7
+ requires = ["hatchling"]
8
+ build-backend = "hatchling.build"
File without changes
@@ -0,0 +1,22 @@
1
+ import concurrent.futures
2
+ import asyncio
3
+
4
+
5
+ async def asyncify_generator(gen):
6
+ pool = concurrent.futures.ThreadPoolExecutor()
7
+ loop = asyncio.get_event_loop()
8
+
9
+ def wrapped():
10
+ for x in gen:
11
+ yield x
12
+ raise StopAsyncIteration
13
+
14
+ iter = wrapped()
15
+
16
+ while True:
17
+ try:
18
+ x = await loop.run_in_executor(pool, next, iter)
19
+ yield x
20
+ except StopAsyncIteration:
21
+ pool.shutdown()
22
+ return
@@ -0,0 +1,10 @@
1
+ import concurrent.futures
2
+ import asyncio
3
+
4
+
5
+ async def asyncify(func, *args, **kwargs):
6
+ pool = concurrent.futures.ThreadPoolExecutor()
7
+ loop = asyncio.get_event_loop()
8
+ result = await loop.run_in_executor(pool, func, *args, **kwargs)
9
+ pool.shutdown()
10
+ return result
@@ -0,0 +1,5 @@
1
+ def find_index(li, func):
2
+ for i, v in enumerate(li):
3
+ if func(v):
4
+ return i
5
+ return -1