From 80e8ee4497827cf6ec22f9f017ff3113626247e2 Mon Sep 17 00:00:00 2001 From: benoit74 Date: Tue, 8 Oct 2024 09:58:04 +0000 Subject: [PATCH] Fix type hints Nota: the two on content and mimetype are just linked to https://github.com/openzim/python-scraperlib/issues/196 and will have to be reverted once this issue is fixed --- src/warc2zim/items.py | 2 +- tests/test_warc_to_zim.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/warc2zim/items.py b/src/warc2zim/items.py index 83dae05..891cfb6 100644 --- a/src/warc2zim/items.py +++ b/src/warc2zim/items.py @@ -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 diff --git a/tests/test_warc_to_zim.py b/tests/test_warc_to_zim.py index 4bfcf75..8e23392 100644 --- a/tests/test_warc_to_zim.py +++ b/tests/test_warc_to_zim.py @@ -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"