@@ -342,6 +342,7 @@ def get_num_pages(self) -> int:
342342 Raises:
343343 PdfReadError: if file is encrypted and restrictions prevent
344344 this action.
345+
345346 """
346347 # Flattened pages will not work on an encrypted PDF;
347348 # the PDF file's page count is used in this case. Otherwise,
@@ -365,6 +366,7 @@ def get_page(self, page_number: int) -> PageObject:
365366
366367 Returns:
367368 A :class:`PageObject<pypdf._page.PageObject>` instance.
369+
368370 """
369371 if self .flattened_pages is None :
370372 self ._flatten (self ._readonly )
@@ -468,6 +470,7 @@ def _get_named_destinations(
468470 Returns:
469471 A dictionary which maps names to
470472 :class:`Destinations<pypdf.generic.Destination>`.
473+
471474 """
472475 if retval is None :
473476 retval = {}
@@ -550,6 +553,7 @@ def get_fields(
550553 value is a :class:`Field<pypdf.generic.Field>` object. By
551554 default, the mapping name is used for keys.
552555 ``None`` if form data could not be located.
556+
553557 """
554558 field_attributes = FA .attributes_dict ()
555559 field_attributes .update (CheckboxRadioButtonAttributes .attributes_dict ())
@@ -700,6 +704,7 @@ def get_form_text_fields(self, full_qualified_name: bool = False) -> Dict[str, A
700704
701705 If the document contains multiple form fields with the same name, the
702706 second and following will get the suffix .2, .3, ...
707+
703708 """
704709
705710 def indexed_key (k : str , fields : Dict [Any , Any ]) -> str :
@@ -745,6 +750,7 @@ def get_pages_showing_field(
745750 - Multi-page list:
746751 Field with multiple kids widgets
747752 (example: radio buttons, field repeated on multiple pages).
753+
748754 """
749755
750756 def _get_inherited (obj : DictionaryObject , key : str ) -> Any :
@@ -806,6 +812,7 @@ def open_destination(
806812
807813 Raises:
808814 Exception: If a destination is invalid.
815+
809816 """
810817 if "/OpenAction" not in self .root_object :
811818 return None
@@ -917,6 +924,7 @@ def get_page_number(self, page: PageObject) -> Optional[int]:
917924
918925 Returns:
919926 The page number or None if page is not found
927+
920928 """
921929 return self ._get_page_number_by_indirect (page .indirect_reference )
922930
@@ -929,6 +937,7 @@ def get_destination_page_number(self, destination: Destination) -> Optional[int]
929937
930938 Returns:
931939 The page number or None if page is not found
940+
932941 """
933942 return self ._get_page_number_by_indirect (destination .page )
934943
@@ -962,7 +971,7 @@ def _build_destination(
962971 # create a link to first Page
963972 tmp = self .pages [0 ].indirect_reference
964973 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 ())
966975
967976 def _build_outline_item (self , node : DictionaryObject ) -> Optional [Destination ]:
968977 dest , title , outline_item = None , None , None
@@ -1135,6 +1144,7 @@ def _flatten(
11351144 pages:
11361145 inherit:
11371146 indirect_reference: Used recursively to flatten the /Pages object.
1147+
11381148 """
11391149 inheritable_page_attributes = (
11401150 NameObject (PG .RESOURCES ),
@@ -1208,6 +1218,7 @@ def remove_page(
12081218
12091219 clean: replace PageObject with NullObject to prevent annotations
12101220 or destinations to reference a detached page.
1221+
12111222 """
12121223 if self .flattened_pages is None :
12131224 self ._flatten (self ._readonly )
@@ -1246,6 +1257,7 @@ def _get_indirect_object(self, num: int, gen: int) -> Optional[PdfObject]:
12461257
12471258 Returns:
12481259 A PdfObject
1260+
12491261 """
12501262 return IndirectObject (num , gen , self ).get_object ()
12511263
@@ -1333,6 +1345,7 @@ def _list_attachments(self) -> List[str]:
13331345
13341346 Returns:
13351347 list of filenames
1348+
13361349 """
13371350 catalog = self .root_object
13381351 # From the catalog get the embedded file names
@@ -1371,6 +1384,7 @@ def _get_attachments(
13711384 Returns:
13721385 dictionary of filename -> Union[bytestring or List[ByteString]]
13731386 If the filename exists multiple times a list of the different versions will be provided.
1387+
13741388 """
13751389 catalog = self .root_object
13761390 # From the catalog get the embedded file names
0 commit comments