Skip to content

Commit b6b8ba4

Browse files
committed
shorten variable name to max_empties
Avoid some flake8 warnings about too long lines and line breaks before/after logical operator.
1 parent 8704d46 commit b6b8ba4

File tree

1 file changed

+5
-6
lines changed
  • python_packages/jupyter_lsp/jupyter_lsp

1 file changed

+5
-6
lines changed

python_packages/jupyter_lsp/jupyter_lsp/stdio.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ async def read(self) -> None:
9898
await self.sleep()
9999

100100
def _read_content(
101-
self, length: int, max_parts=100, max_empty_parts_in_a_row=50
101+
self, length: int, max_parts=100, max_empties=50
102102
) -> Optional[bytes]:
103-
"""Read the full length of the message unless exceeding max_parts.
103+
"""Read the full length of the message unless exceeding max_parts or
104+
max_empties empty reads occur.
104105
105106
See https://github.com/krassowski/jupyterlab-lsp/issues/450
106107
@@ -119,13 +120,11 @@ def _read_content(
119120
raw_parts: List[bytes] = []
120121
received_size = 0
121122
while (
122-
received_size < length
123-
and len(raw_parts) < max_parts
124-
and max_empty_parts_in_a_row > 0
123+
received_size < length and len(raw_parts) < max_parts and max_empties > 0
125124
):
126125
part = self.stream.read(length)
127126
if part is None:
128-
max_empty_parts_in_a_row -= 1
127+
max_empties -= 1
129128
continue # pragma: no cover
130129
received_size += len(part)
131130
raw_parts.append(part)

0 commit comments

Comments
 (0)