Skip to content

Commit

Permalink
support-equal-char-in-python-translator
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita-Smirnov-Exactpro committed Nov 27, 2024
1 parent 5384731 commit ae5da2d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
7 changes: 4 additions & 3 deletions papermill/tests/notebooks/complex_parameters.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
"# Interesting c variable\n",
"c: \"NoneType\" = None\n",
"# Not introspectable line\n",
"d = a == 3\n",
"# Broken name definition\n",
"= 2"
"d = \"a = 3\" # str value with '=' character\n",
"e = (a != 3 and 2 <= a <= 3) or a == 1 # bool value with logical operators\n",
"= 2\n",
"# Broken name definition\n"
]
}
],
Expand Down
9 changes: 9 additions & 0 deletions papermill/tests/test_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ 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": "str value with '=' character"},
"e": {
"name": "e",
"inferred_type_name": "None",
"default": "(a != 3 and 2 <= a <= 3) or a == 1",
"help": "bool value with logical operators"
},
},
),
(_get_fullpath("notimplemented_translator.ipynb"), {}),
Expand Down Expand Up @@ -87,6 +94,8 @@ 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\")\n str value with '=' character",
" e: Unknown type (default (a != 3 and 2 <= a <= 3) or a == 1)\n bool value with logical operators",
],
),
(
Expand Down
3 changes: 0 additions & 3 deletions papermill/translators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit ae5da2d

Please sign in to comment.