ruff: Fix B007 Loop control variable not used within loop body.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-10-30 11:21:08 -07:00
parent 69aaf69d6f
commit 03d132e99e
5 changed files with 8 additions and 8 deletions

View file

@ -47,7 +47,7 @@ def pack(options: argparse.Namespace) -> None:
zip_file_path = os.path.join(bots_dir, options.botname + ".zip")
zip_file = zipfile.ZipFile(zip_file_path, "w", zipfile.ZIP_DEFLATED)
# Pack the complete bot folder
for root, dirs, files in os.walk(options.path):
for root, _dirs, files in os.walk(options.path):
for file in files:
file_path = os.path.join(root, file)
zip_file.write(file_path, os.path.relpath(file_path, options.path))

View file

@ -126,14 +126,14 @@ except Exception:
# Subscribe to Zephyrs
zephyr_subs_to_add = []
for stream, test in test_streams:
for stream, _test in test_streams:
if stream == "message":
zephyr_subs_to_add.append((stream, "personal", mit_user))
else:
zephyr_subs_to_add.append((stream, "*", "*"))
actually_subscribed = False
for tries in range(10):
for _tries in range(10):
try:
zephyr_ctypes.check(zephyr_ctypes.ZInitialize())
zephyr_port = c_ushort()
@ -236,7 +236,7 @@ def receive_zephyrs() -> None:
logger.info("Starting sending messages!")
# Send zephyrs
zsig = "Timothy Good Abbott"
for key, (stream, test) in zhkeys.items():
for key, (stream, _test) in zhkeys.items():
if stream == "message":
zwrite_args = ["zwrite", "-n", "-s", zsig, mit_user]
else:
@ -261,7 +261,7 @@ receive_zephyrs()
logger.info("Sent Zephyr messages!")
# Send Zulips
for key, (stream, test) in hzkeys.items():
for key, (stream, _test) in hzkeys.items():
if stream == "message":
send_zulip(
{

View file

@ -960,7 +960,7 @@ def subscribed_to_mail_messages() -> bool:
stored_result = os.environ.get("HUMBUG_FORWARD_MAIL_ZEPHYRS")
if stored_result is not None:
return stored_result == "True"
for cls, instance, recipient in parse_zephyr_subs(verbose=False):
for cls, instance, _recipient in parse_zephyr_subs(verbose=False):
if cls.lower() == "mail" and instance.lower() == "inbox":
os.environ["HUMBUG_FORWARD_MAIL_ZEPHYRS"] = "True"
return True

View file

@ -568,7 +568,7 @@ def guide_with_numbers(board_str: str) -> str:
# newline. From then on, numbers are inserted at newlines.
row_list = list("8" + board_without_whitespace_str)
for i, char in enumerate(row_list):
for i, _char in enumerate(row_list):
# `(i + 1) % 10 == 0` if it is the end of a row, i.e., the 10th column
# since lists are 0-indexed.
if (i + 1) % 10 == 0:

View file

@ -766,7 +766,7 @@ To move subjects, send your message again, otherwise join the game using the lin
def generate_game_id(self) -> str:
id = ""
valid_characters = "abcdefghijklmnopqrstuvwxyz0123456789"
for i in range(6):
for _i in range(6):
id += valid_characters[random.randrange(0, len(valid_characters))]
return id