Writer#
(nbrefactor.fileops.writer)
File-writing methods for a parsed/refactored notebook
- write_modules(node, output_path, pre_write_hook=None, generate_init=False)[source]#
Recursively writes the modules and their contents given a
ModuleNodetree hierarchy.- Parameters:
node (ModuleNode) – the current node representing a module or package.
output_path (str) – the path where the Python files should be written.
write_hook (callable, optional) – a hook function that takes (content, node) and returns the modified content.
generate_init (bool, optional) – whether to generate __init__.py files in package directories. Defaults to False.