Compare commits

...

3 commits

Author SHA1 Message Date
4e5a9e92a7
chore: Update dependencies
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/static_analysis Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
2025-09-12 10:55:31 +02:00
528052967f
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 10:55:31 +02:00
1dd00adaee
chore: Update woodpecker ci to use uv 2025-09-12 10:55:30 +02:00
5 changed files with 525 additions and 350 deletions

View file

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

View file

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

View file

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

View file

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

832
uv.lock generated

File diff suppressed because it is too large Load diff