qmm.bucket module

Buckets of dicts with a set of helpers function.

This module serves has a stand-in database, any function or method it contain would be facilitator to either access or transform the data. This module is necessary in order to keep track of the state of the different files and make that specific state available globally within the other modules.

class qmm.bucket.FileMetadata(crc, path: Union[str, pathlib.Path], attributes, modified, isfrom)[source]

Bases: object

Representation of a file.

Can handle game files, mod files or file information comming from an archive.

as_dict()[source]

Return this object as a dict (kinda).

exists()[source]

Check if the file exists on the disk

is_dir()[source]

Check if the represented item is a directory

is_file()[source]

Check if the represented item is a file

qmm.bucket.as_conflict(key: str, value)[source]

Append and item to the conflicts bucket

qmm.bucket.as_loosefile(crc: int, filepath: pathlib.Path)[source]

Adds filepath to the loosefiles bucket, indexed on given CRC.

qmm.bucket.file_crc_in_loosefiles(filemd: qmm.bucket.FileMetadata) → bool[source]

Check if a file’s crc exists in loosefile’s index.

qmm.bucket.file_path_in_loosefiles(filemd: qmm.bucket.FileMetadata) → bool[source]

Check if a file’s path exists within the different loosefile lists.

qmm.bucket.remove_item_from_loosefiles(file: qmm.bucket.FileMetadata)[source]

Removes the reference to file if it is found in loosefiles

qmm.bucket.with_conflict(path: str) → bool[source]

Check if path exists in conflicts’s keys.

The conflicts bucket purpose is to list issues in-between archives only.

Parameters:path (str) – Simple string, should be a path pointing to a file
Returns:True if path exist in conflicts’s keys
Return type:bool
qmm.bucket.with_gamefiles(crc: int = None, path: str = None)[source]

First check if a CRC32 exist within the gamefiles bucket, if no CRC is given or the check fails, will then check if a path is present in the gamefiles’s bucket values. :param crc: CRC32 as integer :type crc: int :param path: the relative pathlike string of a file :type path: str

Returns:True if either CRC32 or path are found
Return type:bool