grammy-jiang/doe2-sim-parser

View on GitHub
doe2_sim_parser/utils/data_types.py

Summary

Maintainability
A
0 mins
Test Coverage
from collections import namedtuple
from pathlib import Path as _Path
from typing import List, Tuple, TypeVar

Path = TypeVar("Path", str, _Path)

Report = namedtuple(
    "Report",
    [
        "type_",  # normal_report or hourly_report
        "code",  # only normal_report
        "name",  # only normal_report
        "report",  # type: List
        "report_no",  # type: int # only for hourly_report
        "page_no",  # type: int # only for hourly_report
    ],
)

SIM = namedtuple(
    "SIM",
    [
        "path",  # type: _Path
        "normal_reports",  # type: Tuple[Report]
        "hourly_reports",  # type: Tuple[Report]
    ],
)

SliceFunc = namedtuple("SliceFunc", ["name", "slice", "func_parse"])