fastcore 2.2.35__tar.gz → 2.2.37__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.35/fastcore.egg-info → fastcore-2.2.37}/PKG-INFO +1 -1
  2. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/__init__.py +1 -1
  3. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/_modidx.py +2 -0
  4. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/basics.py +10 -5
  5. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/docments.py +12 -2
  6. {fastcore-2.2.35 → fastcore-2.2.37/fastcore.egg-info}/PKG-INFO +1 -1
  7. {fastcore-2.2.35 → fastcore-2.2.37}/CONTRIBUTING.md +0 -0
  8. {fastcore-2.2.35 → fastcore-2.2.37}/LICENSE +0 -0
  9. {fastcore-2.2.35 → fastcore-2.2.37}/README.md +0 -0
  10. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/aio.py +0 -0
  11. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/all.py +0 -0
  12. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/ansi.py +0 -0
  13. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/apisurface.py +0 -0
  14. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/dispatch.py +0 -0
  15. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/docscrape.py +0 -0
  16. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/editskill.py +0 -0
  17. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/foundation.py +0 -0
  18. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/funccall.py +0 -0
  19. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/imghdr.py +0 -0
  20. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/imports.py +0 -0
  21. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/meta.py +0 -0
  22. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/nb_imports.py +0 -0
  23. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/nbio.py +0 -0
  24. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/net.py +0 -0
  25. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/parallel.py +0 -0
  26. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/py2pyi.py +0 -0
  27. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/script.py +0 -0
  28. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/shutil.py +0 -0
  29. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/style.py +0 -0
  30. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/test.py +0 -0
  31. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/tools.py +0 -0
  32. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/transform.py +0 -0
  33. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/utils.py +0 -0
  34. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/xdg.py +0 -0
  35. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/xml.py +0 -0
  36. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore/xtras.py +0 -0
  37. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore.egg-info/SOURCES.txt +0 -0
  38. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore.egg-info/dependency_links.txt +0 -0
  39. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore.egg-info/entry_points.txt +0 -0
  40. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore.egg-info/requires.txt +0 -0
  41. {fastcore-2.2.35 → fastcore-2.2.37}/fastcore.egg-info/top_level.txt +0 -0
  42. {fastcore-2.2.35 → fastcore-2.2.37}/pyproject.toml +0 -0
  43. {fastcore-2.2.35 → fastcore-2.2.37}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastcore
3
- Version: 2.2.35
3
+ Version: 2.2.37
4
4
  Summary: Python supercharged for fastai development
5
5
  Author-email: Jeremy Howard and Sylvain Gugger <infos@fast.ai>
6
6
  License-Expression: Apache-2.0
@@ -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.35"
58
+ __version__ = "2.2.37"
@@ -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'),
@@ -358,6 +359,7 @@ d = { 'settings': { 'branch': 'main',
358
359
  'fastcore.docments._callable_instance': ('docments.html#_callable_instance', 'fastcore/docments.py'),
359
360
  'fastcore.docments._clean_comment': ('docments.html#_clean_comment', 'fastcore/docments.py'),
360
361
  'fastcore.docments._clean_text_sig': ('docments.html#_clean_text_sig', 'fastcore/docments.py'),
362
+ 'fastcore.docments._defines': ('docments.html#_defines', 'fastcore/docments.py'),
361
363
  'fastcore.docments._docstring': ('docments.html#_docstring', 'fastcore/docments.py'),
362
364
  'fastcore.docments._escape_markdown': ('docments.html#_escape_markdown', 'fastcore/docments.py'),
363
365
  'fastcore.docments._fmt_default': ('docments.html#_fmt_default', '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', 'even_mults', 'num_cpus', 'add_props', 'str2bool',
58
- 'str2int', 'str2float', 'str2list', 'str2date', 'str2dt', 'to_bool', 'to_int', 'to_float', 'to_list',
59
- 'to_date', 'typed', 'exec_new', 'exec_import', 'kindsort', 'sig_with_params', 'fdelegates', 'xdumps',
60
- 'revive_dates', 'lt', 'gt', 'le', 'ge', 'eq', 'ne', 'add', 'sub', 'mul', 'truediv', 'is_', 'is_not', 'mod']
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
- full = True # Tools that truncate long strings show this whole
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):
@@ -65,13 +65,23 @@ def get_dataclass_source(s):
65
65
  "Get source code for dataclass `s`"
66
66
  return getsource(s) if not getattr(s, "__module__") == '__main__' else ""
67
67
 
68
+ def _defines(src, f):
69
+ "Whether `src` begins with function `f`'s decorators or `def`, and its first `def` has `f`'s name"
70
+ nm = f.__code__.co_name
71
+ if nm == '<lambda>': return True
72
+ d = re.search(r'^\s*(?:async\s+)?def\s+(\w+)', src, re.M)
73
+ return bool(re.match(r'\s*(@|(async\s+)?def\s)', src)) and bool(d) and d[1]==nm
74
+
68
75
  def get_source(s):
69
76
  "Get source for a function, callable implementation, dataclass, or source string"
70
77
  if isinstance(s,str): return s
71
78
  s = inspect.unwrap(s)
72
79
  if isinstance(s, partial): s = s.func
73
80
  if _callable_instance(s): s = s.__call__
74
- return getsource(s) if isfunction(s) or ismethod(s) else get_dataclass_source(s) if isdataclass(s) else None
81
+ if not (isfunction(s) or ismethod(s)): return get_dataclass_source(s) if isdataclass(s) else None
82
+ src,f = getsource(s),getattr(s, '__func__', s)
83
+ if not _defines(src, f): raise OSError(f"The source of `{f.__qualname__}` changed since it was imported; reload its module")
84
+ return src
75
85
 
76
86
  # %% ../nbs/04_docments.ipynb #40e3f274
77
87
  def _get_property_name(p):
@@ -106,7 +116,7 @@ def _parses(s):
106
116
  try: return parse(dedent(get_source(s) or ''))
107
117
  except SyntaxError:
108
118
  if isinstance(s,str): raise
109
- return parse('') # live object whose file changed on disk since import: degrade to no docments
119
+ return parse('') # a live object whose source line does not parse alone, such as a lambda inside a call: no docments
110
120
 
111
121
  def _tokens(s):
112
122
  "Tokenize Python code in string or function object `s`"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastcore
3
- Version: 2.2.35
3
+ Version: 2.2.37
4
4
  Summary: Python supercharged for fastai development
5
5
  Author-email: Jeremy Howard and Sylvain Gugger <infos@fast.ai>
6
6
  License-Expression: Apache-2.0
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