tools/update-table.py reads all 5 columns from the upstream table.csv but only writes the prefix code to constants.py, discarding tag, status, and description.
Problem
The script reads the full CSV row (line 78):
# tools/update-table.py
for row in multicodec_reader:
code = padded_hex(row["code"])
name_const = row["name"].upper().replace("-", "_")
name_human = row["name"]
tag = row["tag"] # ← Read but only used for grouping
# row["status"] # ← Never read
# row["description"] # ← Never read
But when writing the output (line 82), only the prefix is included:
value = "{'prefix': {code}, },".format(code=codec["code"])
The tag variable is used for grouping entries into sections (line 68: parsed[tag].append(value)) but is never stored in the output data.
Proposed Solution
Modify the output format to include all available metadata:
value = (
"{{'prefix': {code}, 'tag': '{tag}', "
"'status': '{status}', 'description': '{desc}'}},\n"
).format(
code=codec["code"],
tag=codec.get("tag", ""),
status=codec.get("status", ""),
desc=codec.get("description", "").replace("'", "\\'"),
)
Also update the unique_code() function and the FOOTER derivation to handle the enriched data.
After this change, regenerate constants.py and verify the output.
Related
tools/update-table.pyreads all 5 columns from the upstreamtable.csvbut only writes theprefixcode toconstants.py, discardingtag,status, anddescription.Problem
The script reads the full CSV row (line 78):
But when writing the output (line 82), only the prefix is included:
The
tagvariable is used for grouping entries into sections (line 68:parsed[tag].append(value)) but is never stored in the output data.Proposed Solution
Modify the output format to include all available metadata:
Also update the
unique_code()function and theFOOTERderivation to handle the enriched data.After this change, regenerate
constants.pyand verify the output.Related
tools/update-table.pymulticodec/constants.py