_docsweeper.util#
General utility functions.
- _docsweeper.util.call_subprocess(command, cwd=None)#
Wrap calls to
subprocess.run().The parameters command and cwd are passed on to
subprocess.run()and must adhere to the preconditions described there.- Parameters
command (List[str]) – The command as specified by the interface of
subprocess.run().cwd (Optional[Path]) – The directory to change to for executing the command. If None, then the current directory is used.
- Raises
subprocess.CalledProcessError – The underlying process has exited with a non-zero exit code.
- Returns
The text that was written to standard output by running the command.
- Return type
- _docsweeper.util.read_file(path)#
Read the file path to memory and return its contents.
- Parameters
path (Path) – path of the file
- Raises
OSError – There has been an issue opening the file.
ValueError – There is an encoding issue with the file.
- Returns
The contents of path.
- Return type
- class _docsweeper.util.K#
Generic type variable for a type that supports
typing.Hashable.
- class _docsweeper.util.V#
Generic type variable for any object.