Skip to content

Commit c9162be

Browse files
committed
add grave that were removed by mistake
1 parent e3c9b4b commit c9162be

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

libp2p/stream_muxer/mplex/mplex_stream.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class MplexStream(IMuxedStream):
107107

108108
name: str
109109
stream_id: StreamID
110-
# NOTE: All methods used here are part of Mplex which is a derived
110+
# NOTE: All methods used here are part of `Mplex` which is a derived
111111
# class of IMuxedConn. Ignoring this type assignment should not pose
112112
# any risk.
113113
muxed_conn: "Mplex" # type: ignore[assignment]
@@ -117,7 +117,7 @@ class MplexStream(IMuxedStream):
117117
rw_lock: ReadWriteLock
118118
close_lock: trio.Lock
119119

120-
# NOTE: dataIn is size of 8 in Go implementation.
120+
# NOTE: `dataIn` is size of 8 in Go implementation.
121121
incoming_data_channel: "trio.MemoryReceiveChannel[bytes]"
122122

123123
event_local_closed: trio.Event
@@ -175,8 +175,8 @@ def _read_return_when_blocked(self) -> bytearray:
175175

176176
async def read(self, n: int | None = None) -> bytes:
177177
"""
178-
Read up to n bytes. Read possibly returns fewer than n bytes, if
179-
there are not enough bytes in the Mplex buffer. If n is None, read
178+
Read up to n bytes. Read possibly returns fewer than `n` bytes, if
179+
there are not enough bytes in the Mplex buffer. If `n is None`, read
180180
until EOF.
181181
182182
:param n: number of bytes to read
@@ -185,8 +185,8 @@ async def read(self, n: int | None = None) -> bytes:
185185
async with self.rw_lock.read_lock():
186186
if n is not None and n < 0:
187187
raise ValueError(
188-
"the number of bytes to read n must be non-negative or "
189-
f"None to indicate read until EOF, got n={n}"
188+
"the number of bytes to read `n` must be non-negative or "
189+
f"`None` to indicate read until EOF, got n={n}"
190190
)
191191
if self.event_reset.is_set():
192192
raise MplexStreamReset
@@ -202,8 +202,8 @@ async def read(self, n: int | None = None) -> bytes:
202202
except trio.EndOfChannel:
203203
raise MplexStreamEOF
204204
except trio.WouldBlock:
205-
# We know receive will be blocked here. Wait for data here with
206-
# receive and catch all kinds of errors here.
205+
# We know `receive` will be blocked here. Wait for data here with
206+
# `receive` and catch all kinds of errors here.
207207
try:
208208
data = await self.incoming_data_channel.receive()
209209
self._buf.extend(data)
@@ -213,12 +213,12 @@ async def read(self, n: int | None = None) -> bytes:
213213
if self.event_remote_closed.is_set():
214214
raise MplexStreamEOF
215215
except trio.ClosedResourceError as error:
216-
# Probably incoming_data_channel is closed in reset when we are
217-
# waiting for receive.
216+
# Probably `incoming_data_channel` is closed in `reset` when
217+
# we are waiting for `receive`.
218218
if self.event_reset.is_set():
219219
raise MplexStreamReset
220220
raise Exception(
221-
"incoming_data_channel is closed but stream is not reset. "
221+
"`incoming_data_channel` is closed but stream is not reset."
222222
"This should never happen."
223223
) from error
224224
self._buf.extend(self._read_return_when_blocked())
@@ -256,7 +256,7 @@ async def close(self) -> None:
256256
flag = (
257257
HeaderTags.CloseInitiator if self.is_initiator else HeaderTags.CloseReceiver
258258
)
259-
# TODO: Raise when muxed_conn.send_message fails and Mplex isn't shutdown.
259+
# TODO: Raise when `muxed_conn.send_message` fails and `Mplex` isn't shutdown.
260260
await self.muxed_conn.send_message(flag, None, self.stream_id)
261261

262262
_is_remote_closed: bool

0 commit comments

Comments
 (0)