Skip to content

Commit c73d9f6

Browse files
committedMar 21, 2023
style fix
·
3.21.63.0.1b11
1 parent a2cda76 commit c73d9f6

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed
 

‎ydb/_topic_reader/datatypes.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def _commit_get_offsets_range(self) -> OffsetsRange:
179179
self.messages[-1]._commit_get_offsets_range().end,
180180
)
181181

182-
def is_empty(self) -> bool:
182+
def empty(self) -> bool:
183183
return len(self.messages) == 0
184184

185185
# ISessionAlive implementation
@@ -192,9 +192,4 @@ def is_alive(self) -> bool:
192192
)
193193

194194
def pop_message(self) -> PublicMessage:
195-
if len(self.messages) == 0:
196-
raise IndexError()
197-
198-
res = self.messages[0]
199-
self.messages = self.messages[1:]
200-
return res
195+
return self.messages.pop()

‎ydb/_topic_reader/topic_reader_asyncio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ async def receive_batch(
125125
await self._reconnector.wait_message()
126126
return self._reconnector.receive_batch_nowait()
127127

128-
async def receive_message(self) -> typing.Union[datatypes.PublicMessage, None]:
128+
async def receive_message(self) -> typing.Optional[datatypes.PublicMessage]:
129129
"""
130130
Block until receive new message
131131
@@ -414,7 +414,7 @@ def receive_message_nowait(self):
414414
except IndexError:
415415
return None
416416

417-
if batch.is_empty():
417+
if batch.empty():
418418
self._message_batches.popleft()
419419

420420
return message

0 commit comments

Comments
 (0)
Please sign in to comment.