Skip to content

Commit 384a8a7

Browse files
author
Nathanaël Renaud
committed
fix typing
1 parent 148a3bd commit 384a8a7

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

pypdf/_page.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -460,11 +460,14 @@ def _get_ids_image(
460460

461461
if PG.RESOURCES in obj:
462462
if RES.PATTERN in cast(DictionaryObject, obj[PG.RESOURCES]):
463-
for patternName, pattern in obj[PG.RESOURCES][RES.PATTERN].items():
463+
for patternName, pattern in cast(
464+
DictionaryObject,
465+
cast(DictionaryObject, obj[PG.RESOURCES])[RES.PATTERN],
466+
).items():
464467
if PG.RESOURCES in pattern.get_object() and RES.XOBJECT in cast(
465468
DictionaryObject, pattern[PG.RESOURCES]
466469
):
467-
x_object = pattern[PG.RESOURCES][RES.XOBJECT].get_object() # type: ignore
470+
x_object = pattern[PG.RESOURCES][RES.XOBJECT].get_object()
468471
for o in x_object:
469472
if not isinstance(x_object[o], StreamObject):
470473
continue
@@ -476,7 +479,10 @@ def _get_ids_image(
476479
)
477480

478481
if RES.XOBJECT in cast(DictionaryObject, obj[PG.RESOURCES]):
479-
x_object = obj[PG.RESOURCES][RES.XOBJECT].get_object() # type: ignore
482+
x_object = cast(
483+
DictionaryObject,
484+
cast(DictionaryObject, obj[PG.RESOURCES])[RES.XOBJECT],
485+
).get_object()
480486
for o in x_object:
481487
if not isinstance(x_object[o], StreamObject):
482488
continue
@@ -512,11 +518,11 @@ def _get_image(
512518

513519
xobjs = cast(
514520
DictionaryObject,
515-
cast(DictionaryObject, patterns[pattern_name][PG.RESOURCES])[
516-
RES.XOBJECT
517-
],
521+
cast(
522+
DictionaryObject,
523+
cast(DictionaryObject, patterns[pattern_name])[PG.RESOURCES],
524+
)[RES.XOBJECT],
518525
)
519-
520526
else:
521527
xobjs = cast(
522528
DictionaryObject,

0 commit comments

Comments
 (0)