mth5.utils.mth5_validator_standalone ==================================== .. py:module:: mth5.utils.mth5_validator_standalone .. autoapi-nested-parse:: Standalone MTH5 File Validator =============================== Lightweight validator for MTH5 files that doesn't require the full mth5 package. Only depends on h5py and standard library. This standalone version is ideal for: - Building small executables (~20-30 MB vs 150+ MB) - Validation without installing full mth5 environment - Quick file checks in production environments Usage: python mth5_validator_standalone.py validate file.mth5 python mth5_validator_standalone.py validate file.mth5 --verbose python mth5_validator_standalone.py validate file.mth5 --json Author: MTH5 Development Team Date: February 9, 2026 Attributes ---------- .. autoapisummary:: mth5.utils.mth5_validator_standalone.ACCEPTABLE_FILE_VERSIONS mth5.utils.mth5_validator_standalone.ACCEPTABLE_FILE_TYPES mth5.utils.mth5_validator_standalone.ACCEPTABLE_DATA_LEVELS Classes ------- .. autoapisummary:: mth5.utils.mth5_validator_standalone.ValidationLevel mth5.utils.mth5_validator_standalone.ValidationMessage mth5.utils.mth5_validator_standalone.ValidationResults mth5.utils.mth5_validator_standalone.MTH5Validator Functions --------- .. autoapisummary:: mth5.utils.mth5_validator_standalone.main Module Contents --------------- .. py:data:: ACCEPTABLE_FILE_VERSIONS :value: ['0.1.0', '0.2.0'] .. py:data:: ACCEPTABLE_FILE_TYPES :value: ['MTH5'] .. py:data:: ACCEPTABLE_DATA_LEVELS :value: [0, 1, 2, 3] .. py:class:: ValidationLevel Bases: :py:obj:`enum.Enum` Validation severity levels. .. py:attribute:: ERROR :value: 'ERROR' .. py:attribute:: WARNING :value: 'WARNING' .. py:attribute:: INFO :value: 'INFO' .. py:class:: ValidationMessage Container for a single validation message. .. py:attribute:: level :type: ValidationLevel .. py:attribute:: category :type: str .. py:attribute:: message :type: str .. py:attribute:: path :type: str | None :value: None .. py:attribute:: details :type: dict[str, Any] .. py:class:: ValidationResults Container for validation results. .. py:attribute:: file_path :type: pathlib.Path .. py:attribute:: messages :type: list[ValidationMessage] :value: [] .. py:attribute:: checked_items :type: dict[str, bool] .. py:property:: is_valid :type: bool Check if file passed validation (no errors). .. py:property:: error_count :type: int Count of error messages. .. py:property:: warning_count :type: int Count of warning messages. .. py:property:: info_count :type: int Count of info messages. .. py:method:: add_error(category: str, message: str, path: str | None = None, **details) -> None Add an error message. .. py:method:: add_warning(category: str, message: str, path: str | None = None, **details) -> None Add a warning message. .. py:method:: add_info(category: str, message: str, path: str | None = None, **details) -> None Add an info message. .. py:method:: print_report(include_info: bool = False) -> None Print a formatted validation report. .. py:method:: to_dict() -> dict Convert results to dictionary. .. py:method:: to_json(**kwargs) -> str Convert results to JSON string. .. py:class:: MTH5Validator(file_path: str | pathlib.Path, verbose: bool = False, check_data: bool = False) Standalone MTH5 file validator. Validates MTH5 file structure without requiring full mth5 package. Only depends on h5py and standard library. .. py:attribute:: file_path .. py:attribute:: verbose :value: False .. py:attribute:: check_data :value: False .. py:attribute:: results .. py:attribute:: h5_file :value: None .. py:method:: validate() -> ValidationResults Run full validation suite. .. py:function:: main() CLI entry point.