Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deepcopy steps during parameterize_notebook. #673

Merged
merged 1 commit into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -82,9 +81,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