Skip to content

Commit f675964

Browse files
committed
prefer if/else over if/if not
1 parent fab7f19 commit f675964

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

jupyter_collaboration/rooms.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,16 @@ async def initialize(self) -> None:
120120
# YDoc not found in the YStore, create the document from the source file (no change history)
121121
pass
122122

123-
if not read_from_source:
123+
if read_from_source:
124+
self._emit(LogLevel.INFO, "load", "Content loaded from disk.")
125+
self.log.info(
126+
"Content in room %s loaded from file %s", self._room_id, self._file.path
127+
)
128+
self._document.source = model["content"]
129+
130+
if self.ystore:
131+
await self.ystore.encode_state_as_update(self.ydoc)
132+
else:
124133
# if YStore updates and source file are out-of-sync, resync updates with source
125134
if self._document.source != model["content"]:
126135
# TODO: Delete document from the store.
@@ -134,15 +143,6 @@ async def initialize(self) -> None:
134143
)
135144
read_from_source = True
136145

137-
if read_from_source:
138-
self._emit(LogLevel.INFO, "load", "Content loaded from disk.")
139-
self.log.info(
140-
"Content in room %s loaded from file %s", self._room_id, self._file.path
141-
)
142-
self._document.source = model["content"]
143-
144-
if self.ystore:
145-
await self.ystore.encode_state_as_update(self.ydoc)
146146

147147
self._document.dirty = False
148148
self.ready = True

0 commit comments

Comments
 (0)