From 12e63f493ffad1466660cd65728977ee5c4079ef Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 30 Oct 2023 10:53:40 -0700 Subject: [PATCH] ruff: Fix PLW2901 `for` loop variable overwritten by assignment target. Signed-off-by: Anders Kaseorg --- zulip/integrations/twitter/twitter-bot | 5 ++--- zulip/integrations/zephyr/zephyr_mirror_backend.py | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/zulip/integrations/twitter/twitter-bot b/zulip/integrations/twitter/twitter-bot index 94fbd0ea..ef42ac55 100755 --- a/zulip/integrations/twitter/twitter-bot +++ b/zulip/integrations/twitter/twitter-bot @@ -215,11 +215,10 @@ for status in statuses[::-1][: opts.limit_tweets]: if opts.search_terms: search_term_used = None - for term in opts.search_terms.split(","): + for raw_term in opts.search_terms.split(","): # Remove quotes from phrase: # "Zulip API" -> Zulip API - if term.startswith('"') and term.endswith('"'): - term = term[1:-1] + term = raw_term[1:-1] if term.startswith('"') and term.endswith('"') else raw_term if any(term.lower() in text for text in text_to_check): search_term_used = term break diff --git a/zulip/integrations/zephyr/zephyr_mirror_backend.py b/zulip/integrations/zephyr/zephyr_mirror_backend.py index 62f6bde8..a4ab9773 100755 --- a/zulip/integrations/zephyr/zephyr_mirror_backend.py +++ b/zulip/integrations/zephyr/zephyr_mirror_backend.py @@ -98,8 +98,8 @@ def unwrap_lines(body: str) -> str: lines = body.split("\n") result = "" previous_line = lines[0] - for line in lines[1:]: - line = line.rstrip() + for raw_line in lines[1:]: + line = raw_line.rstrip() if re.match(r"^\W", line, flags=re.UNICODE) and re.match( r"^\W", previous_line, flags=re.UNICODE ): @@ -1096,8 +1096,8 @@ def parse_zephyr_subs(verbose: bool = False) -> Set[Tuple[str, str, str]]: logger.error("Couldn't find ~/.zephyr.subs!") return zephyr_subscriptions - for line in open(subs_file).readlines(): - line = line.strip() + for raw_line in open(subs_file).readlines(): + line = raw_line.strip() if len(line) == 0: continue try: