summary module

class pdbstore.store.summary.OpStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Lost of predefined operation status.

FAILED = 'fail'
SKIPPED = 'skip'
SUCCESS = 'success'
static from_str(label: str) OpStatus

Convert string into OpStatus

class pdbstore.store.summary.Summary(transaction_id: str | None = None, status: OpStatus = OpStatus.SUCCESS, transaction_type: TransactionType | None = None, error_msg: str | None = None, references: int = 0)

Bases: object

Handle operations summary.

add_entry(entry: TransactionEntry, status: OpStatus, tr_type: TransactionType, error_msg: List[str] | str | None = None, **kwargs: Any) Dict[str, Any]

Add new file result given operation status and file path.

Parameters:
  • file_path – Path to the associated file.

  • status – Indicate the operation result.

  • tr_type – The transaction type.

  • error_msg – Optional error message.

Returns:

A dictionary associated to the new added entry

add_file(file_path: str | Path, status: OpStatus, error_msg: List[str] | str | None = None) Dict[str, Any]

Add new file result given operation status and file path.

Parameters:
  • file_path – Path to the associated file.

  • status – Indicate the operation result.

  • error_msg – Optional error message.

Returns:

A dictionary associated to the new added file

count(success_only: bool = False) int

Retrieve the total number of Summary object.

property error_msg: str | None

Retrieve custom error message.

Returns:

The custom error message.

failed(full: bool = False) int

Retrieve the total of failed operations.

property files: List[Dict[str, Any]]

Retrieve list of files.

Returns:

List of files where each item is a dictionary containing detailed information about the associated file.

iterator() Generator[Summary, Summary, None]

Iterate over all Summary object linked nodes

property linked: Summary | None

Retrieve the linked summary object.

Returns:

The linked Summary object if defined, else None.

referenced(full: bool = False) int

Retrieve the total of modified references.

skipped(full: bool = False) int

Retrieve the total of skipped operations.

property status: OpStatus

Retrieve the operation status.

success(full: bool = False) int

Retrieve the total of successful operations.

property transaction_id: str | None

Retrieve the associated transaction identifier.

property transaction_type: TransactionType | None

Retrieve the associated transaction type.