Skip to content

Commit

Permalink
Fix type hints
Browse files Browse the repository at this point in the history
Nota: the two on content and mimetype are just linked to
openzim/python-scraperlib#196
and will have to be reverted once this issue is fixed
  • Loading branch information
benoit74 committed Oct 8, 2024
1 parent 5d452e1 commit 80e8ee4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/warc2zim/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pathlib import Path

from jinja2.environment import Template
from libzim.writer import Hint # pyright: ignore[reportMissingImports]
from libzim.writer import Hint # pyright: ignore[reportMissingModuleSource]
from warcio.recordloader import ArcWarcRecord
from zimscraperlib.types import get_mime_for_name
from zimscraperlib.zim.items import StaticItem
Expand Down
8 changes: 6 additions & 2 deletions tests/test_warc_to_zim.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,15 @@ def verify_warc_and_zim(self, warcfile, zimfile):
elif record.rec_type == "response":
# We must have a payload
assert payload
payload_content = payload.content.tobytes()
payload_content = (
payload.content.tobytes() # pyright:ignore[reportAttributeAccessIssue]
)

# if HTML, still need to account for the head insert, otherwise should
# have exact match
if payload.mimetype.startswith("text/html"):
if payload.mimetype.startswith( # pyright:ignore[reportAttributeAccessIssue]
"text/html"
):
assert head_insert in payload_content
elif record.rec_type == "resource":
# we do not want to embed resources "as-is"
Expand Down

0 comments on commit 80e8ee4

Please sign in to comment.