mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-30 01:01:00 +00:00
streams: minor API change
with_limit suggests that the method returns a new StreamReader, instead of mutating self.
This commit is contained in:
parent
83043f7aef
commit
b3c03496e4
@ -38,13 +38,13 @@ class StreamReader:
|
|||||||
self._buffer = buf
|
self._buffer = buf
|
||||||
self._ofs = ofs
|
self._ofs = ofs
|
||||||
|
|
||||||
def with_limit(self, n):
|
def set_limit(self, n):
|
||||||
'''
|
'''
|
||||||
Makes this reader to signal EOF after reading `n` bytes.
|
Makes this reader to signal EOF after reading `n` bytes.
|
||||||
|
|
||||||
Returns the number of bytes that the reader can read after
|
Returns the number of bytes that the reader can read after
|
||||||
raising EOF (intended to be restored with another call to
|
raising EOF (intended to be restored with another call to
|
||||||
`with_limit`).
|
`set_limit`).
|
||||||
'''
|
'''
|
||||||
if self._limit is not None:
|
if self._limit is not None:
|
||||||
rem = self._limit - n
|
rem = self._limit - n
|
||||||
|
Loading…
Reference in New Issue
Block a user