execnb 0.2.1__tar.gz → 0.2.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: execnb
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: A description of your project
5
5
  Author-email: Jeremy Howard <j@fast.ai>
6
6
  License: Apache-2.0
@@ -0,0 +1 @@
1
+ __version__ = "0.2.2"
@@ -27,9 +27,6 @@ from IPython.display import display as disp, HTML
27
27
 
28
28
  from base64 import b64encode
29
29
  from html import escape
30
- try: from matplotlib_inline.backend_inline import set_matplotlib_formats
31
- except ImportError: set_matplotlib_formats = None
32
-
33
30
 
34
31
  from fastcore.nbio import *
35
32
  from fastcore.nbio import _dict2obj
@@ -59,10 +56,13 @@ class CaptureShell(InteractiveShell):
59
56
  if path: self.set_path(path)
60
57
  self.display_formatter.active = True
61
58
  if not IN_NOTEBOOK: InteractiveShell._instance = self
62
- if set_matplotlib_formats:
63
- self.enable_matplotlib("inline")
64
- self._run("from matplotlib_inline.backend_inline import set_matplotlib_formats")
65
- self._run(f"set_matplotlib_formats('{mpl_format}')")
59
+ if mpl_format:
60
+ try: from matplotlib_inline.backend_inline import set_matplotlib_formats
61
+ except ImportError: set_matplotlib_formats = None
62
+ if set_matplotlib_formats:
63
+ self.enable_matplotlib("inline")
64
+ self._run("from matplotlib_inline.backend_inline import set_matplotlib_formats")
65
+ self._run(f"set_matplotlib_formats('{mpl_format}')")
66
66
 
67
67
  def _run(self, raw_cell, store_history=False, silent=False, shell_futures=True, cell_id=None,
68
68
  stdout=True, stderr=True, display=True, verbose=False):
@@ -73,13 +73,13 @@ class CaptureShell(InteractiveShell):
73
73
  return AttrDict(result=result, stdout='' if semic else c.stdout, stderr=c.stderr,
74
74
  display_objects=c.outputs,
75
75
  exception=result.error_in_exec or result.error_before_exec, quiet=semic)
76
-
76
+
77
77
  def set_path(self, path):
78
78
  "Add `path` to python path, or `path.parent` if it's a file"
79
79
  path = Path(path)
80
80
  if path.is_file(): path = path.parent
81
81
  self._run(f"import sys; sys.path.insert(0, '{path.as_posix()}')")
82
-
82
+
83
83
  def enable_gui(self, gui=None): pass
84
84
 
85
85
  # %% ../nbs/00_shell.ipynb #93adf867
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: execnb
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: A description of your project
5
5
  Author-email: Jeremy Howard <j@fast.ai>
6
6
  License: Apache-2.0
@@ -1 +0,0 @@
1
- __version__ = "0.2.1"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes