fastcore 2.2.42__tar.gz → 2.2.44__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.
- {fastcore-2.2.42/fastcore.egg-info → fastcore-2.2.44}/PKG-INFO +1 -1
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/__init__.py +1 -1
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/docments.py +1 -1
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/parallel.py +4 -8
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/xtras.py +2 -3
- {fastcore-2.2.42 → fastcore-2.2.44/fastcore.egg-info}/PKG-INFO +1 -1
- {fastcore-2.2.42 → fastcore-2.2.44}/CONTRIBUTING.md +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/LICENSE +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/README.md +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/_modidx.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/aio.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/all.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/ansi.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/apisurface.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/basics.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/dispatch.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/docscrape.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/editskill.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/foundation.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/funccall.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/imghdr.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/imports.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/meta.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/nb_imports.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/nbio.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/net.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/py2pyi.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/script.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/shutil.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/style.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/test.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/tools.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/transform.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/utils.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/xdg.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore/xml.py +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore.egg-info/SOURCES.txt +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore.egg-info/dependency_links.txt +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore.egg-info/entry_points.txt +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore.egg-info/requires.txt +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/fastcore.egg-info/top_level.txt +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/pyproject.toml +0 -0
- {fastcore-2.2.42 → fastcore-2.2.44}/setup.cfg +0 -0
|
@@ -206,7 +206,7 @@ def docments(s, full=False, eval_str=False, returns=True, args_kwargs=False):
|
|
|
206
206
|
docs = {}
|
|
207
207
|
while s is not None:
|
|
208
208
|
p = _param_locs(s, returns=returns, args_kwargs=args_kwargs) or {}
|
|
209
|
-
c = {o.start[0]:_clean_comment(o.string) for o in _tokens(s) if o.type==COMMENT}
|
|
209
|
+
c = {o.start[0]:_clean_comment(o.string) for o in _tokens(s) if o.type==COMMENT} if p else {}
|
|
210
210
|
for k,v in p.items():
|
|
211
211
|
if v not in docs: docs[v] = _get_comment(k, v, c, p)
|
|
212
212
|
s = getattr(s, '__delwrap__', None)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Threading and multiprocessing functions
|
|
2
2
|
|
|
3
|
-
`parallel(f, items)` applies `f` to each item using a process pool. Set `threadpool=True` to use threads. Set `n_workers` to control concurrency, or to 0 for serial execution when debugging. Optional arguments include a `progress` bar, a `pause` between starts, `return_exceptions` to collect errors, and `max_tasks_per_child=1` to run each item in a new process (Python 3.11 and later, with `f` importable from a module rather than defined in `__main__`). `parallel_async` runs work concurrently with asyncio.
|
|
3
|
+
`parallel(f, items)` applies `f` to each item using a process pool. On POSIX, the default start method is `fork`, or `forkserver` with worker recycling. Pass `method=` to choose a start method. Set `threadpool=True` to use threads. Set `n_workers` to control concurrency, or to 0 for serial execution when debugging. Optional arguments include a `progress` bar, a `pause` between starts, `return_exceptions` to collect errors, and `max_tasks_per_child=1` to run each item in a new process (Python 3.11 and later, with `f` importable from a module rather than defined in `__main__`). `parallel_async` runs work concurrently with asyncio.
|
|
4
4
|
|
|
5
5
|
`@threaded` runs a function in a background thread and returns the thread. Read its `result` attribute after it finishes. Set `process=True` to run in a process. `startthread` and `startproc` start their decorated functions immediately.
|
|
6
6
|
|
|
@@ -21,11 +21,8 @@ from .xtras import *
|
|
|
21
21
|
from functools import wraps
|
|
22
22
|
|
|
23
23
|
import concurrent.futures,time
|
|
24
|
-
from multiprocessing import
|
|
24
|
+
from multiprocessing import Manager,get_context
|
|
25
25
|
from threading import Thread,Lock
|
|
26
|
-
try:
|
|
27
|
-
if sys.platform == 'darwin' and IN_NOTEBOOK: set_start_method("fork")
|
|
28
|
-
except: pass
|
|
29
26
|
|
|
30
27
|
# %% ../nbs/03a_parallel.ipynb #21e71104
|
|
31
28
|
@metadec
|
|
@@ -41,8 +38,7 @@ def threaded(
|
|
|
41
38
|
_obj_td.result = res
|
|
42
39
|
@wraps(f)
|
|
43
40
|
def _f(*args, **kwargs):
|
|
44
|
-
|
|
45
|
-
res = (Thread,Proc)[process](target=g, args=args, kwargs=kwargs)
|
|
41
|
+
res = (get_context('fork').Process if process else Thread)(target=g, args=args, kwargs=kwargs)
|
|
46
42
|
res._args = (res,)+res._args
|
|
47
43
|
if daemon: res.daemon = True
|
|
48
44
|
res.start()
|
|
@@ -137,7 +133,7 @@ def parallel(f, items, *args, n_workers=defaults.cpus, total=None, progress=None
|
|
|
137
133
|
if max_tasks_per_child:
|
|
138
134
|
kwpool['max_tasks_per_child'] = max_tasks_per_child
|
|
139
135
|
if not method: method = 'spawn' if sys.platform == 'win32' else 'forkserver'
|
|
140
|
-
if not method and sys.platform
|
|
136
|
+
if not method and sys.platform != 'win32': method='fork'
|
|
141
137
|
if method: kwpool['mp_context'] = get_context(method)
|
|
142
138
|
pool = ProcessPoolExecutor
|
|
143
139
|
with pool(n_workers, pause=pause, **kwpool) as ex:
|
|
@@ -681,11 +681,10 @@ def __repr__(self:Path):
|
|
|
681
681
|
@patch
|
|
682
682
|
def delete(self:Path):
|
|
683
683
|
"Delete a file, symlink, or directory tree"
|
|
684
|
-
if not self.
|
|
685
|
-
if self.is_dir():
|
|
684
|
+
if not self.is_symlink() and self.is_dir():
|
|
686
685
|
import shutil
|
|
687
686
|
shutil.rmtree(self)
|
|
688
|
-
else: self.unlink()
|
|
687
|
+
else: self.unlink(missing_ok=True)
|
|
689
688
|
|
|
690
689
|
# %% ../nbs/03_xtras.ipynb #f2bb033e
|
|
691
690
|
class IterLen:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|