Skip to content

Commit 12e63f4

Browse files
committed
ruff: Fix PLW2901 for loop variable overwritten by assignment target.
Signed-off-by: Anders Kaseorg <[email protected]>
1 parent 18805ac commit 12e63f4

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

zulip/integrations/twitter/twitter-bot

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,10 @@ for status in statuses[::-1][: opts.limit_tweets]:
215215

216216
if opts.search_terms:
217217
search_term_used = None
218-
for term in opts.search_terms.split(","):
218+
for raw_term in opts.search_terms.split(","):
219219
# Remove quotes from phrase:
220220
# "Zulip API" -> Zulip API
221-
if term.startswith('"') and term.endswith('"'):
222-
term = term[1:-1]
221+
term = raw_term[1:-1] if term.startswith('"') and term.endswith('"') else raw_term
223222
if any(term.lower() in text for text in text_to_check):
224223
search_term_used = term
225224
break

zulip/integrations/zephyr/zephyr_mirror_backend.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ def unwrap_lines(body: str) -> str:
9898
lines = body.split("\n")
9999
result = ""
100100
previous_line = lines[0]
101-
for line in lines[1:]:
102-
line = line.rstrip()
101+
for raw_line in lines[1:]:
102+
line = raw_line.rstrip()
103103
if re.match(r"^\W", line, flags=re.UNICODE) and re.match(
104104
r"^\W", previous_line, flags=re.UNICODE
105105
):
@@ -1096,8 +1096,8 @@ def parse_zephyr_subs(verbose: bool = False) -> Set[Tuple[str, str, str]]:
10961096
logger.error("Couldn't find ~/.zephyr.subs!")
10971097
return zephyr_subscriptions
10981098

1099-
for line in open(subs_file).readlines():
1100-
line = line.strip()
1099+
for raw_line in open(subs_file).readlines():
1100+
line = raw_line.strip()
11011101
if len(line) == 0:
11021102
continue
11031103
try:

0 commit comments

Comments
 (0)