Skip to content

Commit 6579447

Browse files
Fix CI: newline-only YAML block scalars, ruff format, types-PyYAML
1 parent ac14821 commit 6579447

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ ruff>=0.9.0
77
pip-audit>=2.7.0
88
hypothesis>=6.100.0
99
PyYAML>=6.0
10+
types-PyYAML>=6.0
1011
pytest-benchmark==5.2.3

utils/md_exporter.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ def _session_frontmatter_dict(session: SessionDict) -> dict[str, Any]:
5858
sorted(meta["tool_call_counts"].items(), key=lambda item: -item[1])
5959
)
6060
if meta.get("stop_reasons"):
61-
data["stop_reasons"] = dict(
62-
sorted(meta["stop_reasons"].items(), key=lambda item: -item[1])
63-
)
61+
data["stop_reasons"] = dict(sorted(meta["stop_reasons"].items(), key=lambda item: -item[1]))
6462
if meta.get("cwd"):
6563
data["working_directory"] = meta["cwd"]
6664
if meta.get("git_branch"):
@@ -525,9 +523,10 @@ def _append_yaml_value(lines: list[str], key: str, value: Any, *, indent: int =
525523
if not isinstance(value, str):
526524
raise TypeError(f"unsupported frontmatter value type: {type(value).__name__}")
527525
if "\n" in value:
528-
if all(ch in "\n\r\t" or ch.isprintable() for ch in value):
526+
content_lines = value.splitlines()
527+
if content_lines and all(ch in "\n\r\t" or ch.isprintable() for ch in value):
529528
lines.append(f"{prefix}{key}: |-")
530-
for line in value.splitlines():
529+
for line in content_lines:
531530
lines.append(f"{prefix} {line}")
532531
return
533532
lines.append(f"{prefix}{key}: {_escape_yaml(value)}")

0 commit comments

Comments
 (0)