"""The pipeline state lists' checked merge and export (nx2/pipeline_states.py --check, --contrib, --export; no game, made-up lists only). (Triforce, 11-22, the performance audit's PIPE-11, after Source A's.) The shipped list is to grow from more than one PC's play, so a list handed in is checked before it is merged, the merge says what each source added, and a player's list is packed with a report of what it holds. Not ported: the in-game tour and the menu's export row. Checks, each through the tool as a process: - --check: a sound list passes; a list without the head, of another record size, cut short, or with a record whose counts or topology are out of range, or with no first stage, is refused with why; point-list records are refused unless --keep-points; - --contrib: the positional lists, then contrib/'s *.bin.xz by name, each checked (one not sound is left out whole), each pipeline once in the order first met, point-list records left out (kept with --keep-points), each source's line with its records, what it added, its repeats and its note; the same output whatever order the files were written in; - --export: the list as triforce_pipeline_states.bin.xz (the same bytes) and report.txt with its counts; a list that is not sound makes no file; - the plain merge keeps every record, point lists too, as before. python -I -B tests/test_pipeline_contrib.py """ import importlib.util import lzma import os import struct import subprocess import sys import tempfile import zipfile from pathlib import Path ROOT = Path(__file__).resolve().parents[1] TOOL = ROOT / "nx2" / "pipeline_states.py" def load(): spec = importlib.util.spec_from_file_location("pipeline_states", TOOL) mod = importlib.util.module_from_spec(spec) spec.loader.exec_module(mod) return mod tool = load() def rec(vs, fs=0, topo=3, n=1, samples=1, nvattr=2, nanswers=0, mesh=0): r = bytearray(tool.SIZE) struct.pack_into("