fastcore 2.2.27__tar.gz → 2.2.29__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.
Files changed (43) hide show
  1. {fastcore-2.2.27/fastcore.egg-info → fastcore-2.2.29}/PKG-INFO +3 -1
  2. {fastcore-2.2.27 → fastcore-2.2.29}/README.md +2 -0
  3. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/__init__.py +1 -1
  4. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/editskill.py +1 -1
  5. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/tools.py +5 -3
  6. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/xtras.py +7 -2
  7. {fastcore-2.2.27 → fastcore-2.2.29/fastcore.egg-info}/PKG-INFO +3 -1
  8. {fastcore-2.2.27 → fastcore-2.2.29}/CONTRIBUTING.md +0 -0
  9. {fastcore-2.2.27 → fastcore-2.2.29}/LICENSE +0 -0
  10. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/_modidx.py +0 -0
  11. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/aio.py +0 -0
  12. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/all.py +0 -0
  13. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/ansi.py +0 -0
  14. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/apisurface.py +0 -0
  15. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/basics.py +0 -0
  16. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/dispatch.py +0 -0
  17. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/docments.py +0 -0
  18. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/docscrape.py +0 -0
  19. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/foundation.py +0 -0
  20. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/funccall.py +0 -0
  21. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/imghdr.py +0 -0
  22. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/imports.py +0 -0
  23. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/meta.py +0 -0
  24. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/nb_imports.py +0 -0
  25. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/nbio.py +0 -0
  26. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/net.py +0 -0
  27. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/parallel.py +0 -0
  28. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/py2pyi.py +0 -0
  29. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/script.py +0 -0
  30. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/shutil.py +0 -0
  31. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/style.py +0 -0
  32. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/test.py +0 -0
  33. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/transform.py +0 -0
  34. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/utils.py +0 -0
  35. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/xdg.py +0 -0
  36. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore/xml.py +0 -0
  37. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore.egg-info/SOURCES.txt +0 -0
  38. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore.egg-info/dependency_links.txt +0 -0
  39. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore.egg-info/entry_points.txt +0 -0
  40. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore.egg-info/requires.txt +0 -0
  41. {fastcore-2.2.27 → fastcore-2.2.29}/fastcore.egg-info/top_level.txt +0 -0
  42. {fastcore-2.2.27 → fastcore-2.2.29}/pyproject.toml +0 -0
  43. {fastcore-2.2.27 → fastcore-2.2.29}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastcore
3
- Version: 2.2.27
3
+ Version: 2.2.29
4
4
  Summary: Python supercharged for fastai development
5
5
  Author-email: Jeremy Howard and Sylvain Gugger <infos@fast.ai>
6
6
  License: Apache-2.0
@@ -88,6 +88,8 @@ To install fastcore run: `conda install fastcore -c fastai` (if you use Anaconda
88
88
 
89
89
  To get started, we recommend you read through [the fastcore tour](https://fastcore.fast.ai/tour.html).
90
90
 
91
+ [`globtastic`](https://fastcore.fast.ai/xtras.html#globtastic) supports filename filters (`file_glob`, `file_re`) and full-path filters (`path_glob`, `path_re`). Glob filters use `fnmatch`: `*` matches directory separators and `**` has no special meaning.
92
+
91
93
  ## Contributing
92
94
 
93
95
  After you clone this repository, please run `nbdev_install_hooks` in your terminal. This sets up git hooks, which clean up the notebooks to remove the extraneous stuff stored in the notebooks (e.g. which cells you ran) which causes unnecessary merge conflicts.
@@ -57,6 +57,8 @@ To install fastcore run: `conda install fastcore -c fastai` (if you use Anaconda
57
57
 
58
58
  To get started, we recommend you read through [the fastcore tour](https://fastcore.fast.ai/tour.html).
59
59
 
60
+ [`globtastic`](https://fastcore.fast.ai/xtras.html#globtastic) supports filename filters (`file_glob`, `file_re`) and full-path filters (`path_glob`, `path_re`). Glob filters use `fnmatch`: `*` matches directory separators and `**` has no special meaning.
61
+
60
62
  ## Contributing
61
63
 
62
64
  After you clone this repository, please run `nbdev_install_hooks` in your terminal. This sets up git hooks, which clean up the notebooks to remove the extraneous stuff stored in the notebooks (e.g. which cells you ran) which causes unnecessary merge conflicts.
@@ -55,4 +55,4 @@ Modules:
55
55
  - `fastcore.xml`: Concise HTML generation and namespace-aware XML construction.
56
56
  - `fastcore.xtras`: Utility functions used in the fastai library"""
57
57
 
58
- __version__ = "2.2.27"
58
+ __version__ = "2.2.29"
@@ -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|a3f2|,45|b1c3|`, `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|a3f2|,45|b1c3|', 'c', new_text))`.
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
 
@@ -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 16 bits of CRC32, formatted as four hexadecimal characters.
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
- "4-char hex hash of `line`"
156
- return f'{zlib.crc32(line.encode()) & 0xffff:04x}'
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
@@ -138,6 +138,8 @@ def globtastic(
138
138
  symlinks:bool=True, # follow symlinks?
139
139
  file_glob:str=None, # Only include files matching glob
140
140
  file_re:str=None, # Only include files matching regex
141
+ path_glob:str=None, # Only include files whose full paths match glob (wildcards match separators)
142
+ path_re:str=None, # Only include files whose full paths match regex
141
143
  folder_re:str=None, # Only enter folders matching regex
142
144
  skip_file_glob:str=None, # Skip files matching glob
143
145
  skip_file_re:str=None, # Skip files matching regex
@@ -158,10 +160,13 @@ def globtastic(
158
160
  if exts:
159
161
  exts = [e if e.startswith('.') else f'.{e}' for e in listify(exts)]
160
162
  file_re = f"({'|'.join(re.escape(e) for e in exts)})$"
161
- file_re,folder_re = compile_re(file_re),compile_re(folder_re)
163
+ file_re,folder_re,path_re = compile_re(file_re),compile_re(folder_re),compile_re(path_re)
162
164
  skip_file_re,skip_folder_re = compile_re(skip_file_re),compile_re(skip_folder_re)
163
165
  def _keep_file(root, name):
164
- return (not file_glob or fnmatch(name, file_glob)) and (
166
+ fname = os.path.join(root,name)
167
+ return (not path_glob or fnmatch(fname, path_glob)) and (
168
+ not path_re or path_re.search(fname)) and (
169
+ not file_glob or fnmatch(name, file_glob)) and (
165
170
  not file_re or file_re.search(name)) and (
166
171
  not skip_file_glob or not fnmatch(name, skip_file_glob)) and (
167
172
  not skip_file_re or not skip_file_re.search(name))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastcore
3
- Version: 2.2.27
3
+ Version: 2.2.29
4
4
  Summary: Python supercharged for fastai development
5
5
  Author-email: Jeremy Howard and Sylvain Gugger <infos@fast.ai>
6
6
  License: Apache-2.0
@@ -88,6 +88,8 @@ To install fastcore run: `conda install fastcore -c fastai` (if you use Anaconda
88
88
 
89
89
  To get started, we recommend you read through [the fastcore tour](https://fastcore.fast.ai/tour.html).
90
90
 
91
+ [`globtastic`](https://fastcore.fast.ai/xtras.html#globtastic) supports filename filters (`file_glob`, `file_re`) and full-path filters (`path_glob`, `path_re`). Glob filters use `fnmatch`: `*` matches directory separators and `**` has no special meaning.
92
+
91
93
  ## Contributing
92
94
 
93
95
  After you clone this repository, please run `nbdev_install_hooks` in your terminal. This sets up git hooks, which clean up the notebooks to remove the extraneous stuff stored in the notebooks (e.g. which cells you ran) which causes unnecessary merge conflicts.
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