Stop naming what the register's other entries are, and say where the booleans stay text
Tests / vet + fmt + tests (pull_request) Successful in 1m26s
Tests / Gitea release from CHANGELOG.md (pull_request) Has been skipped

This commit is contained in:
2026-09-20 00:36:38 +02:00
parent caec22001d
commit 4472c8d92b
3 changed files with 16 additions and 6 deletions
+6 -3
View File
@@ -4,9 +4,9 @@
data-import/httpmethod.py [--source URL_OR_FILE] [--cache DIR] [--out FILE]
A method ships when the register cites the HTTP core specification for it, RFC 9110
section 9.3 or RFC 5789, which is the nine a request carries; the WebDAV and DeltaV
extensions the register also holds do not. The register's `yes` and `no` ship as `true`
and `false`, which a consumer's boolean reads.
section 9.3 or RFC 5789, which is the nine a request carries; the register's other
entries do not. The register's `yes` and `no` ship as `true` and `false`, which a
consumer's boolean reads.
"""
import argparse
import csv
@@ -24,6 +24,7 @@ CACHE = Path(__file__).resolve().parent / "cache"
COLUMNS = ["idempotent", "method", "safe"]
CORE = re.compile(r"\[RFC9110, Section 9\.3\.|\[RFC5789, Section 2\]")
BOOLEAN = {"yes": "true", "no": "false"}
SELECTOR = '[]{}"|' # mirrors inSelector in table.go
EXPECTED = 9
@@ -32,6 +33,8 @@ def rows(text):
method = (r["Method Name"] or "").strip()
if not CORE.search(r["Reference"] or ""):
continue
if set(method) & set(SELECTOR):
sys.exit(f"{method}: a method holding one of {SELECTOR} is one a selector cannot spell")
answers = {}
for column in ("Safe", "Idempotent"):
answer = (r[column] or "").strip()