.. _jgdv.mixins.path_manip: ====================== jgdv.mixins.path_manip ====================== .. py:module:: jgdv.mixins.path_manip Enums ----- .. autoapisummary:: jgdv.mixins.path_manip.LoopControl_e Classes ------- .. autoapisummary:: jgdv.mixins.path_manip.PathManip_m jgdv.mixins.path_manip.Walker_m Module Contents =============== .. _jgdv.mixins.path_manip.LoopControl_e: .. py:class:: LoopControl_e(*args, **kwds) Bases: :py:obj:`enum.Enum` Create a collection of name/value pairs. Example enumeration: >>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3 Access them by: - attribute access: >>> Color.RED - value lookup: >>> Color(1) - name lookup: >>> Color['RED'] Enumerations can be iterated over, and know how many members they have: >>> len(Color) 3 >>> list(Color) [, , ] Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details. .. py:attribute:: no .. py:attribute:: noBut .. py:attribute:: yes .. py:attribute:: yesAnd .. _jgdv.mixins.path_manip.PathManip_m: .. py:class:: PathManip_m A Mixin for common path manipulations .. py:method:: _build_roots(*sources, roots = None) -> convert roots from keys to paths .. py:method:: _calc_path_parts(fpath, roots) -> take a path, and get a dict of bits which aren't methods of Path if no roots are provided use cwd .. py:method:: _find_parent_marker(fpath, marker = None) -> Go up the parent list to find a marker file, return the dir its in .. py:method:: _get_relative(fpath, roots = None) -> Get relative path of fpath. if no roots are provided, default to using cwd .. py:method:: _normalize(path, *, root = None, symlinks = False) -> a basic path normalization expands user, and resolves the location to be absolute .. py:method:: _shadow_path(rpath, shadow_root) -> :abstractmethod: take a relative path, apply it onto a root to create a shadowed location .. _jgdv.mixins.path_manip.Walker_m: .. py:class:: Walker_m A Mixin for walking directories, written for py<3.12 .. py:method:: walk_all(roots, *, exts = None, rec = False, fn = None) -> walk all available targets, and generate unique names for them .. py:method:: walk_target_deep(target, *, exts = None, fn = None) -> .. py:method:: walk_target_shallow(target, *, exts = None, fn = None) -> .. py:attribute:: control_e :type: ClassVar[type[LoopControl_e]]