From d011e96d2381a0296b1ee0a09579ee03d81c19aa Mon Sep 17 00:00:00 2001 From: Samuel Gratzl Date: Sun, 5 May 2024 21:34:41 -0400 Subject: [PATCH] fix: use yield from --- slack_cleaner2/model.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/slack_cleaner2/model.py b/slack_cleaner2/model.py index 77fe356..20552df 100644 --- a/slack_cleaner2/model.py +++ b/slack_cleaner2/model.py @@ -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) @@ -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"] @@ -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)