From 121d81bdf78473158dcbe5be8446f1bbe2859374 Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Mon, 12 Nov 2018 21:27:03 +0100 Subject: [PATCH] freeze_metadata option only updates jupytext metadata #124 --- jupytext/jupytext.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/jupytext/jupytext.py b/jupytext/jupytext.py index 8ff523779..34a8fe2d6 100644 --- a/jupytext/jupytext.py +++ b/jupytext/jupytext.py @@ -59,10 +59,9 @@ def reads(self, s, **_): lines = lines[pos:] if self.freeze_metadata: - metadata['jupytext'] = {'metadata_filter': { - 'notebook': {'additional': list(metadata.keys()), 'excluded': 'all'}}} - metadata['jupytext']['metadata_filter']['cells'] = { - 'additional': list(cell_metadata), 'excluded': 'all'} + metadata.setdefault('jupytext', {})['metadata_filter'] = { + 'notebook': {'additional': list(metadata.keys()), 'excluded': 'all'}, + 'cells': {'additional': list(cell_metadata), 'excluded': 'all'}} set_main_and_cell_language(metadata, cells, self.format.extension)