Skip to content

Commit

Permalink
Update linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Schamper committed Nov 4, 2024
1 parent 1de2344 commit 671d802
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions dissect/util/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,7 @@ def _readinto_unlocked(self, b: bytearray) -> int:
if size is not None:
remaining = size - self._pos

if n == -1:
n = remaining
else:
n = min(n, remaining)
n = remaining if n == -1 else min(n, remaining)

# Short path for when it turns out we don't need to read anything
if n == 0 or size is not None and size <= self._pos:
Expand Down Expand Up @@ -182,8 +179,9 @@ def _read(self, offset: int, length: int) -> bytes:
def _readinto(self, offset: int, buf: memoryview) -> int:
"""Provide an aligned ``readinto`` implementation for this stream.
For backwards compatibility, ``AlignedStream`` provides a default ``_readinto`` implementation, implemented in `_readinto_fallback`, that
falls back on ``_read``. However, subclasses should override the ``_readinto`` method instead of ``_readinto_fallback``.
For backwards compatibility, ``AlignedStream`` provides a default ``_readinto`` implementation, implemented
in ``_readinto_fallback``, that falls back on ``_read``. However, subclasses should override the ``_readinto``
method instead of ``_readinto_fallback``.
"""
return self._readinto_fallback(offset, buf)

Expand Down Expand Up @@ -244,7 +242,6 @@ def peek(self, n: int = 0) -> bytes:

def close(self) -> None:
"""Close the stream. Does nothing by default."""
pass


class RangeStream(AlignedStream):
Expand Down

0 comments on commit 671d802

Please sign in to comment.