@@ -342,6 +342,7 @@ def get_num_pages(self) -> int:
342
342
Raises:
343
343
PdfReadError: if file is encrypted and restrictions prevent
344
344
this action.
345
+
345
346
"""
346
347
# Flattened pages will not work on an encrypted PDF;
347
348
# the PDF file's page count is used in this case. Otherwise,
@@ -365,6 +366,7 @@ def get_page(self, page_number: int) -> PageObject:
365
366
366
367
Returns:
367
368
A :class:`PageObject<pypdf._page.PageObject>` instance.
369
+
368
370
"""
369
371
if self .flattened_pages is None :
370
372
self ._flatten (self ._readonly )
@@ -468,6 +470,7 @@ def _get_named_destinations(
468
470
Returns:
469
471
A dictionary which maps names to
470
472
:class:`Destinations<pypdf.generic.Destination>`.
473
+
471
474
"""
472
475
if retval is None :
473
476
retval = {}
@@ -550,6 +553,7 @@ def get_fields(
550
553
value is a :class:`Field<pypdf.generic.Field>` object. By
551
554
default, the mapping name is used for keys.
552
555
``None`` if form data could not be located.
556
+
553
557
"""
554
558
field_attributes = FA .attributes_dict ()
555
559
field_attributes .update (CheckboxRadioButtonAttributes .attributes_dict ())
@@ -700,6 +704,7 @@ def get_form_text_fields(self, full_qualified_name: bool = False) -> Dict[str, A
700
704
701
705
If the document contains multiple form fields with the same name, the
702
706
second and following will get the suffix .2, .3, ...
707
+
703
708
"""
704
709
705
710
def indexed_key (k : str , fields : Dict [Any , Any ]) -> str :
@@ -745,6 +750,7 @@ def get_pages_showing_field(
745
750
- Multi-page list:
746
751
Field with multiple kids widgets
747
752
(example: radio buttons, field repeated on multiple pages).
753
+
748
754
"""
749
755
750
756
def _get_inherited (obj : DictionaryObject , key : str ) -> Any :
@@ -806,6 +812,7 @@ def open_destination(
806
812
807
813
Raises:
808
814
Exception: If a destination is invalid.
815
+
809
816
"""
810
817
if "/OpenAction" not in self .root_object :
811
818
return None
@@ -917,6 +924,7 @@ def get_page_number(self, page: PageObject) -> Optional[int]:
917
924
918
925
Returns:
919
926
The page number or None if page is not found
927
+
920
928
"""
921
929
return self ._get_page_number_by_indirect (page .indirect_reference )
922
930
@@ -929,6 +937,7 @@ def get_destination_page_number(self, destination: Destination) -> Optional[int]
929
937
930
938
Returns:
931
939
The page number or None if page is not found
940
+
932
941
"""
933
942
return self ._get_page_number_by_indirect (destination .page )
934
943
@@ -962,7 +971,7 @@ def _build_destination(
962
971
# create a link to first Page
963
972
tmp = self .pages [0 ].indirect_reference
964
973
indirect_reference = NullObject () if tmp is None else tmp
965
- return Destination (title , indirect_reference , Fit .fit ()) # type: ignore
974
+ return Destination (title , indirect_reference , Fit .fit ())
966
975
967
976
def _build_outline_item (self , node : DictionaryObject ) -> Optional [Destination ]:
968
977
dest , title , outline_item = None , None , None
@@ -1135,6 +1144,7 @@ def _flatten(
1135
1144
pages:
1136
1145
inherit:
1137
1146
indirect_reference: Used recursively to flatten the /Pages object.
1147
+
1138
1148
"""
1139
1149
inheritable_page_attributes = (
1140
1150
NameObject (PG .RESOURCES ),
@@ -1208,6 +1218,7 @@ def remove_page(
1208
1218
1209
1219
clean: replace PageObject with NullObject to prevent annotations
1210
1220
or destinations to reference a detached page.
1221
+
1211
1222
"""
1212
1223
if self .flattened_pages is None :
1213
1224
self ._flatten (self ._readonly )
@@ -1246,6 +1257,7 @@ def _get_indirect_object(self, num: int, gen: int) -> Optional[PdfObject]:
1246
1257
1247
1258
Returns:
1248
1259
A PdfObject
1260
+
1249
1261
"""
1250
1262
return IndirectObject (num , gen , self ).get_object ()
1251
1263
@@ -1333,6 +1345,7 @@ def _list_attachments(self) -> List[str]:
1333
1345
1334
1346
Returns:
1335
1347
list of filenames
1348
+
1336
1349
"""
1337
1350
catalog = self .root_object
1338
1351
# From the catalog get the embedded file names
@@ -1371,6 +1384,7 @@ def _get_attachments(
1371
1384
Returns:
1372
1385
dictionary of filename -> Union[bytestring or List[ByteString]]
1373
1386
If the filename exists multiple times a list of the different versions will be provided.
1387
+
1374
1388
"""
1375
1389
catalog = self .root_object
1376
1390
# From the catalog get the embedded file names
0 commit comments