Skip to content

Commit

Permalink
STY: Use unnecessary one-line function / class attribute (#1043)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma committed Jun 30, 2022
1 parent d1f2ed2 commit 84c3e33
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
6 changes: 1 addition & 5 deletions PyPDF2/filters.py
Expand Up @@ -73,10 +73,6 @@ def decompress(data: bytes) -> bytes:
return result_str


def compress(data: bytes) -> bytes:
return zlib.compress(data)


class FlateDecode:
@staticmethod
def decode(
Expand Down Expand Up @@ -171,7 +167,7 @@ def _decode_png_prediction(data: str, columns: int) -> str:

@staticmethod
def encode(data: bytes) -> bytes:
return compress(data)
return zlib.compress(data)


class ASCIIHexDecode:
Expand Down
5 changes: 1 addition & 4 deletions PyPDF2/generic.py
Expand Up @@ -342,7 +342,6 @@ def writeToStream(

class NumberObject(int, PdfObject):
NumberPattern = re.compile(b"[^+-.0-9]")
ByteDot = b"."

def __new__(cls, value: Any) -> "NumberObject":
val = int(value)
Expand All @@ -368,7 +367,7 @@ def writeToStream(
@staticmethod
def read_from_stream(stream: StreamType) -> Union["NumberObject", FloatObject]:
num = read_until_regex(stream, NumberObject.NumberPattern)
if num.find(NumberObject.ByteDot) != -1:
if num.find(b".") != -1:
return FloatObject(num)
return NumberObject(num)

Expand Down Expand Up @@ -1175,12 +1174,10 @@ def __init__(
assert stream_data is not None
stream_data_bytes = b_(stream_data)
stream_bytes = BytesIO(stream_data_bytes)
# self.savstream = stream
self.forced_encoding = forced_encoding
self.__parse_content_stream(stream_bytes)

def __parse_content_stream(self, stream: StreamType) -> None:
# file("f:\\tmp.txt", "w").write(stream.read())
stream.seek(0, 0)
operands: List[Union[int, str, PdfObject]] = []
while True:
Expand Down

0 comments on commit 84c3e33

Please sign in to comment.