Remove decorator and hash pipe lines from source code
1
2
3
4def clean(
src: str # source code to clean
) -> str:
"""Remove decorator and hash pipe lines from source code""" Remove decorator and hash pipe lines from source code
1
2
3
4def clean(
src: str # source code to clean
) -> str:
"""Remove decorator and hash pipe lines from source code""" Write parts to file, filtering None values and joining with blank lines.
1
2
3
4def write(
p: str # path to write to
):
"""Write parts to file, filtering None values and joining with blank lines.""" Write module file with imports, constants, and exports.
1
2
3
4
5
6def write_mod(
path, # output file path
nodes: list, # list of Node objects to write
mod_names: list # list of module names for import rewriting
):
"""Write module file with imports, constants, and exports.""" Rewrite cross-notebook imports to relative package imports
1
2
3
4
5def rewrite_imports(
src: str, # source code to rewrite
mod_names: list # list of module names
) -> str:
"""Rewrite cross-notebook imports to relative package imports""" Generate and write __init__.py file with metadata and exports.
1
2
3
4
5
6def write_init(
path: str | Path, # path to write __init__.py file
meta: dict, # metadata dict with desc, version, author
mods: list # list of (name nodes) tuples
):
"""Generate and write __init__.py file with metadata and exports."""