from __future__ import annotations import argparse import json import re import sys from dataclasses import dataclass from pathlib import Path from typing import Any, Iterable, Mapping, TextIO try: # Keep this module useful even when copied away from the decompiler tree. from . import protocol_trace as _protocol_trace except ImportError: # pragma: no cover - exercised only outside package imports. _protocol_trace = None CHECKSUM_SEED = getattr(_protocol_trace, "CHECKSUM_SEED", 0x5A) FRAME_LENGTH = getattr(_protocol_trace, "FRAME_LENGTH", 6) CAPTURE_LINE_RE = re.compile( r"^\s*(?P