chore: Update beautifulsoup4 dependency

Updated dependency and, with its newly provided type hints, removed some
pyright overrides.

Added a cast where there was still not enough type hinting.
This commit is contained in:
Marty Oehme 2025-09-12 10:44:53 +02:00
parent ff6cdf3cca
commit 24a4812051
Signed by: Marty
GPG key ID: 4E535BC19C61886E
2 changed files with 18 additions and 9 deletions

View file

@ -1,6 +1,7 @@
# pyright: strict, reportUnknownMemberType=false
import mimetypes
from pathlib import Path
from typing import cast
import papis.logging
from bs4 import BeautifulSoup
@ -48,16 +49,14 @@ class PocketBookExtractor:
annotations: list[Annotation] = []
for bm in html.select("div.bookmark"):
content = str(
(bm.select_one("div.bm-text>p") or html.new_string("")).text or "" # pyright: ignore [reportUnknownArgumentType]
(bm.select_one("div.bm-text>p") or html.new_string("")).text or ""
)
note = str(
(bm.select_one("div.bm-note>p") or html.new_string("")).text or "" # pyright: ignore [reportUnknownArgumentType]
)
page = int(
(bm.select_one("p.bm-page") or html.new_string("")).text or 0 # pyright: ignore [reportUnknownArgumentType]
(bm.select_one("div.bm-note>p") or html.new_string("")).text or ""
)
page = int((bm.select_one("p.bm-page") or html.new_string("")).text or 0)
el_classes = bm.attrs.get("class", "").split(" ")
el_classes = cast("str", bm.attrs.get("class", "")).split(" ")
color = (0, 0, 0)
for c in el_classes:
if "bm-color-" in c: