Skip to content

Commit

Permalink
Remove deepcopy step during parameterize_notebook. (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
surdouski committed Aug 12, 2022
1 parent a3f530e commit d699e2a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
5 changes: 0 additions & 5 deletions papermill/execute.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-

import copy
import nbformat
from pathlib import Path

Expand Down Expand Up @@ -148,9 +147,6 @@ def prepare_notebook_metadata(nb, input_path, output_path, report_mode=False):
report_mode : bool, optional
Flag to set report mode
"""
# Copy the nb object to avoid polluting the input
nb = copy.deepcopy(nb)

# Hide input if report-mode is set to True.
if report_mode:
for cell in nb.cells:
Expand Down Expand Up @@ -185,7 +181,6 @@ def prepare_notebook_metadata(nb, input_path, output_path, report_mode=False):


def remove_error_markers(nb):
nb = copy.deepcopy(nb)
nb.cells = [cell for cell in nb.cells if ERROR_MARKER_TAG not in cell.metadata.get("tags", [])]
return nb

Expand Down
4 changes: 0 additions & 4 deletions papermill/parameterize.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import copy
import nbformat

from .engines import papermill_engines
Expand Down Expand Up @@ -83,9 +82,6 @@ def parameterize_notebook(
if isinstance(parameters, str):
parameters = read_yaml_file(parameters)

# Copy the nb object to avoid polluting the input
nb = copy.deepcopy(nb)

# Fetch out the name and language from the notebook document by dropping-down into the engine's implementation
kernel_name = papermill_engines.nb_kernel_name(engine_name, nb, kernel_name)
language = papermill_engines.nb_language(engine_name, nb, language)
Expand Down

0 comments on commit d699e2a

Please sign in to comment.