From e5fcc369e695ad6622228698d6a4dceb737b2ea1 Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Sat, 9 Nov 2019 15:44:51 +0100 Subject: [PATCH] Move default notebook metadata filter to metadata_filter.py --- jupytext/header.py | 10 +--------- jupytext/metadata_filter.py | 8 ++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/jupytext/header.py b/jupytext/header.py index c2933f323..b477b5550 100644 --- a/jupytext/header.py +++ b/jupytext/header.py @@ -8,7 +8,7 @@ from nbformat.v4.nbbase import new_raw_cell from .version import __version__ from .languages import _SCRIPT_EXTENSIONS, comment_lines -from .metadata_filter import filter_metadata +from .metadata_filter import filter_metadata, _DEFAULT_NOTEBOOK_METADATA from .pep8 import pep8_lines_between_cells SafeRepresenter.add_representer(nbformat.NotebookNode, SafeRepresenter.represent_dict) @@ -19,14 +19,6 @@ _LEFTSPACE_RE = re.compile(r"^\s") _UTF8_HEADER = ' -*- coding: utf-8 -*-' -_DEFAULT_NOTEBOOK_METADATA = ','.join([ - # Preserve Jupytext section - 'jupytext', - # Preserve kernel specs - 'kernelspec', - # Kernel_info found in Nteract notebooks - 'kernel_info']) - # Change this to False in tests INSERT_AND_CHECK_VERSION_NUMBER = True diff --git a/jupytext/metadata_filter.py b/jupytext/metadata_filter.py index 989f5676b..c4d80cb8a 100644 --- a/jupytext/metadata_filter.py +++ b/jupytext/metadata_filter.py @@ -2,6 +2,14 @@ from .cell_metadata import _JUPYTEXT_CELL_METADATA +_DEFAULT_NOTEBOOK_METADATA = ','.join([ + # Preserve Jupytext section + 'jupytext', + # Preserve kernel specs + 'kernelspec', + # Kernel_info found in Nteract notebooks + 'kernel_info']) + def metadata_filter_as_dict(metadata_config): """Return the metadata filter represented as either None (no filter),