scripts: Adopted json -> is_json tweak, avoiding name conflict

This was a humorous name conflict that went unnoticed only because we
lazily import json in read_csv.
This commit is contained in:
Christopher Haster
2025-03-10 20:37:36 -05:00
parent c60301719a
commit 92ac2a757e
9 changed files with 18 additions and 18 deletions

View File

@@ -1350,10 +1350,10 @@ def collect_csv(csv_paths, *,
try:
with openio(path) as f:
# csv or json? assume json starts with [
json = (f.buffer.peek(1)[:1] == b'[')
is_json = (f.buffer.peek(1)[:1] == b'[')
# read csv?
if not json:
if not is_json:
reader = csv.DictReader(f, restval='')
# collect fields
fields.update((k, True) for k in reader.fieldnames or [])