bandersnatch_storage_plugins package¶
Package contents¶
Submodules¶
bandersnatch_storage_plugins.filesystem module¶
- class bandersnatch_storage_plugins.filesystem.FilesystemStorage(*args: Any, **kwargs: Any)[source]¶
Bases:
StoragePlugin- compare_files(file1: Path | str, file2: Path | str) bool[source]¶
Compare two files, returning true if they are the same and False if not.
- delete_file(path: Path | str, dry_run: bool = False) int[source]¶
Delete the provided path, recursively if necessary.
- find(root: Path | str, dirs: bool = True) str[source]¶
A test helper simulating ‘find’.
Iterates over directories and filenames, given as relative paths to the root.
- get_lock(path: str | None = None) UnixFileLock[source]¶
Retrieve the appropriate FileLock backend for this storage plugin
- Parameters:
path (str) – The path to use for locking
- Returns:
A FileLock backend for obtaining locks
- Return type:
filelock.FileLock
- mkdir(path: Path | str, exist_ok: bool = False, parents: bool = False) None[source]¶
Create the provided directory
- name = 'filesystem'¶
- open_file(path: Path | str, text: bool = True, encoding: str = 'utf-8') Generator[IO, None, None][source]¶
Yield a file context to iterate over. If text is true, open the file with ‘rb’ mode specified.
- read_file(path: Path | str, text: bool = True, encoding: str = 'utf-8', errors: str | None = None) str | bytes[source]¶
Return the contents of the requested file, either a bytestring or a unicode string depending on whether text is True
- rewrite(filepath: Path | str, mode: str = 'w', **kw: Any) Generator[IO, None, None][source]¶
Rewrite an existing file atomically to avoid programs running in parallel to have race conditions while reading.
- rmdir(path: Path | str, recurse: bool = False, force: bool = False, ignore_errors: bool = False, dry_run: bool = False) int[source]¶
Remove the directory. If recurse is True, allow removing empty children. If force is true, remove contents destructively.
- scandir(path: Path | str) Generator[DirEntry, None, None][source]¶
Read entries from the provided directory