Skip to content

Propose removal of unused arguments in decode methods #3165

Open
@j-t-1

Description

@j-t-1

Four of the ten pypdf class filters have, but do not need, a decode_parms argument in their decode methods:

ASCIIHexDecode
ASCII85Decode
RunLengthDecode
JPXDecode

The rationale for having unused decode_parms is so external code has a uniform interface for filters. However, their existence tends to make the code less self explanatory.

Benefits of removing these:

Follows the design principle of moving semantics out of comments into code. The function signature will be more self contained, not relying on a comment explaining that one of the arguments is unused.

Coding to external library users who may not even use a uniform interface, complicates our interfaces. We do not use decode_parms in function decode_stream_data (which calls most of the filters) when it is unused, suggesting uniformity is not overly useful here.

Because all filter class decode methods have **kwargs: Any, any 3rd party code that does break can be fixed simply by ensuring decode_parms= is explicitly used when calling decode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    is-maintenanceAnything that is just internal: Simplifying code, syntax changes, updating docs, speed improvementsneeds-discussionThe PR/issue needs more discussion before we can continue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions