create_intermediate_py_file
- create_intermediate_py_file(notebook_path: str, intermediate_dir_base_path: str) tuple[str, InputLineMapping] [source]
Parse a notebook at
notebook_path
and saves a parsed version.The corresponding position is relative to
intermediate_dir_base_path
.- Parameters:
notebook_path (str) – Path to a notebook.
intermediate_dir_base_path (str) – Path pointing to the position the parsed notebook will be saved to.
- Returns:
(
intermediate_file_path
,input_line_mapping
) Whereintermediate_file_path
is the path the parsed notebook was written to. If there was an error parsing the file theintermediate_file_path
will be""
.input_line_mapping
is a dict which has the keys ‘input_names’ and ‘code_lines’.code_lines
is a List of the code cellsIn[\d\*]
names andcode_lines
is the corresponding line in the parsed notebook.- Return type:
tuple[str, InputLineMapping]
- Warns:
InvalidNotebookWarning – If the notebook couldn’t be parsed.