Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/snippets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.15"
- name: Test the snippet checker
run: python3 -m unittest discover -s scripts -p 'test_*.py'
- name: Compare the guides with examples/
Expand Down
6 changes: 3 additions & 3 deletions scripts/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def source(path: str, region: str | None) -> tuple[str | None, str]:
file = ROOT / path
if not file.is_file():
return None, f"file not found: {path}"
text = file.read_text(encoding="utf-8")
text = file.read_text()
if region is None:
return text, ""
body = region_text(text, region)
Expand All @@ -123,7 +123,7 @@ def fence_end(lines: list[str], start: int, fence: str) -> int:
def process(page: Path, write: bool, shown: set[str]) -> list[str]:
"""Check or rewrite one page. Return its problems."""
rel = page.relative_to(ROOT).as_posix()
lines = page.read_text(encoding="utf-8").splitlines()
lines = page.read_text().splitlines()
out: list[str] = []
problems: list[str] = []
i = 0
Expand Down Expand Up @@ -174,7 +174,7 @@ def process(page: Path, write: bool, shown: set[str]) -> list[str]:
out.append(CLOSE)
i = close + 1
if write:
page.write_text("\n".join(out) + "\n", encoding="utf-8")
page.write_text("\n".join(out) + "\n")
return problems


Expand Down
2 changes: 1 addition & 1 deletion tests/sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def do_POST(self) -> None:
try:
item = json.loads(body)
except ValueError:
item = body.decode("utf-8", "replace")
item = body.decode(errors="replace")
with lock:
received.append(item)
self.send_response(204)
Expand Down
Loading