Skip to content

Commit

Permalink
Merge pull request #1042 from afeld/patch-1
Browse files Browse the repository at this point in the history
simplify the function signature for preprocess()
  • Loading branch information
MSeal authored Jun 3, 2019
2 parents d7e7124 + ad6d34b commit 76c9e5a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions nbconvert/preprocessors/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def setup_preprocessor(self, nb, resources, km=None, **kwargs):
for attr in ['nb', 'km', 'kc']:
delattr(self, attr)

def preprocess(self, nb, resources, km=None):
def preprocess(self, nb, resources=None, km=None):
"""
Preprocess notebook executing each code cell.
Expand All @@ -381,7 +381,7 @@ def preprocess(self, nb, resources, km=None):
----------
nb : NotebookNode
Notebook being executed.
resources : dictionary
resources : dictionary (optional)
Additional resources used in the conversion process. For example,
passing ``{'metadata': {'path': run_path}}`` sets the
execution path to ``run_path``.
Expand All @@ -397,6 +397,9 @@ def preprocess(self, nb, resources, km=None):
Additional resources used in the conversion process.
"""

if not resources:
resources = {}

with self.setup_preprocessor(nb, resources, km=km):
self.log.info("Executing notebook with kernel: %s" % self.kernel_name)
nb, resources = super(ExecutePreprocessor, self).preprocess(nb, resources)
Expand Down

0 comments on commit 76c9e5a

Please sign in to comment.