fastcore 2.2.4__tar.gz → 2.2.5__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 (44) hide show
  1. {fastcore-2.2.4/fastcore.egg-info → fastcore-2.2.5}/PKG-INFO +1 -1
  2. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/__init__.py +1 -1
  3. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/_modidx.py +1 -2
  4. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/nbio.py +21 -37
  5. {fastcore-2.2.4 → fastcore-2.2.5/fastcore.egg-info}/PKG-INFO +1 -1
  6. {fastcore-2.2.4 → fastcore-2.2.5}/CONTRIBUTING.md +0 -0
  7. {fastcore-2.2.4 → fastcore-2.2.5}/LICENSE +0 -0
  8. {fastcore-2.2.4 → fastcore-2.2.5}/MANIFEST.in +0 -0
  9. {fastcore-2.2.4 → fastcore-2.2.5}/README.md +0 -0
  10. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/aio.py +0 -0
  11. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/all.py +0 -0
  12. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/ansi.py +0 -0
  13. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/apisurface.py +0 -0
  14. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/basics.py +0 -0
  15. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/dispatch.py +0 -0
  16. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/docments.py +0 -0
  17. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/docscrape.py +0 -0
  18. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/editskill.py +0 -0
  19. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/foundation.py +0 -0
  20. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/funccall.py +0 -0
  21. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/imghdr.py +0 -0
  22. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/imports.py +0 -0
  23. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/meta.py +0 -0
  24. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/nb_imports.py +0 -0
  25. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/net.py +0 -0
  26. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/parallel.py +0 -0
  27. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/py2pyi.py +0 -0
  28. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/script.py +0 -0
  29. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/shutil.py +0 -0
  30. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/style.py +0 -0
  31. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/test.py +0 -0
  32. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/tools.py +0 -0
  33. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/transform.py +0 -0
  34. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/utils.py +0 -0
  35. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/xdg.py +0 -0
  36. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/xml.py +0 -0
  37. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore/xtras.py +0 -0
  38. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore.egg-info/SOURCES.txt +0 -0
  39. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore.egg-info/dependency_links.txt +0 -0
  40. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore.egg-info/entry_points.txt +0 -0
  41. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore.egg-info/requires.txt +0 -0
  42. {fastcore-2.2.4 → fastcore-2.2.5}/fastcore.egg-info/top_level.txt +0 -0
  43. {fastcore-2.2.4 → fastcore-2.2.5}/pyproject.toml +0 -0
  44. {fastcore-2.2.4 → fastcore-2.2.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastcore
3
- Version: 2.2.4
3
+ Version: 2.2.5
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
@@ -55,4 +55,4 @@ Modules:
55
55
  - `fastcore.xml`: Concise generation of XML.
56
56
  - `fastcore.xtras`: Utility functions used in the fastai library"""
57
57
 
58
- __version__ = "2.2.4"
58
+ __version__ = "2.2.5"
@@ -611,7 +611,6 @@ d = { 'settings': { 'branch': 'main',
611
611
  'fastcore.nbio.deep_merge': ('nbio.html#deep_merge', 'fastcore/nbio.py'),
612
612
  'fastcore.nbio.dict2nb': ('nbio.html#dict2nb', 'fastcore/nbio.py'),
613
613
  'fastcore.nbio.dir_tag': ('nbio.html#dir_tag', 'fastcore/nbio.py'),
614
- 'fastcore.nbio.exec_cell': ('nbio.html#exec_cell', 'fastcore/nbio.py'),
615
614
  'fastcore.nbio.find_cells': ('nbio.html#find_cells', 'fastcore/nbio.py'),
616
615
  'fastcore.nbio.find_id': ('nbio.html#find_id', 'fastcore/nbio.py'),
617
616
  'fastcore.nbio.first_code_ln': ('nbio.html#first_code_ln', 'fastcore/nbio.py'),
@@ -638,8 +637,8 @@ d = { 'settings': { 'branch': 'main',
638
637
  'fastcore.nbio.render_text': ('nbio.html#render_text', 'fastcore/nbio.py'),
639
638
  'fastcore.nbio.repair_cell': ('nbio.html#repair_cell', 'fastcore/nbio.py'),
640
639
  'fastcore.nbio.repair_nb': ('nbio.html#repair_nb', 'fastcore/nbio.py'),
640
+ 'fastcore.nbio.run_cell': ('nbio.html#run_cell', 'fastcore/nbio.py'),
641
641
  'fastcore.nbio.select_cells': ('nbio.html#select_cells', 'fastcore/nbio.py'),
642
- 'fastcore.nbio.show_cell': ('nbio.html#show_cell', 'fastcore/nbio.py'),
643
642
  'fastcore.nbio.summary_nb': ('nbio.html#summary_nb', 'fastcore/nbio.py'),
644
643
  'fastcore.nbio.update_cell': ('nbio.html#update_cell', 'fastcore/nbio.py'),
645
644
  'fastcore.nbio.validate_cell': ('nbio.html#validate_cell', 'fastcore/nbio.py'),
@@ -16,7 +16,7 @@ __all__ = ['langs', 'cell_insert_line', 'cell_str_replace', 'cell_strs_replace',
16
16
  'preferred_out', 'join_out', 'mk_stream', 'mk_result', 'mk_display', 'mk_error', 'concat_streams',
17
17
  'preferred_msg_out', 'render_output', 'render_outputs', 'render_text', 'item2xml', 'cell2xml', 'cells2xml',
18
18
  'Notebook', 'CellRow', 'CellRows', 'summary_nb', 'Found', 'FoundCells', 'find_cells', 'deep_merge',
19
- 'update_cell', 'select_cells', 'exec_cell', 'show_cell', 'msg2out', 'msgs2outs']
19
+ 'update_cell', 'select_cells', 'run_cell', 'msg2out', 'msgs2outs']
20
20
 
21
21
  # %% ../nbs/13_nbio.ipynb #954ca1aa
22
22
  from .basics import *
@@ -866,44 +866,28 @@ def select_cells(
866
866
  if skip_noeval: sel = [o for o in sel if not _is_noeval(o)]
867
867
  return sel
868
868
 
869
- # %% ../nbs/13_nbio.ipynb #b30755db
870
- async def exec_cell(
871
- shell, # An IPython `InteractiveShell` (or compatible: `transform_cell`, `compile`, `user_ns`, `events`)
872
- src:str, # Cell source: magics, `!` commands, and top-level `await` all work
873
- ): # The final bare expression's value (None if there is none, or a trailing `;` suppresses it)
874
- "Run cell `src` in `shell` as a library call: the value and any exception go to the caller, and only the code's own output is shown"
875
- __tracebackhide__ = True
876
- xsrc = shell.transform_cell(src)
877
- tree,cfname = ast.parse(xsrc),shell.compile.cache(xsrc)
878
- expr = tree.body.pop().value if tree.body and isinstance(tree.body[-1], ast.Expr) else None
879
- async def _go(node, mode):
880
- __tracebackhide__ = "__ipython_bottom__" # to the debugger: all frames above are host machinery
881
- co = compile(ast.fix_missing_locations(node), cfname, mode, flags=ast.PyCF_ALLOW_TOP_LEVEL_AWAIT)
882
- r = eval(co, shell.user_global_ns, shell.user_ns)
883
- return await r if co.co_flags & inspect.CO_COROUTINE else r
884
- shell.events.trigger('pre_execute')
885
- r = None
886
- try:
887
- if tree.body: await _go(tree, 'exec')
888
- if expr is not None: r = await _go(ast.Expression(body=expr), 'eval')
889
- finally: shell.events.trigger('post_execute')
890
- if src.rstrip().endswith(';') and not src.lstrip().startswith('%%'): return
891
- return r
892
-
893
- # %% ../nbs/13_nbio.ipynb #6b39aa5b
894
- async def show_cell(
895
- shell, # An IPython `InteractiveShell` (or compatible), as `exec_cell`
896
- src:str, # Cell source, as `exec_cell`
897
- raise_exc:bool=True, # Raise a failing cell's exception? Else display its traceback as the outcome
869
+ # %% ../nbs/13_nbio.ipynb #4c71f592
870
+ async def run_cell(
871
+ shell, # An `InteractiveShell`-compatible object: `transform_cell`, `run_cell_async`, `events`
872
+ raw_cell:str, # Python/IPython source for one cell: magics, `!` commands, and top-level `await` all work
873
+ store_history:bool=False, # Store the cell in the shell's history? (enables native `;` suppression and execution counts)
874
+ silent:bool=False, # Suppress displayhook and `post_run_cell` event? (the result value stays unset)
875
+ shell_futures:bool=True, # Share `__future__` imports with the shell?
876
+ cell_id=None, # Optional cell id, passed through to `run_cell_async`
898
877
  ):
899
- "Run cell `src` in `shell` and display its result, notebook-style"
900
- from IPython.display import display
901
- try: r = await exec_cell(shell, src)
878
+ "Run one cell on `shell`: transform, await `run_cell_async` on the calling loop, and fire the post events; returns the `ExecutionResult`"
879
+ preprocessing_exc_tuple = None
880
+ try: transformed_cell = shell.transform_cell(raw_cell)
902
881
  except Exception:
903
- if raise_exc: raise
904
- traceback.print_exc()
905
- return
906
- if r is not None: display(r)
882
+ transformed_cell = raw_cell
883
+ preprocessing_exc_tuple = sys.exc_info()
884
+ result = None
885
+ try: result = await shell.run_cell_async(raw_cell, store_history, silent, shell_futures=shell_futures,
886
+ transformed_cell=transformed_cell, preprocessing_exc_tuple=preprocessing_exc_tuple, cell_id=cell_id)
887
+ finally:
888
+ shell.events.trigger('post_execute')
889
+ if not silent: shell.events.trigger('post_run_cell', result)
890
+ return result
907
891
 
908
892
  # %% ../nbs/13_nbio.ipynb #ec976147
909
893
  def _msg_type(msg): return msg.get('msg_type') or msg['header']['msg_type']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastcore
3
- Version: 2.2.4
3
+ Version: 2.2.5
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
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