ruff: Fix PLW2901 for loop variable overwritten by assignment target.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-10-30 10:53:40 -07:00
parent 18805ac181
commit 12e63f493f
2 changed files with 6 additions and 7 deletions

View file

@ -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

View file

@ -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: