ruff: Fix B007 Loop control variable not used within loop body.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
69aaf69d6f
commit
03d132e99e
5 changed files with 8 additions and 8 deletions
|
@ -47,7 +47,7 @@ def pack(options: argparse.Namespace) -> None:
|
||||||
zip_file_path = os.path.join(bots_dir, options.botname + ".zip")
|
zip_file_path = os.path.join(bots_dir, options.botname + ".zip")
|
||||||
zip_file = zipfile.ZipFile(zip_file_path, "w", zipfile.ZIP_DEFLATED)
|
zip_file = zipfile.ZipFile(zip_file_path, "w", zipfile.ZIP_DEFLATED)
|
||||||
# Pack the complete bot folder
|
# 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:
|
for file in files:
|
||||||
file_path = os.path.join(root, file)
|
file_path = os.path.join(root, file)
|
||||||
zip_file.write(file_path, os.path.relpath(file_path, options.path))
|
zip_file.write(file_path, os.path.relpath(file_path, options.path))
|
||||||
|
|
|
@ -126,14 +126,14 @@ except Exception:
|
||||||
|
|
||||||
# Subscribe to Zephyrs
|
# Subscribe to Zephyrs
|
||||||
zephyr_subs_to_add = []
|
zephyr_subs_to_add = []
|
||||||
for stream, test in test_streams:
|
for stream, _test in test_streams:
|
||||||
if stream == "message":
|
if stream == "message":
|
||||||
zephyr_subs_to_add.append((stream, "personal", mit_user))
|
zephyr_subs_to_add.append((stream, "personal", mit_user))
|
||||||
else:
|
else:
|
||||||
zephyr_subs_to_add.append((stream, "*", "*"))
|
zephyr_subs_to_add.append((stream, "*", "*"))
|
||||||
|
|
||||||
actually_subscribed = False
|
actually_subscribed = False
|
||||||
for tries in range(10):
|
for _tries in range(10):
|
||||||
try:
|
try:
|
||||||
zephyr_ctypes.check(zephyr_ctypes.ZInitialize())
|
zephyr_ctypes.check(zephyr_ctypes.ZInitialize())
|
||||||
zephyr_port = c_ushort()
|
zephyr_port = c_ushort()
|
||||||
|
@ -236,7 +236,7 @@ def receive_zephyrs() -> None:
|
||||||
logger.info("Starting sending messages!")
|
logger.info("Starting sending messages!")
|
||||||
# Send zephyrs
|
# Send zephyrs
|
||||||
zsig = "Timothy Good Abbott"
|
zsig = "Timothy Good Abbott"
|
||||||
for key, (stream, test) in zhkeys.items():
|
for key, (stream, _test) in zhkeys.items():
|
||||||
if stream == "message":
|
if stream == "message":
|
||||||
zwrite_args = ["zwrite", "-n", "-s", zsig, mit_user]
|
zwrite_args = ["zwrite", "-n", "-s", zsig, mit_user]
|
||||||
else:
|
else:
|
||||||
|
@ -261,7 +261,7 @@ receive_zephyrs()
|
||||||
logger.info("Sent Zephyr messages!")
|
logger.info("Sent Zephyr messages!")
|
||||||
|
|
||||||
# Send Zulips
|
# Send Zulips
|
||||||
for key, (stream, test) in hzkeys.items():
|
for key, (stream, _test) in hzkeys.items():
|
||||||
if stream == "message":
|
if stream == "message":
|
||||||
send_zulip(
|
send_zulip(
|
||||||
{
|
{
|
||||||
|
|
|
@ -960,7 +960,7 @@ def subscribed_to_mail_messages() -> bool:
|
||||||
stored_result = os.environ.get("HUMBUG_FORWARD_MAIL_ZEPHYRS")
|
stored_result = os.environ.get("HUMBUG_FORWARD_MAIL_ZEPHYRS")
|
||||||
if stored_result is not None:
|
if stored_result is not None:
|
||||||
return stored_result == "True"
|
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":
|
if cls.lower() == "mail" and instance.lower() == "inbox":
|
||||||
os.environ["HUMBUG_FORWARD_MAIL_ZEPHYRS"] = "True"
|
os.environ["HUMBUG_FORWARD_MAIL_ZEPHYRS"] = "True"
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -568,7 +568,7 @@ def guide_with_numbers(board_str: str) -> str:
|
||||||
# newline. From then on, numbers are inserted at newlines.
|
# newline. From then on, numbers are inserted at newlines.
|
||||||
row_list = list("8" + board_without_whitespace_str)
|
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
|
# `(i + 1) % 10 == 0` if it is the end of a row, i.e., the 10th column
|
||||||
# since lists are 0-indexed.
|
# since lists are 0-indexed.
|
||||||
if (i + 1) % 10 == 0:
|
if (i + 1) % 10 == 0:
|
||||||
|
|
|
@ -766,7 +766,7 @@ To move subjects, send your message again, otherwise join the game using the lin
|
||||||
def generate_game_id(self) -> str:
|
def generate_game_id(self) -> str:
|
||||||
id = ""
|
id = ""
|
||||||
valid_characters = "abcdefghijklmnopqrstuvwxyz0123456789"
|
valid_characters = "abcdefghijklmnopqrstuvwxyz0123456789"
|
||||||
for i in range(6):
|
for _i in range(6):
|
||||||
id += valid_characters[random.randrange(0, len(valid_characters))]
|
id += valid_characters[random.randrange(0, len(valid_characters))]
|
||||||
return id
|
return id
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue