Skip to content

Diversity Quota

Quota and State management.

Classes:

Name Description
DiversityQuota

Manages rules for diversity (weights) and uniqueness.

DiversityQuota(root: str, is_unique: bool, max_per_dir: int, locked_dir: set[str] = set(), dircount: Counter[str] = Counter()) dataclass

Manages rules for diversity (weights) and uniqueness.

Methods:

Name Description
reset

Reset batch-specific counters, optionally keeping file history.

is_all_locked

Check if all files/folders are locked.

is_dir_locked

Check if a folder is locked.

lock_dir

Mark a folder as locked without registering a success.

register_success

Record a successful copy and apply locking rules.

reset() -> None

Reset batch-specific counters, optionally keeping file history.

is_all_locked() -> bool

Check if all files/folders are locked.

is_dir_locked(directory: str) -> bool

Check if a folder is locked.

lock_dir(directory: str) -> None

Mark a folder as locked without registering a success.

register_success(entry: os.PathLike) -> None

Record a successful copy and apply locking rules.