Skip to content

Commit

Permalink
Remove deepcopy step during parameterize_notebook.
Browse files Browse the repository at this point in the history
  • Loading branch information
surdouski committed Jul 2, 2022
1 parent 98013f0 commit a25ebb4
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 @@ -141,9 +140,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 @@ -178,7 +174,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 .log import logger
Expand Down Expand Up @@ -75,9 +74,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
kernel_name = nb_kernel_name(nb, kernel_name)
language = nb_language(nb, language)
Expand Down

0 comments on commit a25ebb4

Please sign in to comment.