devops.files
Top level package for file operations in mstd checks.
- class devops.files.FileType(*values)[source]
Bases:
EnumEnumeration of file types for mstd checks.
- UNKNOWN = 0
- CPPHeader = 1
- CPPSource = 2
- CMakeLists = 3
- devops.files.determine_file_type(filename)[source]
Determine the file type based on the filename extension.
- devops.files.file_exist(file, *, throwing=False, throw_msg=None)[source]
Check if a file exists at the given path.
- Parameters:
- Returns:
bool – True if the file exists, False otherwise.
- Raises:
DevOpsFileNotFoundError – If the file does not exist and throwing is True.
- Return type:
- devops.files.filter_cpp_files(files)[source]
Filter and return only C++ related files from the given list.
- devops.files.get_dirs_in_dir(directory='.')[source]
Get all directories in the specified directory.
- devops.files.get_files_in_dirs(paths, exclude_dirs=None, exclude_files=None, max_recursion=20)[source]
Get all files in the specified directories.
- Parameters:
paths (Iterable[Path]) – List of directory paths to search for files.
exclude_dirs (list[str] | None) – List of directory names to exclude from the search. Defaults to None.
exclude_files (list[str] | None) – List of file names to exclude from the search. Defaults to None.
max_recursion (int) – Number of maximum recursion through dirs to avoid infinite recursion, default 20
- Returns:
list[Path] – List of file paths found in the specified directories.
- Return type:
list[Path]
- devops.files.get_staged_files()[source]
Get the list of staged files in the git repository.
- Returns:
list[Path] – List of staged file paths.
- Raises:
subprocess.CalledProcessError – If the git command fails.
- Return type:
Modules
Module for file operations in mstd checks. |
|
Module for updating the changelog file. |