Utilities Module#
- nexus.utilities.is_valid_path(path: str | bytes | Path) bool[source]#
Screen out paths with invalid characters.
- nexus.utilities.is_valid_filename(filename: str | bytes | Path) bool[source]#
Screen out filenames with invalid characters.
- nexus.utilities.is_relative_path(path: str | bytes | Path)[source]#
Determine if a path is relative to some current working directory.
- nexus.utilities.path_string(path: str | bytes | Path, strict: bool = False, relative: bool = False, check: bool = False) str[source]#
Convert a path to a string.
- Parameters:
- path
str,bytesorPath A file path or directory path.
- strictbool, default=False
Require inputted path to be str type. Raises ValueError otherwise.
- relativebool, default=False
Check if path is a relative path. Raises ValueError otherwise.
- checkbool, default=True
Check if a path contains only valid characters. ValueError is raised for invalid paths.
- path
- Returns:
- path_out
str The path as a string.
- path_out