Source code for HydraForge_Windows11.hooks.native_reader_hooks

# -*- coding: utf-8 -*-
"""
HydraForge_Windows11.hooks.native_reader_hooks
------------------------------------
Post-processing hooks for native readers.

Add functions named hook_<native_function_name> to modify data after reading.

Example:
def hook_read_ascii_csv(data: dict) -> dict:
    # Add derived fields, unit conversion, validation, etc.
    return data
"""
[docs] def hook_read_ascii_csv(data: dict) -> dict: """ Post-processing hook for :func:`read_ascii_csv`. This hook runs automatically after the native C++ reader returns. Current behavior ---------------- - Injects a ``metadata`` field into the returned dataset - Marks the data source as coming from the C++ reader hook Parameters ---------- data : dict Parsed dataset returned by the native reader. Returns ------- dict The same dataset, augmented with metadata. """ data["metadata"] = {"source": "hook_read_ascii_csv"} return data
[docs] def hook_read_ascii_csv_rs(data: dict) -> dict: """ Post-processing hook for :func:`read_ascii_csv_rs`. This hook runs automatically after the native Rust reader returns. Current behavior ---------------- - Injects a ``metadata`` field into the returned dataset - Marks the data source as coming from the Rust reader hook Parameters ---------- data : dict Parsed dataset returned by the native reader. Returns ------- dict The same dataset, augmented with metadata. """ data["metadata"] = {"source": "hook_read_ascii_csv_rs"} return data