diff --git a/papermill/tests/notebooks/complex_parameters.ipynb b/papermill/tests/notebooks/complex_parameters.ipynb index 1c7284f0..b33db466 100644 --- a/papermill/tests/notebooks/complex_parameters.ipynb +++ b/papermill/tests/notebooks/complex_parameters.ipynb @@ -21,9 +21,13 @@ "# Interesting c variable\n", "c: \"NoneType\" = None\n", "# Not introspectable line\n", - "d = a == 3\n", - "# Broken name definition\n", - "= 2" + "d = \"a = 3\"\n", + "# str value with equal character\n", + "e = 1 # comment with '=' character\n", + "f = (a != 3 and 2 <= a <= 3) or a == 1\n", + "# bool value with logical operators\n", + "= 2\n", + "# Broken name definition\n" ] } ], diff --git a/papermill/tests/test_inspect.py b/papermill/tests/test_inspect.py index 3b1cca7f..40a5a269 100644 --- a/papermill/tests/test_inspect.py +++ b/papermill/tests/test_inspect.py @@ -45,6 +45,19 @@ def click_context(): "help": "Nice list", }, "c": {"name": "c", "inferred_type_name": "NoneType", "default": "None", "help": ""}, + "d": {"name": "d", "inferred_type_name": "None", "default": "\"a = 3\"", "help": ""}, + "e": { + "name": "e", + "inferred_type_name": "None", + "default": "1", + "help": "comment with '=' character", + }, + "f": { + "name": "f", + "inferred_type_name": "None", + "default": "(a != 3 and 2 <= a <= 3) or a == 1", + "help": "", + }, }, ), (_get_fullpath("notimplemented_translator.ipynb"), {}), @@ -87,6 +100,9 @@ def test_str_path(): " a: float (default 2.25) Variable a", " b: List[str] (default ['Hello','World'])\n Nice list", " c: NoneType (default None) ", + " d: Unknown type (default \"a = 3\")", + " e: Unknown type (default 1) comment with '=' character", + " f: Unknown type (default (a != 3 and 2 <= a <= 3) or a == 1)", ], ), ( diff --git a/papermill/translators.py b/papermill/translators.py index 1cb43d89..3b5c0ace 100644 --- a/papermill/translators.py +++ b/papermill/translators.py @@ -246,9 +246,6 @@ def flatten_accumulator(accumulator): if nequal > 0: grouped_variable.append(flatten_accumulator(accumulator)) accumulator = [] - if nequal > 1: - logger.warning(f"Unable to parse line {iline + 1} '{line}'.") - continue accumulator.append(line) grouped_variable.append(flatten_accumulator(accumulator))