Skip to content

Commit

Permalink
MAINT: Remove PyPDF2._utils.bytes_type (#1053)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma authored Jul 5, 2022
1 parent 02c601c commit ffacabc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 0 additions & 1 deletion PyPDF2/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
float, float, float, float, float, float
]

bytes_type = bytes # Works the same in Python 2.X and 3.X
StreamType = Union[BytesIO, BufferedReader, BufferedWriter, FileIO]
StrByteType = Union[str, StreamType]

Expand Down
5 changes: 2 additions & 3 deletions PyPDF2/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
WHITESPACES,
StreamType,
b_,
bytes_type,
deprecate_no_replacement,
deprecate_with_replacement,
hex_str,
Expand Down Expand Up @@ -496,7 +495,7 @@ def read_string_from_stream(
return create_string_object(txt, forced_encoding)


class ByteStringObject(bytes_type, PdfObject): # type: ignore
class ByteStringObject(bytes, PdfObject): # type: ignore
"""
Represents a string object where the text encoding could not be determined.
This occurs quite often, as the PDF spec doesn't provide an alternate way to
Expand Down Expand Up @@ -1897,7 +1896,7 @@ def create_string_object(
"""
if isinstance(string, str):
return TextStringObject(string)
elif isinstance(string, bytes_type):
elif isinstance(string, bytes):
if isinstance(forced_encoding, (list, dict)):
out = ""
for x in string:
Expand Down

0 comments on commit ffacabc

Please sign in to comment.