Skip to content

Commit

Permalink
decodeStreamData -> decode_stream_data
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma committed Jun 11, 2022
1 parent 1584094 commit 897a30a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion PyPDF2/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def decode(
return tiff_header + data


def decodeStreamData(stream: Any) -> Union[str, bytes]: # utils.StreamObject
def decode_stream_data(stream: Any) -> Union[str, bytes]: # utils.StreamObject
filters = stream.get(SA.FILTER, ())

if len(filters) and not isinstance(filters[0], NameObject):
Expand Down Expand Up @@ -537,6 +537,11 @@ def decodeStreamData(stream: Any) -> Union[str, bytes]: # utils.StreamObject
return data


def decodeStreamData(stream: Any) -> Union[str, bytes]:
deprecate_with_replacement("decodeStreamData", "decode_stream_data", "4.0.0")
return decode_stream_data(stream)


def _xobj_to_image(x_object_obj: Dict[str, Any]) -> Tuple[Optional[str], bytes]:
"""
Users need to have the pillow package installed.
Expand Down
4 changes: 2 additions & 2 deletions PyPDF2/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ def decodedSelf(self, value: DecodedStreamObject) -> None: # pragma: no cover
self.decoded_self = value

def get_data(self) -> Union[None, str, bytes]:
from .filters import decodeStreamData
from .filters import decode_stream_data

if self.decoded_self is not None:
# cached version of decoded object
Expand All @@ -1095,7 +1095,7 @@ def get_data(self) -> Union[None, str, bytes]:
# create decoded object
decoded = DecodedStreamObject()

decoded._data = decodeStreamData(self)
decoded._data = decode_stream_data(self)
for key, value in list(self.items()):
if key not in (SA.LENGTH, SA.FILTER, SA.DECODE_PARMS):
decoded[key] = value
Expand Down

0 comments on commit 897a30a

Please sign in to comment.