Utilities¶
This module contains a variety of helper functions that implement common tasks, like command-line output and date formatting. These should generally be used to help make Pavilion consistent across its code and plugins.
Table of Contents
File Handling¶
-
pavilion.utils.
flat_walk
(path, *args, **kwargs) → Iterator[pathlib.Path]¶ Perform an os.walk on path, but simply generate each item walked over.
Parameters: - path (Path) – The path to walk with os.walk.
- args – Any additional positional args for os.walk.
- kwargs – Any additional kwargs for os.walk.
-
pavilion.utils.
get_mime_type
(path)¶ Use the filemagic command to get the mime type of a file. Returned as a tuple of category and subtype.
Parameters: path (Path) – The path to the file to examine. Return type: (str, str) Returns: category, subtype
OS Operations¶
-
pavilion.utils.
get_login
()¶ Get the current user’s login, either through os.getlogin or the environment, or the id command.