polymerist.genutils.fileutils.filetree ====================================== .. py:module:: polymerist.genutils.fileutils.filetree .. autoapi-nested-parse:: Tools for manipulating files and directories in the file system Attributes ---------- .. autoapisummary:: polymerist.genutils.fileutils.filetree.dir_tree Classes ------- .. autoapisummary:: polymerist.genutils.fileutils.filetree.PathToNodeCorrespondence Functions --------- .. autoapisummary:: polymerist.genutils.fileutils.filetree.startfile polymerist.genutils.fileutils.filetree.temporary_cd polymerist.genutils.fileutils.filetree.clear_dir Module Contents --------------- .. py:class:: PathToNodeCorrespondence Bases: :py:obj:`polymerist.genutils.trees.treebase.NodeCorrespondence` Concrete implementation of pathlib Paths as nodes in a tree .. py:method:: name(path: pathlib.Path) -> str Define how to obtain a string name .. py:method:: has_children(path: pathlib.Path) -> bool Define how to check if an object can produce children in the first place before attempting to do so .. py:method:: children(path) -> Iterable[pathlib.Path] Define how to obtain node children from an instance Should return NoneType if the instance is "leaf-like" .. py:data:: dir_tree .. py:function:: startfile(path: pathlib.Path) -> None Replacement for os.startfile() functionality, since none natively exists in Linux .. py:function:: temporary_cd(dir_path: Optional[pathlib.Path]) -> Generator[pathlib.Path, None, None] Context manager for temporarily changing the current working directory of code wrapped in a "with" block .. py:function:: clear_dir(path: pathlib.Path) -> None Recursively clear contents of a directory at the given path (depth-first)