Skip to content

Commit

Permalink
fix: use yield from
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed May 6, 2024
1 parent dc31b9f commit d011e96
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions slack_cleaner2/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1324,8 +1324,7 @@ def list_paging_page():

while True:
page, meta = self.safe_api(list_paging_page, [attr, "paging"], [[], {}], scopes, method)
for elem in page:
yield elem
yield from page
if not meta:
return
total = meta.get("total", 1)
Expand Down Expand Up @@ -1358,8 +1357,7 @@ def list_cursor_page():

while True:
page, meta = self.safe_api(list_cursor_page, [attr, "response_metadata"], [[], {}], scopes, method)
for elem in page:
yield elem
yield from page
if not meta or not meta.get("next_cursor"):
break
next_cursor = meta["next_cursor"]
Expand Down Expand Up @@ -1428,5 +1426,4 @@ def msgs(self, channels: Optional[Iterable[SlackChannel]] = None, after: TimeIsh
if not channels:
channels = self.conversations
for channel in channels:
for msg in channel.msgs(after=after, before=before, with_replies=with_replies):
yield msg
yield from channel.msgs(after=after, before=before, with_replies=with_replies)

0 comments on commit d011e96

Please sign in to comment.