from __future__ import annotations import argparse import re import sys from collections import Counter from dataclasses import dataclass from pathlib import Path from typing import Iterable, TextIO DETECT_RE = re.compile( r"^(?P