fix(tools/render_jsonl): split chained statements per ruff 0.4.x
Addresses CI lint feedback on PR #1391. No behavior change. - Split `import json, sys` into separate lines (E401) - Split chained `print(...); sys.exit(1)` into two lines (E702, two occurrences) - Split inline `if ts: stamps.append(ts)` into two lines (E701) Verified: `ruff check tools/render_jsonl.py` reports "All checks passed!" Tool still renders correctly (3 turns from a real JSONL test, identical output to pre-fix).
This commit is contained in:
@@ -11,7 +11,8 @@ Usage:
|
|||||||
|
|
||||||
Stdlib only. Python 3.9+. Read-only on the input.
|
Stdlib only. Python 3.9+. Read-only on the input.
|
||||||
"""
|
"""
|
||||||
import json, sys
|
import json
|
||||||
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
def extract_text(content):
|
def extract_text(content):
|
||||||
@@ -29,10 +30,12 @@ def extract_text(content):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print(__doc__); sys.exit(1)
|
print(__doc__)
|
||||||
|
sys.exit(1)
|
||||||
src = Path(sys.argv[1])
|
src = Path(sys.argv[1])
|
||||||
if not src.is_file():
|
if not src.is_file():
|
||||||
print(f"ERROR: not a file: {src}"); sys.exit(1)
|
print(f"ERROR: not a file: {src}")
|
||||||
|
sys.exit(1)
|
||||||
out = open(sys.argv[2], "w", encoding="utf-8") if len(sys.argv) > 2 else sys.stdout
|
out = open(sys.argv[2], "w", encoding="utf-8") if len(sys.argv) > 2 else sys.stdout
|
||||||
|
|
||||||
turns, stamps = [], []
|
turns, stamps = [], []
|
||||||
@@ -51,7 +54,8 @@ def main():
|
|||||||
if not text:
|
if not text:
|
||||||
continue
|
continue
|
||||||
ts = obj.get("timestamp") or ""
|
ts = obj.get("timestamp") or ""
|
||||||
if ts: stamps.append(ts)
|
if ts:
|
||||||
|
stamps.append(ts)
|
||||||
turns.append((ts, role, text))
|
turns.append((ts, role, text))
|
||||||
|
|
||||||
header = [
|
header = [
|
||||||
|
|||||||
Reference in New Issue
Block a user