Skip to content

Commit

Permalink
Run formatter.
Browse files Browse the repository at this point in the history
  • Loading branch information
emmiegit committed Feb 9, 2024
1 parent 4d721cd commit eb954ab
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
10 changes: 7 additions & 3 deletions yellowstone/request/forum_categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@

from bs4 import Tag

from ..request.site_members import USER_ID_REGEX
from ..request.user import USER_SLUG_REGEX
from ..scraper import find_element, get_entity_date, get_entity_user, make_soup, regex_extract
from ..scraper import (
find_element,
get_entity_date,
get_entity_user,
make_soup,
regex_extract,
)
from ..types import ForumUserData
from ..wikidot import Wikidot

Expand Down
19 changes: 15 additions & 4 deletions yellowstone/request/forum_threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@

from bs4 import Tag

from .forum_categories import ForumLastPostData, extract_last_post
from ..scraper import find_element, get_entity_date, get_entity_forum_user, make_soup, regex_extract
from ..scraper import (
find_element,
get_entity_date,
get_entity_forum_user,
make_soup,
regex_extract,
)
from ..types import ForumUserData
from ..wikidot import Wikidot
from .forum_categories import extract_last_post

LAST_THREAD_ID = re.compile(r"/forum/t-(\d+)(?:\/.*)?")

Expand Down Expand Up @@ -88,7 +94,9 @@ def process_row(source: str, row: Tag) -> ForumThreadData:
sticky = True
elif isinstance(child, Tag) and child.name == "a":
# Anchor, with thread data
thread_id = int(regex_extract(source, child.attrs["href"], LAST_THREAD_ID)[1])
thread_id = int(
regex_extract(source, child.attrs["href"], LAST_THREAD_ID)[1],
)
title = child.text
source = f"{source} thread '{title}'"

Expand All @@ -98,7 +106,10 @@ def process_row(source: str, row: Tag) -> ForumThreadData:
# Thread origin
started = find_element(source, row, ".started")
started_at = get_entity_date(source, find_element(source, started, "span.odate"))
started_by = get_entity_forum_user(source, find_element(source, started, ".printuser a"))
started_by = get_entity_forum_user(
source,
find_element(source, started, ".printuser a"),
)

# Thread's last post
last_post = extract_last_post(source, find_element(source, category, ".last"))
Expand Down

0 comments on commit eb954ab

Please sign in to comment.