ksuit.utils.common.path ======================= .. py:module:: ksuit.utils.common.path Functions --------- .. autoapisummary:: ksuit.utils.common.path.create_path_from_str ksuit.utils.common.path.validate_path ksuit.utils.common.path.select_with_path Module Contents --------------- .. py:function:: create_path_from_str(str_path, mkdir = False, should_exist = True, check_exists = True, suffix = None) Converts a string to a `Path` and optionally performs file-system operations on it. :param str_path: The path to convert. :param mkdir: If True, creates the directory if it doesn't exist. :param should_exist: If True, checks if the path exists. :param check_exists: If True, checks if the path exists or not. :param suffix: If not None, checks if the path ends with this suffix. .. py:function:: validate_path(path, exists = 'must', suffix = None, mkdir = False) Converts a string to a Path, validates it, and optionally creates it. :param path: The path string to validate. :param exists: - "must": Raises FileNotFoundError if the path doesn't exist. - "must_not": Raises FileExistsError if the path already exists. - "any": Performs no existence check. :param suffix: If provided, checks if the path ends with this suffix. :param mkdir: If True, creates the directory path (like mkdir -p). :returns: The validated path. :rtype: Path .. py:function:: select_with_path(obj, path) Access values of an object, a list or a dictionary using a string path. :param obj: The object to access. :param path: The path to the value, e.g. "a.b.c" or "a[0].b.c".