Skip to content

Commit

Permalink
DEV: Unify code between PdfReader and PdfWriter (#2497)
Browse files Browse the repository at this point in the history
  • Loading branch information
pubpub-zz authored Mar 25, 2024
1 parent f8edf3c commit 24709a3
Show file tree
Hide file tree
Showing 21 changed files with 1,683 additions and 1,433 deletions.
5 changes: 4 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@
nitpick_ignore_regex = [
# For reasons unclear at this stage the io module prefixes everything with _io
# and this confuses sphinx
(r"py:class", r"_io.(FileIO|BytesIO|Buffered(Reader|Writer))"),
(
r"py:class",
r"(_io.(FileIO|BytesIO|Buffered(Reader|Writer))|pypdf.*PdfDocCommon)",
),
]

autodoc_default_options = {
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ You can contribute to `pypdf on GitHub <https://github.com/py-pdf/pypdf>`_.
modules/PageObject
modules/PageRange
modules/PaperSize
modules/PdfMerger
modules/RectangleObject
modules/Transformation
modules/XmpInformation
modules/annotations
modules/constants
modules/errors
modules/generic
modules/PdfDocCommon

.. toctree::
:caption: Developer Guide
Expand Down
5 changes: 5 additions & 0 deletions docs/modules/PdfDocCommon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# The PdfDocCommon Class

**PdfDocCommon** is an abstract class which is inherited by **PdfReader** and **PdfWriter**

Where indentified in the API, you can use any of the derivated class.
7 changes: 0 additions & 7 deletions docs/modules/PdfMerger.rst

This file was deleted.

1 change: 1 addition & 0 deletions docs/modules/PdfReader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ The PdfReader Class

.. autoclass:: pypdf.PdfReader
:members:
:inherited-members:
:undoc-members:
:show-inheritance:

Expand Down
1 change: 1 addition & 0 deletions docs/modules/PdfWriter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ The PdfWriter Class

.. autoclass:: pypdf.PdfWriter
:members:
:inherited-members:
:undoc-members:
:show-inheritance:

Expand Down
13 changes: 13 additions & 0 deletions docs/modules/generic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,25 @@ Generic PDF objects
:show-inheritance:
:exclude-members: Destination, Field, Fit, RectangleObject


.. autoclass:: pypdf._protocols.PdfObjectProtocol
:members:
:undoc-members:
:show-inheritance:


.. autoclass:: pypdf._protocols.XmpInformationProtocol
:members:
:undoc-members:
:show-inheritance:


.. autoclass:: pypdf._protocols.PdfCommonDocProtocol
:members:
:undoc-members:
:show-inheritance:


.. autoclass:: pypdf._protocols.PdfReaderProtocol
:members:
:undoc-members:
Expand Down
2 changes: 1 addition & 1 deletion docs/user/robustness.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ not follow the specification.

Choosing `strict=False` means that pypdf will try to be forgiving and do
something reasonable, but it will log a warning message. It is a best-effort
approach.
approach.
3 changes: 2 additions & 1 deletion pypdf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
"""

from ._crypt_providers import crypt_provider
from ._doc_common import DocumentInformation
from ._encryption import PasswordType
from ._merger import PdfMerger
from ._page import PageObject, Transformation, mult
from ._reader import DocumentInformation, PdfReader
from ._reader import PdfReader
from ._version import __version__
from ._writer import ObjectDeletionFlag, PdfWriter
from .constants import ImageType
Expand Down
Loading

0 comments on commit 24709a3

Please sign in to comment.