fastcore 2.2.36__tar.gz → 2.2.38__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.36/fastcore.egg-info → fastcore-2.2.38}/PKG-INFO +1 -1
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/__init__.py +1 -1
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/_modidx.py +2 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/basics.py +10 -5
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/docments.py +15 -4
- {fastcore-2.2.36 → fastcore-2.2.38/fastcore.egg-info}/PKG-INFO +1 -1
- {fastcore-2.2.36 → fastcore-2.2.38}/CONTRIBUTING.md +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/LICENSE +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/README.md +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/aio.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/all.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/ansi.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/apisurface.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/dispatch.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/docscrape.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/editskill.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/foundation.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/funccall.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/imghdr.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/imports.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/meta.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/nb_imports.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/nbio.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/net.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/parallel.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/py2pyi.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/script.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/shutil.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/style.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/test.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/tools.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/transform.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/utils.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/xdg.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/xml.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore/xtras.py +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore.egg-info/SOURCES.txt +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore.egg-info/dependency_links.txt +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore.egg-info/entry_points.txt +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore.egg-info/requires.txt +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/fastcore.egg-info/top_level.txt +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/pyproject.toml +0 -0
- {fastcore-2.2.36 → fastcore-2.2.38}/setup.cfg +0 -0
|
@@ -70,6 +70,7 @@ d = { 'settings': { 'branch': 'main',
|
|
|
70
70
|
'fastcore.basics.DepProp.__set_name__': ('basics.html#depprop.__set_name__', 'fastcore/basics.py'),
|
|
71
71
|
'fastcore.basics.DepProp.norm': ('basics.html#depprop.norm', 'fastcore/basics.py'),
|
|
72
72
|
'fastcore.basics.Float': ('basics.html#float', 'fastcore/basics.py'),
|
|
73
|
+
'fastcore.basics.FullString': ('basics.html#fullstring', 'fastcore/basics.py'),
|
|
73
74
|
'fastcore.basics.GetAttr': ('basics.html#getattr', 'fastcore/basics.py'),
|
|
74
75
|
'fastcore.basics.GetAttr.__dir__': ('basics.html#getattr.__dir__', 'fastcore/basics.py'),
|
|
75
76
|
'fastcore.basics.GetAttr.__getattr__': ('basics.html#getattr.__getattr__', 'fastcore/basics.py'),
|
|
@@ -374,6 +375,7 @@ d = { 'settings': { 'branch': 'main',
|
|
|
374
375
|
'fastcore.docments._merge_docs': ('docments.html#_merge_docs', 'fastcore/docments.py'),
|
|
375
376
|
'fastcore.docments._param_locs': ('docments.html#_param_locs', 'fastcore/docments.py'),
|
|
376
377
|
'fastcore.docments._parses': ('docments.html#_parses', 'fastcore/docments.py'),
|
|
378
|
+
'fastcore.docments._relocated_source': ('docments.html#_relocated_source', 'fastcore/docments.py'),
|
|
377
379
|
'fastcore.docments._tokens': ('docments.html#_tokens', 'fastcore/docments.py'),
|
|
378
380
|
'fastcore.docments._type_str': ('docments.html#_type_str', 'fastcore/docments.py'),
|
|
379
381
|
'fastcore.docments._unwrap_sym': ('docments.html#_unwrap_sym', 'fastcore/docments.py'),
|
|
@@ -54,10 +54,11 @@ __all__ = ['defaults', 'null', 'num_methods', 'rnum_methods', 'inum_methods', 'a
|
|
|
54
54
|
'loop_first_last', 'loop_first', 'loop_last', 'first_match', 'last_match', 'joins', 'fastuple', 'bind',
|
|
55
55
|
'mapt', 'map_ex', 'compose', 'maps', 'partialler', 'instantiate', 'using_attr', 'negate', 'fail_clean',
|
|
56
56
|
'dstar', 'copy_func', 'patch_to', 'patch', 'extend_enum', 'compile_re', 'ImportEnum', 'StrEnum', 'str_enum',
|
|
57
|
-
'ValEnum', 'Stateful', 'NotStr', 'PrettyString', '
|
|
58
|
-
'str2int', 'str2float', 'str2list', 'str2date', 'str2dt', 'to_bool', 'to_int', 'to_float',
|
|
59
|
-
'to_date', 'typed', 'exec_new', 'exec_import', 'kindsort', 'sig_with_params', 'fdelegates',
|
|
60
|
-
'revive_dates', 'lt', 'gt', 'le', 'ge', 'eq', 'ne', 'add', 'sub', 'mul', 'truediv', 'is_',
|
|
57
|
+
'ValEnum', 'Stateful', 'NotStr', 'PrettyString', 'FullString', 'even_mults', 'num_cpus', 'add_props',
|
|
58
|
+
'str2bool', 'str2int', 'str2float', 'str2list', 'str2date', 'str2dt', 'to_bool', 'to_int', 'to_float',
|
|
59
|
+
'to_list', 'to_date', 'typed', 'exec_new', 'exec_import', 'kindsort', 'sig_with_params', 'fdelegates',
|
|
60
|
+
'xdumps', 'revive_dates', 'lt', 'gt', 'le', 'ge', 'eq', 'ne', 'add', 'sub', 'mul', 'truediv', 'is_',
|
|
61
|
+
'is_not', 'mod']
|
|
61
62
|
|
|
62
63
|
# %% ../nbs/01_basics.ipynb #0e91ed82
|
|
63
64
|
from .imports import *
|
|
@@ -1314,7 +1315,11 @@ class NotStr(GetAttr):
|
|
|
1314
1315
|
class PrettyString(str):
|
|
1315
1316
|
"Little hack to get strings to show properly in Jupyter."
|
|
1316
1317
|
def __repr__(self): return self
|
|
1317
|
-
|
|
1318
|
+
|
|
1319
|
+
# %% ../nbs/01_basics.ipynb #591c0a8a
|
|
1320
|
+
class FullString(PrettyString):
|
|
1321
|
+
"A pretty string that tools leave untruncated."
|
|
1322
|
+
full = True
|
|
1318
1323
|
|
|
1319
1324
|
# %% ../nbs/01_basics.ipynb #a5138103
|
|
1320
1325
|
def even_mults(start, stop, n):
|
|
@@ -24,7 +24,7 @@ __all__ = ['empty', 'docstring', 'parse_docstring', 'isdataclass', 'get_dataclas
|
|
|
24
24
|
'sig2str', 'can_render', 'ShowDocRenderer', 'MarkdownRenderer']
|
|
25
25
|
|
|
26
26
|
# %% ../nbs/04_docments.ipynb #4c662acc
|
|
27
|
-
import re,ast,inspect
|
|
27
|
+
import re,ast,inspect,linecache
|
|
28
28
|
from tokenize import tokenize,COMMENT
|
|
29
29
|
from ast import parse,FunctionDef,AsyncFunctionDef,AnnAssign
|
|
30
30
|
from io import BytesIO
|
|
@@ -72,6 +72,16 @@ def _defines(src, f):
|
|
|
72
72
|
d = re.search(r'^\s*(?:async\s+)?def\s+(\w+)', src, re.M)
|
|
73
73
|
return bool(re.match(r'\s*(@|(async\s+)?def\s)', src)) and bool(d) and d[1]==nm
|
|
74
74
|
|
|
75
|
+
def _relocated_source(f):
|
|
76
|
+
src = ''.join(linecache.getlines(inspect.getfile(f), f.__globals__))
|
|
77
|
+
node = parse(src)
|
|
78
|
+
for name in f.__qualname__.replace('.<locals>', '').split('.'):
|
|
79
|
+
nodes = [o for o in node.body if isinstance(o, (FunctionDef,AsyncFunctionDef,ast.ClassDef)) and o.name==name]
|
|
80
|
+
if len(nodes)!=1: raise OSError(f"Could not locate source for {f.__qualname__}")
|
|
81
|
+
node = nodes[0]
|
|
82
|
+
start = min([node.lineno, *(d.lineno for d in node.decorator_list)])-1
|
|
83
|
+
return ''.join(src.splitlines(keepends=True)[start:node.end_lineno])
|
|
84
|
+
|
|
75
85
|
def get_source(s):
|
|
76
86
|
"Get source for a function, callable implementation, dataclass, or source string"
|
|
77
87
|
if isinstance(s,str): return s
|
|
@@ -79,9 +89,10 @@ def get_source(s):
|
|
|
79
89
|
if isinstance(s, partial): s = s.func
|
|
80
90
|
if _callable_instance(s): s = s.__call__
|
|
81
91
|
if not (isfunction(s) or ismethod(s)): return get_dataclass_source(s) if isdataclass(s) else None
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return
|
|
92
|
+
f = getattr(s, '__func__', s)
|
|
93
|
+
try: src = getsource(s)
|
|
94
|
+
except OSError: return _relocated_source(f)
|
|
95
|
+
return src if _defines(src, f) else _relocated_source(f)
|
|
85
96
|
|
|
86
97
|
# %% ../nbs/04_docments.ipynb #40e3f274
|
|
87
98
|
def _get_property_name(p):
|
|
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
|