mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
fix: linting error related to read
This commit is contained in:
@ -140,6 +140,7 @@ class MplexStream(IMuxedStream):
|
|||||||
:return: bytes actually read
|
:return: bytes actually read
|
||||||
"""
|
"""
|
||||||
await self.rw_lock.acquire_read()
|
await self.rw_lock.acquire_read()
|
||||||
|
payload: bytes = b""
|
||||||
try:
|
try:
|
||||||
if n is not None and n < 0:
|
if n is not None and n < 0:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
@ -180,12 +181,12 @@ class MplexStream(IMuxedStream):
|
|||||||
"This should never happen."
|
"This should never happen."
|
||||||
) from error
|
) from error
|
||||||
self._buf.extend(self._read_return_when_blocked())
|
self._buf.extend(self._read_return_when_blocked())
|
||||||
payload = self._buf[:n]
|
chunk = self._buf[:n]
|
||||||
self._buf = self._buf[len(payload) :]
|
self._buf = self._buf[len(chunk) :]
|
||||||
return bytes(payload)
|
payload = bytes(chunk)
|
||||||
finally:
|
finally:
|
||||||
await self.rw_lock.release_read()
|
await self.rw_lock.release_read()
|
||||||
return b""
|
return payload
|
||||||
|
|
||||||
async def write(self, data: bytes) -> None:
|
async def write(self, data: bytes) -> None:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user