From 54b427a9e995901535fcb99239e4c6e947ccab6e Mon Sep 17 00:00:00 2001 From: Piotr Kopalko Date: Fri, 11 Aug 2023 09:49:40 +0200 Subject: [PATCH] chore: Inline OptionalInt --- falcon/stream.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/falcon/stream.py b/falcon/stream.py index 4e1ad1427..c300ee98a 100644 --- a/falcon/stream.py +++ b/falcon/stream.py @@ -24,8 +24,6 @@ Result = TypeVar('Result', bound=Union[bytes, List[bytes]]) -OptionalInt = Optional[int] - class BoundedStream(io.IOBase): """Wrap *wsgi.input* streams to make them more robust. @@ -67,7 +65,7 @@ def __next__(self) -> bytes: next = __next__ - def _read(self, size: OptionalInt, target: Callable[[int], Result]) -> Result: + def _read(self, size: Optional[int], target: Callable[[int], Result]) -> Result: """Proxy reads to the underlying stream. Args: @@ -105,7 +103,7 @@ def writable(self) -> bool: """Return ``False`` always.""" return False - def read(self, size: OptionalInt = None) -> bytes: + def read(self, size: Optional[int] = None) -> bytes: """Read from the stream. Args: @@ -119,7 +117,7 @@ def read(self, size: OptionalInt = None) -> bytes: return self._read(size, self.stream.read) - def readline(self, limit: OptionalInt = None) -> bytes: + def readline(self, limit: Optional[int] = None) -> bytes: """Read a line from the stream. Args: @@ -133,7 +131,7 @@ def readline(self, limit: OptionalInt = None) -> bytes: return self._read(limit, self.stream.readline) - def readlines(self, hint: OptionalInt = None) -> List[bytes]: + def readlines(self, hint: Optional[int] = None) -> List[bytes]: """Read lines from the stream. Args: