Skip to content

Commit

Permalink
STY: Move whitespace definitions (#2944)
Browse files Browse the repository at this point in the history
Move them above where they are first used.
  • Loading branch information
j-t-1 authored Nov 15, 2024
1 parent 66089ac commit c855be0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pypdf/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ def _get_max_pdf_version_header(header1: str, header2: str) -> str:
return versions[max(pdf_header_indices)]


WHITESPACES = (b" ", b"\n", b"\r", b"\t", b"\x00")
WHITESPACES_AS_BYTES = b"".join(WHITESPACES)
WHITESPACES_AS_REGEXP = b"[" + WHITESPACES_AS_BYTES + b"]"


def read_until_whitespace(stream: StreamType, maxchars: Optional[int] = None) -> bytes:
"""
Read non-whitespace characters and return them.
Expand Down Expand Up @@ -365,11 +370,6 @@ def ord_(b: Union[int, str, bytes]) -> Union[int, bytes]:
return b


WHITESPACES = (b" ", b"\n", b"\r", b"\t", b"\x00")
WHITESPACES_AS_BYTES = b"".join(WHITESPACES)
WHITESPACES_AS_REGEXP = b"[" + WHITESPACES_AS_BYTES + b"]"


def deprecate(msg: str, stacklevel: int = 3) -> None:
warnings.warn(msg, DeprecationWarning, stacklevel=stacklevel)

Expand Down

0 comments on commit c855be0

Please sign in to comment.