@@ -125,10 +125,7 @@ def _readinto_unlocked(self, b: bytearray) -> int:
125125 if size is not None :
126126 remaining = size - self ._pos
127127
128- if n == - 1 :
129- n = remaining
130- else :
131- n = min (n , remaining )
128+ n = remaining if n == - 1 else min (n , remaining )
132129
133130 # Short path for when it turns out we don't need to read anything
134131 if n == 0 or size is not None and size <= self ._pos :
@@ -182,8 +179,9 @@ def _read(self, offset: int, length: int) -> bytes:
182179 def _readinto (self , offset : int , buf : memoryview ) -> int :
183180 """Provide an aligned ``readinto`` implementation for this stream.
184181
185- For backwards compatibility, ``AlignedStream`` provides a default ``_readinto`` implementation, implemented in `_readinto_fallback`, that
186- falls back on ``_read``. However, subclasses should override the ``_readinto`` method instead of ``_readinto_fallback``.
182+ For backwards compatibility, ``AlignedStream`` provides a default ``_readinto`` implementation, implemented
183+ in ``_readinto_fallback``, that falls back on ``_read``. However, subclasses should override the ``_readinto``
184+ method instead of ``_readinto_fallback``.
187185 """
188186 return self ._readinto_fallback (offset , buf )
189187
@@ -244,7 +242,6 @@ def peek(self, n: int = 0) -> bytes:
244242
245243 def close (self ) -> None :
246244 """Close the stream. Does nothing by default."""
247- pass
248245
249246
250247class RangeStream (AlignedStream ):
0 commit comments