Data Manager¶
- class DataManager(disable_cache: bool = False, ui_config: dict | None = None)[source]¶
The
DataManagerclass handles data management for patch reports, including caching, validation and exporting to Excel.Data caching can be disabled by setting
disable_cachetoTrueat 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
PDFReportwhen generating PDF output. WhenNone,PDFReportfalls back toUIDefaultsvalues, 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 configuredheader_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:
- property titles: list[PatchTitle][source]¶
Retrieve and validate the current list of
PatchTitleobjects.If titles are not already loaded, they are fetched from the latest available dataset.
- Returns:
The validated list of
PatchTitleobjects.- 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 ofPatchTitleobjects to include in the report. Defaults toself.titlesif not providedoutput_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_textkey incom.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_colorwhenNone.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:
- 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:
- 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