Skip to content

Commit 0292f57

Browse files
addressing ci errors
1 parent b2bbffc commit 0292f57

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

pypdf/_cmap.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -460,11 +460,11 @@ def build_font_width_map(
460460
# will consider width of char as avg(width)
461461
m = 0
462462
cpt = 0
463-
for xx in w:
464-
xx_val = xx.get_object()
465-
if xx_val > 0:
466-
m += xx_val
467-
cpt += 1
463+
for xx in w:
464+
xx_val = xx.get_object()
465+
if xx_val > 0:
466+
m += xx_val
467+
cpt += 1
468468
font_width_map["default"] = m / max(1, cpt)
469469
st = cast(int, ft["/FirstChar"])
470470
en = cast(int, ft["/LastChar"])

pypdf/_page.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -740,14 +740,14 @@ def _get_inline_images(self) -> dict[str, ImageFile]:
740740
if k in {"/Length", "/L"}: # no length is expected
741741
continue
742742
if isinstance(v, list):
743-
translated_v = ArrayObject(
743+
value_for_init: Any = ArrayObject(
744744
[self._translate_value_inline_image(k, x) for x in v]
745745
)
746746
else:
747-
translated_v = self._translate_value_inline_image(k, v)
747+
value_for_init: Any = self._translate_value_inline_image(k, v)
748748
mapped_k = NameObject(_INLINE_IMAGE_KEY_MAPPING[k])
749749
if mapped_k not in init:
750-
init[mapped_k] = translated_v
750+
init[mapped_k] = value_for_init
751751
ii["object"] = EncodedStreamObject.initialize_from_dictionary(init)
752752
extension, byte_stream, img = _xobj_to_image(ii["object"])
753753
files[f"~{num}~"] = ImageFile(

pypdf/_text_extraction/_layout_mode/_fixed_width_page.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,10 @@ def recurs_to_target_op(
188188
text_state_mgr.reset_trm()
189189
if op == b"Tm":
190190
text_state_mgr.reset_tm()
191+
operands_for_tm = operands
191192
elif op == b"TD":
192193
text_state_mgr.set_state_param(b"TL", -operands[1])
194+
operands_for_tm = operands
193195
elif op == b"T*":
194196
operands_for_tm = [0, -text_state_mgr.TL]
195197
else:

pypdf/filters.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -760,26 +760,30 @@ def decode_stream_data(stream: Any) -> bytes:
760760
if not data:
761761
return data
762762
for filter_name, params in zip(filters, decode_parms):
763-
params_obj = {} if isinstance(params, NullObject) else params
763+
params_typed: Optional[DictionaryObject]
764+
if isinstance(params, NullObject):
765+
params_typed = None
766+
else:
767+
params_typed = cast(Optional[DictionaryObject], params)
764768
if filter_name in (FT.ASCII_HEX_DECODE, FTA.AHx):
765769
data = ASCIIHexDecode.decode(data)
766770
elif filter_name in (FT.ASCII_85_DECODE, FTA.A85):
767771
data = ASCII85Decode.decode(data)
768772
elif filter_name in (FT.LZW_DECODE, FTA.LZW):
769-
data = LZWDecode.decode(data, params_obj)
773+
data = LZWDecode.decode(data, params_typed)
770774
elif filter_name in (FT.FLATE_DECODE, FTA.FL):
771-
data = FlateDecode.decode(data, params_obj)
775+
data = FlateDecode.decode(data, params_typed)
772776
elif filter_name in (FT.RUN_LENGTH_DECODE, FTA.RL):
773777
data = RunLengthDecode.decode(data)
774778
elif filter_name == FT.CCITT_FAX_DECODE:
775779
height = stream.get(IA.HEIGHT, ())
776-
data = CCITTFaxDecode.decode(data, params_obj, height)
780+
data = CCITTFaxDecode.decode(data, params_typed, height)
777781
elif filter_name == FT.DCT_DECODE:
778782
data = DCTDecode.decode(data)
779783
elif filter_name == FT.JPX_DECODE:
780784
data = JPXDecode.decode(data)
781785
elif filter_name == FT.JBIG2_DECODE:
782-
data = JBIG2Decode.decode(data, params_obj)
786+
data = JBIG2Decode.decode(data, params_typed)
783787
elif filter_name == "/Crypt":
784788
if "/Name" in params or "/Type" in params:
785789
raise NotImplementedError(

0 commit comments

Comments
 (0)