Skip to content

Commit 8d52c58

Browse files
committed
pre-commit errors
1 parent 59a011a commit 8d52c58

File tree

2 files changed

+11
-33
lines changed

2 files changed

+11
-33
lines changed

projects/jupyter-server-ydoc/jupyter_server_ydoc/handlers.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,7 @@ async def open(self, room_id):
224224
self.log.error(f"File {file.path} not found.\n{e!r}", exc_info=e)
225225
self.close(1004, f"File {file.path} not found.")
226226
else:
227-
self.log.error(
228-
f"Error initializing: {file.path}\n{e!r}", exc_info=e
229-
)
227+
self.log.error(f"Error initializing: {file.path}\n{e!r}", exc_info=e)
230228
self.close(
231229
1003,
232230
f"Error initializing: {file.path}. You need to close the document.",
@@ -306,14 +304,10 @@ async def on_message(self, message):
306304
for client in self.room.clients:
307305
if client != self:
308306
task = asyncio.create_task(
309-
client.send(
310-
bytes([MessageType.CHAT]) + write_var_uint(len(data)) + data
311-
)
307+
client.send(bytes([MessageType.CHAT]) + write_var_uint(len(data)) + data)
312308
)
313309
self._websocket_server.background_tasks.add(task)
314-
task.add_done_callback(
315-
self._websocket_server.background_tasks.discard
316-
)
310+
task.add_done_callback(self._websocket_server.background_tasks.discard)
317311

318312
self._message_queue.put_nowait(message)
319313
self._websocket_server.ypatch_nb += 1
@@ -332,9 +326,7 @@ def on_close(self) -> None:
332326
if self._room_id != "JupyterLab:globalAwareness":
333327
self._emit_awareness_event(self.current_user.username, "leave")
334328

335-
def _emit(
336-
self, level: LogLevel, action: str | None = None, msg: str | None = None
337-
) -> None:
329+
def _emit(self, level: LogLevel, action: str | None = None, msg: str | None = None) -> None:
338330
_, _, file_id = decode_file_path(self._room_id)
339331
path = self._file_id_manager.get_path(file_id)
340332

@@ -346,16 +338,12 @@ def _emit(
346338

347339
self.event_logger.emit(schema_id=JUPYTER_COLLABORATION_EVENTS_URI, data=data)
348340

349-
def _emit_awareness_event(
350-
self, username: str, action: str, msg: str | None = None
351-
) -> None:
341+
def _emit_awareness_event(self, username: str, action: str, msg: str | None = None) -> None:
352342
data = {"roomid": self._room_id, "username": username, "action": action}
353343
if msg:
354344
data["msg"] = msg
355345

356-
self.event_logger.emit(
357-
schema_id=JUPYTER_COLLABORATION_AWARENESS_EVENTS_URI, data=data
358-
)
346+
self.event_logger.emit(schema_id=JUPYTER_COLLABORATION_AWARENESS_EVENTS_URI, data=data)
359347

360348
async def _clean_room(self) -> None:
361349
"""

projects/jupyter-server-ydoc/jupyter_server_ydoc/rooms.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,7 @@ async def initialize(self) -> None:
150150
self.ready = True
151151
self._emit(LogLevel.INFO, "initialize", "Room initialized")
152152

153-
def _emit(
154-
self, level: LogLevel, action: str | None = None, msg: str | None = None
155-
) -> None:
153+
def _emit(self, level: LogLevel, action: str | None = None, msg: str | None = None) -> None:
156154
data = {"level": level.value, "room": self._room_id, "path": self._file.path}
157155
if action:
158156
data["action"] = action
@@ -186,12 +184,8 @@ async def _on_outofband_change(self) -> None:
186184
"""
187185
Called when the file got out-of-band changes.
188186
"""
189-
self.log.info(
190-
"Out-of-band changes. Overwriting the content in room %s", self._room_id
191-
)
192-
self._emit(
193-
LogLevel.INFO, "overwrite", "Out-of-band changes. Overwriting the room."
194-
)
187+
self.log.info("Out-of-band changes. Overwriting the content in room %s", self._room_id)
188+
self._emit(LogLevel.INFO, "overwrite", "Out-of-band changes. Overwriting the room.")
195189

196190
try:
197191
model = await self._file.load_content(self._file_format, self._file_type)
@@ -267,13 +261,9 @@ async def _maybe_save_document(self, saving_document: asyncio.Task | None) -> No
267261
return
268262

269263
except OutOfBandChanges:
270-
self.log.info(
271-
"Out-of-band changes. Overwriting the content in room %s", self._room_id
272-
)
264+
self.log.info("Out-of-band changes. Overwriting the content in room %s", self._room_id)
273265
try:
274-
model = await self._file.load_content(
275-
self._file_format, self._file_type
276-
)
266+
model = await self._file.load_content(self._file_format, self._file_type)
277267
except Exception as e:
278268
msg = f"Error loading content from file: {self._file.path}\n{e!r}"
279269
self.log.error(msg, exc_info=e)

0 commit comments

Comments
 (0)