fastcore 2.2.28__tar.gz → 2.2.30__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.28/fastcore.egg-info → fastcore-2.2.30}/PKG-INFO +2 -2
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/__init__.py +1 -1
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/_modidx.py +1 -11
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/editskill.py +1 -1
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/script.py +19 -11
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/tools.py +5 -3
- {fastcore-2.2.28 → fastcore-2.2.30/fastcore.egg-info}/PKG-INFO +2 -2
- {fastcore-2.2.28 → fastcore-2.2.30}/pyproject.toml +2 -2
- {fastcore-2.2.28 → fastcore-2.2.30}/CONTRIBUTING.md +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/LICENSE +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/README.md +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/aio.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/all.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/ansi.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/apisurface.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/basics.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/dispatch.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/docments.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/docscrape.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/foundation.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/funccall.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/imghdr.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/imports.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/meta.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/nb_imports.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/nbio.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/net.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/parallel.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/py2pyi.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/shutil.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/style.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/test.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/transform.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/utils.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/xdg.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/xml.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore/xtras.py +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore.egg-info/SOURCES.txt +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore.egg-info/dependency_links.txt +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore.egg-info/entry_points.txt +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore.egg-info/requires.txt +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/fastcore.egg-info/top_level.txt +0 -0
- {fastcore-2.2.28 → fastcore-2.2.30}/setup.cfg +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastcore
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.30
|
|
4
4
|
Summary: Python supercharged for fastai development
|
|
5
5
|
Author-email: Jeremy Howard and Sylvain Gugger <infos@fast.ai>
|
|
6
|
-
License: Apache-2.0
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
7
|
Project-URL: Repository, https://github.com/AnswerDotAI/fastcore/
|
|
8
8
|
Project-URL: Documentation, https://fastcore.fast.ai/
|
|
9
9
|
Keywords: python
|
|
@@ -33,8 +33,6 @@ d = { 'settings': { 'branch': 'main',
|
|
|
33
33
|
'fastcore.aio.then': ('aio.html#then', 'fastcore/aio.py'),
|
|
34
34
|
'fastcore.aio.to_aiter': ('aio.html#to_aiter', 'fastcore/aio.py'),
|
|
35
35
|
'fastcore.aio.wait_until': ('aio.html#wait_until', 'fastcore/aio.py')},
|
|
36
|
-
'fastcore.all': {},
|
|
37
|
-
'fastcore.ansi': {},
|
|
38
36
|
'fastcore.apisurface': { 'fastcore.apisurface.OpGroup': ('apisurface.html#opgroup', 'fastcore/apisurface.py'),
|
|
39
37
|
'fastcore.apisurface.OpGroup.__allow__': ( 'apisurface.html#opgroup.__allow__',
|
|
40
38
|
'fastcore/apisurface.py'),
|
|
@@ -306,7 +304,6 @@ d = { 'settings': { 'branch': 'main',
|
|
|
306
304
|
'fastcore.basics.wrap_class': ('basics.html#wrap_class', 'fastcore/basics.py'),
|
|
307
305
|
'fastcore.basics.xdumps': ('basics.html#xdumps', 'fastcore/basics.py'),
|
|
308
306
|
'fastcore.basics.zip_cycle': ('basics.html#zip_cycle', 'fastcore/basics.py')},
|
|
309
|
-
'fastcore.dispatch': {},
|
|
310
307
|
'fastcore.docments': { 'fastcore.docments.DocmentList': ('docments.html#docmentlist', 'fastcore/docments.py'),
|
|
311
308
|
'fastcore.docments.DocmentList._fmt': ('docments.html#docmentlist._fmt', 'fastcore/docments.py'),
|
|
312
309
|
'fastcore.docments.DocmentList._repr_markdown_': ( 'docments.html#docmentlist._repr_markdown_',
|
|
@@ -392,8 +389,6 @@ d = { 'settings': { 'branch': 'main',
|
|
|
392
389
|
'fastcore.docments.qual_name': ('docments.html#qual_name', 'fastcore/docments.py'),
|
|
393
390
|
'fastcore.docments.sig2str': ('docments.html#sig2str', 'fastcore/docments.py'),
|
|
394
391
|
'fastcore.docments.sig_source': ('docments.html#sig_source', 'fastcore/docments.py')},
|
|
395
|
-
'fastcore.docscrape': {},
|
|
396
|
-
'fastcore.editskill': {},
|
|
397
392
|
'fastcore.foundation': { 'fastcore.foundation.CollBase': ('foundation.html#collbase', 'fastcore/foundation.py'),
|
|
398
393
|
'fastcore.foundation.CollBase.__delitem__': ( 'foundation.html#collbase.__delitem__',
|
|
399
394
|
'fastcore/foundation.py'),
|
|
@@ -513,8 +508,6 @@ d = { 'settings': { 'branch': 'main',
|
|
|
513
508
|
'fastcore.funccall.resolve_nm': ('funccall.html#resolve_nm', 'fastcore/funccall.py'),
|
|
514
509
|
'fastcore.funccall.schema2sig': ('funccall.html#schema2sig', 'fastcore/funccall.py'),
|
|
515
510
|
'fastcore.funccall.union_schema': ('funccall.html#union_schema', 'fastcore/funccall.py')},
|
|
516
|
-
'fastcore.imghdr': {},
|
|
517
|
-
'fastcore.imports': {},
|
|
518
511
|
'fastcore.meta': { 'fastcore.meta.AutoInit': ('meta.html#autoinit', 'fastcore/meta.py'),
|
|
519
512
|
'fastcore.meta.AutoInit.__pre_init__': ('meta.html#autoinit.__pre_init__', 'fastcore/meta.py'),
|
|
520
513
|
'fastcore.meta.BypassNewMeta': ('meta.html#bypassnewmeta', 'fastcore/meta.py'),
|
|
@@ -541,7 +534,6 @@ d = { 'settings': { 'branch': 'main',
|
|
|
541
534
|
'fastcore.meta.test_sig': ('meta.html#test_sig', 'fastcore/meta.py'),
|
|
542
535
|
'fastcore.meta.use_kwargs': ('meta.html#use_kwargs', 'fastcore/meta.py'),
|
|
543
536
|
'fastcore.meta.use_kwargs_dict': ('meta.html#use_kwargs_dict', 'fastcore/meta.py')},
|
|
544
|
-
'fastcore.nb_imports': {},
|
|
545
537
|
'fastcore.nbio': { 'fastcore.nbio.CellRow': ('nbio.html#cellrow', 'fastcore/nbio.py'),
|
|
546
538
|
'fastcore.nbio.CellRow.__init__': ('nbio.html#cellrow.__init__', 'fastcore/nbio.py'),
|
|
547
539
|
'fastcore.nbio.CellRow.__repr__': ('nbio.html#cellrow.__repr__', 'fastcore/nbio.py'),
|
|
@@ -753,10 +745,10 @@ d = { 'settings': { 'branch': 'main',
|
|
|
753
745
|
'fastcore.script.bool_arg': ('script.html#bool_arg', 'fastcore/script.py'),
|
|
754
746
|
'fastcore.script.call_parse': ('script.html#call_parse', 'fastcore/script.py'),
|
|
755
747
|
'fastcore.script.is_cli': ('script.html#is_cli', 'fastcore/script.py'),
|
|
748
|
+
'fastcore.script.parse_cli': ('script.html#parse_cli', 'fastcore/script.py'),
|
|
756
749
|
'fastcore.script.set_ctx': ('script.html#set_ctx', 'fastcore/script.py'),
|
|
757
750
|
'fastcore.script.store_false': ('script.html#store_false', 'fastcore/script.py'),
|
|
758
751
|
'fastcore.script.store_true': ('script.html#store_true', 'fastcore/script.py')},
|
|
759
|
-
'fastcore.shutil': {},
|
|
760
752
|
'fastcore.style': { 'fastcore.style.Style': ('style.html#style', 'fastcore/style.py'),
|
|
761
753
|
'fastcore.style.Style.__call__': ('style.html#style.__call__', 'fastcore/style.py'),
|
|
762
754
|
'fastcore.style.Style.__dir__': ('style.html#style.__dir__', 'fastcore/style.py'),
|
|
@@ -801,8 +793,6 @@ d = { 'settings': { 'branch': 'main',
|
|
|
801
793
|
'fastcore.tools.str_replace': ('tools.html#str_replace', 'fastcore/tools.py'),
|
|
802
794
|
'fastcore.tools.strs_replace': ('tools.html#strs_replace', 'fastcore/tools.py'),
|
|
803
795
|
'fastcore.tools.view_file': ('tools.html#view_file', 'fastcore/tools.py')},
|
|
804
|
-
'fastcore.transform': {},
|
|
805
|
-
'fastcore.utils': {},
|
|
806
796
|
'fastcore.xdg': { 'fastcore.xdg._path_from_env': ('xdg.html#_path_from_env', 'fastcore/xdg.py'),
|
|
807
797
|
'fastcore.xdg._paths_from_env': ('xdg.html#_paths_from_env', 'fastcore/xdg.py'),
|
|
808
798
|
'fastcore.xdg.xdg_cache_home': ('xdg.html#xdg_cache_home', 'fastcore/xdg.py'),
|
|
@@ -50,7 +50,7 @@ Edits accept line numbers, lnhash addresses, or section tokens. Get addresses wh
|
|
|
50
50
|
|
|
51
51
|
Prefer lnhash addresses when `exhash` is installed. The editor checks the hash against current content and rejects stale addresses. Plain line numbers are unverified and can shift after an edit. Re-view after each plain-line-number edit and apply multiple edits from bottom to top. Read `exhash.skill` for address formats and verified editing.
|
|
52
52
|
|
|
53
|
-
Section tokens identify sections in document outlines. In `1.6.|12|
|
|
53
|
+
Section tokens identify sections in document outlines. In `1.6.|12|Py|,45|HD|`, `1.6.` is the section number. The rest is the lnhash range for its first and last lines. `d.at(token)` returns the section after checking its hash. `d.view(tok1, tok2)` prints the rendered text of both sections. Use the boundary range to edit the section: `file_exhash(path, ('12|Py|,45|HD|', 'c', new_text))`.
|
|
54
54
|
|
|
55
55
|
Read `exhash.skill` before working through large Markdown, code, or notebook files, or documentation from a URL. It describes `open_doc` tree searches and link following, including the llms.txt workflow.
|
|
56
56
|
|
|
@@ -79,6 +79,8 @@ Enums show their choices as `{choice,...}`. Positional parameters show their nam
|
|
|
79
79
|
|
|
80
80
|
Union types such as `int|str` try each type in turn, and `enum` types such as those from `str_enum` become argparse choices.
|
|
81
81
|
|
|
82
|
+
`parse_cli` is the argument-handling half of a `call_parse` run. It parses `sys.argv` for `func`. It returns the positional arguments, the keyword arguments, and whether `--pdb` was passed. `call_parse` then calls `func` with them. Use `parse_cli` to write a decorator that reads arguments as `call_parse` does and runs `func` some other way. [warmpy](https://github.com/AnswerDotAI/warmpy) runs it in a warm background process.
|
|
83
|
+
|
|
82
84
|
## The CLI entry point
|
|
83
85
|
|
|
84
86
|
`call_parse` parses `sys.argv` when you run the function's file directly with `python foo.py`, `python -m foo` or `%run foo.py`. It also parses arguments on a zero-argument call from the top-level body of a directly run file. Console-script wrappers use this form.
|
|
@@ -130,8 +132,8 @@ Docs: https://fastcore.fast.ai/script.html.md"""
|
|
|
130
132
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/06_script.ipynb.
|
|
131
133
|
|
|
132
134
|
# %% auto #0
|
|
133
|
-
__all__ = ['store_true', 'store_false', 'bool_arg', 'anno2str', 'anno_parser', 'args_from_prog', 'set_ctx', '
|
|
134
|
-
'is_cli', 'CliError']
|
|
135
|
+
__all__ = ['store_true', 'store_false', 'bool_arg', 'anno2str', 'anno_parser', 'args_from_prog', 'set_ctx', 'parse_cli',
|
|
136
|
+
'call_parse', 'is_cli', 'CliError']
|
|
135
137
|
|
|
136
138
|
# %% ../nbs/06_script.ipynb #8a36db98
|
|
137
139
|
import inspect,argparse,shutil,types,asyncio,importlib.metadata
|
|
@@ -303,20 +305,26 @@ def _pos_split(func, args):
|
|
|
303
305
|
ks.append(k)
|
|
304
306
|
return [],args
|
|
305
307
|
|
|
308
|
+
# %% ../nbs/06_script.ipynb #1456b39c
|
|
309
|
+
def parse_cli(func, nested=False, pos:list=None):
|
|
310
|
+
"Positional args, keyword args, and the `--pdb` flag that `sys.argv` gives for `func`"
|
|
311
|
+
if len(sys.argv)>1 and sys.argv[1]=='': sys.argv.pop(1)
|
|
312
|
+
p = anno_parser(func, pos=pos)
|
|
313
|
+
if nested: args, sys.argv[1:] = p.parse_known_args()
|
|
314
|
+
else: args = p.parse_args()
|
|
315
|
+
args = args.__dict__
|
|
316
|
+
xtra = otherwise(args.pop('xtra', ''), eq(1), p.prog)
|
|
317
|
+
pdb = args.pop('pdb', False)
|
|
318
|
+
return *_pos_split(func, merge(args, args_from_prog(func, xtra))), pdb
|
|
319
|
+
|
|
306
320
|
# %% ../nbs/06_script.ipynb #dee5e259
|
|
307
321
|
_cli_func = ContextVar('_cli_func', default=None)
|
|
308
322
|
|
|
309
323
|
def _run_cli(func, nested, pos=None):
|
|
310
|
-
"
|
|
324
|
+
"Call `func` with the arguments `parse_cli` reads from `sys.argv`"
|
|
311
325
|
with set_ctx(_cli_func, func):
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
if nested: args, sys.argv[1:] = p.parse_known_args()
|
|
315
|
-
else: args = p.parse_args()
|
|
316
|
-
args = args.__dict__
|
|
317
|
-
xtra = otherwise(args.pop('xtra', ''), eq(1), p.prog)
|
|
318
|
-
tfunc = trace(func) if args.pop('pdb', False) else func
|
|
319
|
-
pargs,args = _pos_split(func, merge(args, args_from_prog(func, xtra)))
|
|
326
|
+
pargs,args,pdb = parse_cli(func, nested, pos)
|
|
327
|
+
tfunc = trace(func) if pdb else func
|
|
320
328
|
try:
|
|
321
329
|
res = tfunc(*pargs, **args)
|
|
322
330
|
if inspect.isawaitable(res): res = asyncio.run(res)
|
|
@@ -4,7 +4,7 @@ The text editors take a string and return the edited text. Invalid edits raise `
|
|
|
4
4
|
|
|
5
5
|
Read `fastcore.editskill` for the editing toolkit's naming, parameter and workflow conventions. It exposes these tools alongside the notebook editors from `fastcore.nbio`.
|
|
6
6
|
|
|
7
|
-
`line_hash`, `lnhash` and `lnhash_at` create [exhash](https://answerdotai.github.io/exhash) addresses without depending on the exhash package. Addresses use `lineno|hash|`. The hash is the low
|
|
7
|
+
`line_hash`, `lnhash` and `lnhash_at` create [exhash](https://answerdotai.github.io/exhash) addresses without depending on the exhash package. Addresses use `lineno|hash|`. The hash is the low 12 bits of CRC32, encoded as two Base64url characters (`A–Z`, `a–z`, `0–9`, `-`, `_`), high six bits first.
|
|
8
8
|
|
|
9
9
|
File editors take the path first and return a unified diff. An unchanged result returns `none: No changes.` Invalid edits return `error: ...`.
|
|
10
10
|
|
|
@@ -152,8 +152,10 @@ def del_lines(
|
|
|
152
152
|
def line_hash(
|
|
153
153
|
line:str # Text to hash; when hashing a single line, omit its trailing newline
|
|
154
154
|
)->str:
|
|
155
|
-
"
|
|
156
|
-
|
|
155
|
+
"2-char Base64url hash of `line`"
|
|
156
|
+
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'
|
|
157
|
+
h = zlib.crc32(line.encode())
|
|
158
|
+
return alphabet[(h>>6)&63] + alphabet[h&63]
|
|
157
159
|
|
|
158
160
|
def lnhash(
|
|
159
161
|
lineno:int, # 1-based line number
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastcore
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.30
|
|
4
4
|
Summary: Python supercharged for fastai development
|
|
5
5
|
Author-email: Jeremy Howard and Sylvain Gugger <infos@fast.ai>
|
|
6
|
-
License: Apache-2.0
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
7
|
Project-URL: Repository, https://github.com/AnswerDotAI/fastcore/
|
|
8
8
|
Project-URL: Documentation, https://fastcore.fast.ai/
|
|
9
9
|
Keywords: python
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools>=
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
@@ -8,7 +8,7 @@ dynamic = ["version"]
|
|
|
8
8
|
description = "Python supercharged for fastai development"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
11
|
-
license =
|
|
11
|
+
license = "Apache-2.0"
|
|
12
12
|
authors = [{name = "Jeremy Howard and Sylvain Gugger", email = "infos@fast.ai"}]
|
|
13
13
|
keywords = ['python']
|
|
14
14
|
classifiers = ["Natural Language :: English", "Intended Audience :: Developers", "Development Status :: 5 - Production/Stable", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only"]
|
|
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
|