Skip to content

Commit

Permalink
refactor(parse): Take on board type hints from mypy
Browse files Browse the repository at this point in the history
- `includes_mermaid` is expected to be a `bool` but the result of `.find()` is an actual page object - testing for whether this object is `None` will suffice
- `.find(text=...)` is deprecated in favour of `.find(string=...)`
  • Loading branch information
mrwilson committed Oct 8, 2023
1 parent 6543005 commit 9b9a1c8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions adr_viewer/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Adr:


def extract_statuses_from_adr(page_object) -> Iterator[str]:
status_section = page_object.find("h2", text="Status")
status_section = page_object.find("h2", string="Status")

if status_section and status_section.nextSibling:
current_node = status_section.nextSibling
Expand Down Expand Up @@ -53,7 +53,9 @@ def parse_adr(content: str) -> Optional[Adr]:

header = soup.find("h1")

includes_mermaid = soup.find(name="code", attrs={"class": "language-mermaid"})
includes_mermaid = (
soup.find(name="code", attrs={"class": "language-mermaid"}) is not None
)

if header:
return Adr(
Expand Down

0 comments on commit 9b9a1c8

Please sign in to comment.