muxtools.utils.files
ensure_path
Utility function for other functions to make sure a path was passed to them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pathIn
|
PathLike | Sequence[PathLike] | GlobSearch | FileMixin
|
Supposed passed Path |
required |
caller
|
Any
|
Caller name used for the exception and error message |
required |
Source code in
muxtools/utils/files.py
ensure_path_exists
ensure_path_exists(pathIn: PathLike | Sequence[PathLike] | GlobSearch | FileMixin, caller: Any, allow_dir: bool = False) -> Path
Utility function for other functions to make sure a path was passed to them and that it exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pathIn
|
PathLike | Sequence[PathLike] | GlobSearch | FileMixin
|
Supposed passed Path |
required |
caller
|
Any
|
Caller name used for the exception and error message |
required |
Source code in
muxtools/utils/files.py
uniquify_path
uniquify_path(path: PathLike, *, reserved: Sequence[PathLike] = (), companion_extensions: Sequence[str] = ()) -> str
Extends path to avoid existing or reserved paths.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
PathLike
|
Input path. |
required |
reserved
|
Sequence[PathLike]
|
Additional paths that must not be reused. |
()
|
companion_extensions
|
Sequence[str]
|
Extensions whose companion paths must also be free. |
()
|
Returns:
| Type | Description |
|---|---|
str
|
Unique path. |
Source code in
muxtools/utils/files.py
get_crc32
Generates crc32 checksum for file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
PathLike
|
Input file |
required |
Returns:
| Type | Description |
|---|---|
str
|
Checksum for file |