Description
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
.