Data Manager

class DataManager(disable_cache: bool = False, ui_config: dict | None = None)[source]

The DataManager class handles data management for patch reports, including caching, validation and exporting to Excel.

Data caching can be disabled by setting disable_cache to True at runtime.

Parameters:
  • disable_cache (bool) – Whether caching functionality should be disabled.

  • ui_config (dict | None) – Optional dict of UI settings (header text, footer text, font paths, logo, header color) forwarded to PDFReport when generating PDF output. When None, PDFReport falls back to UIDefaults values, which is the right behavior for library callers that don’t customize PDF appearance. The CLI passes the plist-backed dict so the user’s configured header_text / footer_text / font / logo land in the rendered PDF.

property cache_off: bool[source]

Indicates whether caching is disabled.

Returns:

True if caching is disabled, False otherwise.

Return type:

bool

property titles: list[PatchTitle][source]

Retrieve and validate the current list of PatchTitle objects.

If titles are not already loaded, they are fetched from the latest available dataset.

Returns:

The validated list of PatchTitle objects.

Return type:

list[PatchTitle]

Raises:

PatcherError – If validation fails.

async export(patch_titles: list[PatchTitle], output_dir: str | Path, report_title: str, analysis: bool = False, date_format: str = '%B %d %Y', formats: set[str] | None = None, header_color: str | None = None, device_reports: dict[str, list[PatchDevice]] | None = None) dict[str, str][source]

Exports patch data to the specified formats.

Parameters:
  • patch_titles (list [PatchTitle]) – A list of PatchTitle objects to include in the report. Defaults to self.titles if not provided

  • output_dir (str | Path) – The directory in which to save the exported report(s).

  • report_title (str) – The title to use for the header in exported report(s). Defaults to the header_text key in com.liquidzoo.patcher.plist.

  • analysis (bool) – Denotes whether this is analysis report (affects HTML output path).

  • date_format (str) – The date format for PDF/HTML headers. Defaults to “%B %d %Y” (Month Day Year).

  • formats (set | None) – A set of formats to export. Defaults to all ({“excel”, “html”, “pdf”}).

  • header_color (str | None) – Hex color to use for HTML header table background. Falls back to header_color when None.

  • device_reports (dict[str, list[PatchDevice]] | None) – Optional dictionary mapping title IDs to device lists for per-title detail sheets.

Returns:

A dictionary containing paths to generated reports.

Return type:

dict[str, str]

reset_cache() bool[source]

Removes all cached files from Cache directory. See reset.

Returns:

True if all files were able to be removed, False otherwise.

Return type:

bool

load_cached_data() list[DataFrame][source]

Load all cached data files into a list of DataFrames.

Returns:

list of pandas DataFrame objects with cached data.

Return type:

list[DataFrame]

get_cached_files() list[Path][source]

Retrieves all cached file Paths.

Returns:

A list of Path objects pointing to cached files.

Return type:

list[Path]

get_latest_dataset() Path | None[source]

Retrieves the most recent dataset of patch reports and returns the path.

If a tracked Excel file is available, it is preferred. Otherwise, searches the cache directory.

Returns:

Path to the latest dataset (Excel or pickle file), or None if no dataset is found.

Return type:

Path | None