9292 from typing_extensions import Self
9393
9494logger = logging .getLogger (__name__ )
95+
9596IndirectPattern = re .compile (rb"[+-]?(\d+)\s+(\d+)\s+R[^a-zA-Z]" )
9697
9798
@@ -210,8 +211,8 @@ def __isub__(self, lst: Any) -> Self:
210211 """Allow to remove items"""
211212 for x in self ._to_lst (lst ):
212213 try :
213- x = self .index (x )
214- del self [x ]
214+ index = self .index (x )
215+ del self [index ]
215216 except ValueError :
216217 pass
217218 return self
@@ -318,11 +319,11 @@ def _clone(
318319 ignore_fields:
319320
320321 """
321- # first we remove for the ignore_fields
322+ # First we remove the ignore_fields
322323 # that are for a limited number of levels
323- x = 0
324324 assert ignore_fields is not None
325325 ignore_fields = list (ignore_fields )
326+ x = 0
326327 while x < len (ignore_fields ):
327328 if isinstance (ignore_fields [x ], int ):
328329 if cast (int , ignore_fields [x ]) <= 0 :
@@ -331,7 +332,7 @@ def _clone(
331332 continue
332333 ignore_fields [x ] -= 1 # type:ignore
333334 x += 1
334- # First check if this is a chain list, we need to loop to prevent recur
335+ # Check if this is a chain list, we need to loop to prevent recur
335336 if any (
336337 field not in ignore_fields
337338 and field in src
@@ -354,8 +355,8 @@ def _clone(
354355 and k not in self
355356 and isinstance (src .raw_get (k ), IndirectObject )
356357 and isinstance (src [k ], DictionaryObject )
357- # IF need to go further the idea is to check
358- # that the types are the same:
358+ # If need to go further the idea is to check
359+ # that the types are the same
359360 and (
360361 src .get ("/Type" , None ) is None
361362 or cast (DictionaryObject , src [k ]).get ("/Type" , None ) is None
@@ -374,7 +375,7 @@ def _clone(
374375 cur_obj .__class__ (), pdf_dest , force_duplicate
375376 ),
376377 )
377- # check to see if we've previously processed our item
378+ # Check to see if we've previously processed our item
378379 if clon .indirect_reference is not None :
379380 idnum = clon .indirect_reference .idnum
380381 generation = clon .indirect_reference .generation
0 commit comments