diff --git a/website/fetch_github_stars.py b/website/fetch_github_stars.py
index c93ef4ec..48aaacf7 100644
--- a/website/fetch_github_stars.py
+++ b/website/fetch_github_stars.py
@@ -11,7 +11,6 @@ from itertools import batched
from pathlib import Path
import httpx
-
from build import extract_github_repo, load_stars
CACHE_MAX_AGE_HOURS = 12
@@ -53,10 +52,7 @@ def build_graphql_query(repos: Sequence[str]) -> str:
owner, name = repo.split("/", 1)
if not GITHUB_OWNER_RE.match(owner) or not GITHUB_NAME_RE.match(name):
continue
- parts.append(
- f'repo_{i}: repository(owner: "{owner}", name: "{name}") '
- f"{{ stargazerCount owner {{ login }} defaultBranchRef {{ target {{ ... on Commit {{ committedDate }} }} }} }}"
- )
+ parts.append(f'repo_{i}: repository(owner: "{owner}", name: "{name}") {{ stargazerCount owner {{ login }} defaultBranchRef {{ target {{ ... on Commit {{ committedDate }} }} }} }}')
if not parts:
return ""
return "query { " + " ".join(parts) + " }"
diff --git a/website/readme_parser.py b/website/readme_parser.py
index 79045768..a80acc32 100644
--- a/website/readme_parser.py
+++ b/website/readme_parser.py
@@ -229,18 +229,22 @@ def _parse_list_entries(
if sub_inline:
sub_link = _find_child(sub_inline, "link")
if sub_link:
- also_see.append(AlsoSee(
- name=render_inline_text(sub_link.children),
- url=_href(sub_link),
- ))
+ also_see.append(
+ AlsoSee(
+ name=render_inline_text(sub_link.children),
+ url=_href(sub_link),
+ )
+ )
- entries.append(ParsedEntry(
- name=name,
- url=url,
- description=desc_html,
- also_see=also_see,
- subcategory=subcategory,
- ))
+ entries.append(
+ ParsedEntry(
+ name=name,
+ url=url,
+ description=desc_html,
+ also_see=also_see,
+ subcategory=subcategory,
+ )
+ )
return entries
@@ -275,7 +279,6 @@ def _build_section(name: str, body: list[SyntaxTreeNode]) -> ParsedSection:
)
-
def _is_bold_marker(node: SyntaxTreeNode) -> str | None:
"""Detect a bold-only paragraph used as a group marker.
@@ -321,11 +324,13 @@ def _parse_grouped_sections(
nonlocal current_group_name, current_group_cats
if current_group_cats:
name = current_group_name or "Other"
- groups.append(ParsedGroup(
- name=name,
- slug=slugify(name),
- categories=list(current_group_cats),
- ))
+ groups.append(
+ ParsedGroup(
+ name=name,
+ slug=slugify(name),
+ categories=list(current_group_cats),
+ )
+ )
current_group_name = None
current_group_cats = []
diff --git a/website/tests/test_fetch_github_stars.py b/website/tests/test_fetch_github_stars.py
index 52d4b1cf..6f0297b6 100644
--- a/website/tests/test_fetch_github_stars.py
+++ b/website/tests/test_fetch_github_stars.py
@@ -17,18 +17,12 @@ class TestExtractGithubRepos:
assert result == {"psf/requests"}
def test_multiple_repos(self):
- readme = (
- "* [requests](https://github.com/psf/requests) - HTTP.\n"
- "* [flask](https://github.com/pallets/flask) - Micro."
- )
+ readme = "* [requests](https://github.com/psf/requests) - HTTP.\n* [flask](https://github.com/pallets/flask) - Micro."
result = extract_github_repos(readme)
assert result == {"psf/requests", "pallets/flask"}
def test_deduplicates(self):
- readme = (
- "* [a](https://github.com/org/repo) - A.\n"
- "* [b](https://github.com/org/repo) - B."
- )
+ readme = "* [a](https://github.com/org/repo) - A.\n* [b](https://github.com/org/repo) - B."
result = extract_github_repos(readme)
assert result == {"org/repo"}
diff --git a/website/tests/test_readme_parser.py b/website/tests/test_readme_parser.py
index 6046aa5c..5273580f 100644
--- a/website/tests/test_readme_parser.py
+++ b/website/tests/test_readme_parser.py
@@ -350,10 +350,7 @@ def _content_nodes(md_text: str) -> list[SyntaxTreeNode]:
class TestParseSectionEntries:
def test_flat_entries(self):
- nodes = _content_nodes(
- "- [django](https://example.com/d) - A web framework.\n"
- "- [flask](https://example.com/f) - A micro framework.\n"
- )
+ nodes = _content_nodes("- [django](https://example.com/d) - A web framework.\n- [flask](https://example.com/f) - A micro framework.\n")
entries = _parse_section_entries(nodes)
assert len(entries) == 2
assert entries[0]["name"] == "django"
@@ -370,13 +367,7 @@ class TestParseSectionEntries:
assert entries[0]["description"] == ""
def test_subcategorized_entries(self):
- nodes = _content_nodes(
- "- Algorithms\n"
- " - [algos](https://x.com/a) - Algo lib.\n"
- " - [sorts](https://x.com/s) - Sort lib.\n"
- "- Design Patterns\n"
- " - [patterns](https://x.com/p) - Pattern lib.\n"
- )
+ nodes = _content_nodes("- Algorithms\n - [algos](https://x.com/a) - Algo lib.\n - [sorts](https://x.com/s) - Sort lib.\n- Design Patterns\n - [patterns](https://x.com/p) - Pattern lib.\n")
entries = _parse_section_entries(nodes)
assert len(entries) == 3
assert entries[0]["name"] == "algos"
@@ -432,7 +423,7 @@ class TestParseSectionEntries:
assert cats[0]["entry_count"] == 3
def test_description_html_escapes_xss(self):
- nodes = _content_nodes('- [lib](https://x.com) - A lib.\n')
+ nodes = _content_nodes("- [lib](https://x.com) - A lib.\n")
entries = _parse_section_entries(nodes)
assert "