Compare commits

...

3 commits

Author SHA1 Message Date
4ba8d29aee
chore: Update dependencies
Some checks failed
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/static_analysis Pipeline was successful
ci/woodpecker/push/test Pipeline failed
2025-09-12 12:15:43 +02:00
7856769cda
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.
2025-09-12 12:15:42 +02:00
4b6079d4a3
ci: Update woodpecker ci to use uv images 2025-09-12 12:15:39 +02:00
5 changed files with 525 additions and 350 deletions

View file

@ -1,16 +1,16 @@
steps:
lint_ruff:
image: python
image: ghcr.io/astral-sh/uv:python3.11-trixie-slim
commands:
- pip install ruff
- python --version && poetry --version && ruff --version
- uv tool install ruff
- python --version && uv --version && ruff --version
- echo "----------------- running ruff lint ------------------"
- ruff check .
lint_black:
image: python
format_ruff:
image: ghcr.io/astral-sh/uv:python3.11-trixie-slim
commands:
- pip install black
- python --version && poetry --version && black --version
- echo "----------------- running black lint ----------------"
- black --check .
- uv tool install ruff
- python --version && uv --version && ruff --version
- echo "----------------- running ruff format ------------------"
- ruff format --check .

View file

@ -1,9 +1,9 @@
steps:
pyright:
image: nikolaik/python-nodejs
image: ghcr.io/astral-sh/uv:python3.11-trixie-slim
commands:
- npm install --global pyright
- uv sync
- python --version && uv version && pyright --version
- uv tool install pyright
- uv sync --locked
- python --version && uv --version && pyright --version
- echo "------------- running pyright typecheck -------------"
- uv run pyright

View file

@ -3,9 +3,9 @@ when:
steps:
pytest:
image: nikolaik/python-nodejs
image: ghcr.io/astral-sh/uv:python3.11-trixie-slim
commands:
- uv sync
- python --version && uv version
- uv sync --locked
- python --version && uv --version
- echo "------------- running pytest -------------"
- uv run pytest

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:

832
uv.lock generated

File diff suppressed because it is too large Load diff