Skip to content

Commit

Permalink
further mypy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan6419846 committed Oct 22, 2024
1 parent 514edb4 commit f728918
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pypdf/_doc_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ def _build_destination(
# create a link to first Page
tmp = self.pages[0].indirect_reference
indirect_reference = NullObject() if tmp is None else tmp
return Destination(title, indirect_reference, Fit.fit()) # type: ignore
return Destination(title, indirect_reference, Fit.fit())

def _build_outline_item(self, node: DictionaryObject) -> Optional[Destination]:
dest, title, outline_item = None, None, None
Expand Down
4 changes: 2 additions & 2 deletions pypdf/_xobj_image_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def _handle_flate(
[
b"".join(
[
colors_arr[1 if img.getpixel((x, y)) > 127 else 0]
colors_arr[1 if img.getpixel((x, y)) > 127 else 0] # type: ignore[operator]
for x in range(img.size[0])
]
)
Expand Down Expand Up @@ -296,7 +296,7 @@ def _handle_jpx(
# we need to convert to the good mode
if img1.mode == mode or {img1.mode, mode} == {"L", "P"}: # compare (unordered) sets
# L,P are indexed modes which should not be changed.
img = img1
img: Image.Image = img1
elif {img1.mode, mode} == {"RGBA", "CMYK"}:
# RGBA / CMYK are 4bytes encoding where
# the encoding should be corrected
Expand Down
6 changes: 3 additions & 3 deletions pypdf/generic/_fit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Optional, Tuple, Union
from typing import Any, List, Optional, Tuple, Union

from ._base import is_null_or_none

Expand All @@ -7,10 +7,10 @@ class Fit:
def __init__(
self, fit_type: str, fit_args: Tuple[Union[None, float, Any], ...] = ()
):
from ._base import FloatObject, NameObject, NullObject
from ._base import FloatObject, NameObject, NullObject, NumberObject

self.fit_type = NameObject(fit_type)
self.fit_args = [
self.fit_args: List[Union[NullObject, FloatObject, NumberObject]] = [
NullObject() if is_null_or_none(a) else FloatObject(a) for a in fit_args
]

Expand Down

0 comments on commit f728918

Please sign in to comment.