From c6056b6f910d62bab3af01c56ecc61bf0cf7ff11 Mon Sep 17 00:00:00 2001 From: Nathaniel Girard Date: Sun, 17 Aug 2025 22:13:49 -0400 Subject: [PATCH 1/2] fixed bug --- tools/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/__main__.py b/tools/__main__.py index f10c7ad..c39734a 100644 --- a/tools/__main__.py +++ b/tools/__main__.py @@ -46,7 +46,7 @@ def read_arguments() -> argparse.Namespace: if args.command == TOOL_NAME_MIGRATE_STUDENT: asyncio.run(migrate_discord_students.main(arguments=sys.argv[2:])) elif args.command == TOOL_NAME_UPDATE_STUDENTS_LIST: - asyncio.run(update_students_list.main(arguments=sys.argv[2:])) + update_students_list.main(arguments=sys.argv[2:]) elif args.command == TOOL_NAME_RENEW_STUDENTS_LIST: asyncio.run(renew_students_list.main(arguments=sys.argv[2:])) elif args.command == TOOL_NAME_GIVE_INTEGRATION_ROLE: From 8e7915ca3896e414f5cbadc0540d229687878874 Mon Sep 17 00:00:00 2001 From: Babouche Date: Sun, 24 Aug 2025 15:25:33 -0400 Subject: [PATCH 2/2] Convert tool to asyncio --- tools/__main__.py | 2 +- tools/update_students_list.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/__main__.py b/tools/__main__.py index c39734a..f10c7ad 100644 --- a/tools/__main__.py +++ b/tools/__main__.py @@ -46,7 +46,7 @@ def read_arguments() -> argparse.Namespace: if args.command == TOOL_NAME_MIGRATE_STUDENT: asyncio.run(migrate_discord_students.main(arguments=sys.argv[2:])) elif args.command == TOOL_NAME_UPDATE_STUDENTS_LIST: - update_students_list.main(arguments=sys.argv[2:]) + asyncio.run(update_students_list.main(arguments=sys.argv[2:])) elif args.command == TOOL_NAME_RENEW_STUDENTS_LIST: asyncio.run(renew_students_list.main(arguments=sys.argv[2:])) elif args.command == TOOL_NAME_GIVE_INTEGRATION_ROLE: diff --git a/tools/update_students_list.py b/tools/update_students_list.py index 09041dc..ecb6a87 100644 --- a/tools/update_students_list.py +++ b/tools/update_students_list.py @@ -1,3 +1,4 @@ +import asyncio import os import argparse import pandas as pd @@ -134,7 +135,9 @@ def update_list(configuration: DotEnvConfiguration, csv_filename: str) -> int: return len(students_to_insert) -def main(arguments: List[str]): +async def main(arguments: List[str]): + global logger + arguments = read_arguments(arguments) configuration: DotEnvConfiguration = get_configuration(arguments) logger = setup_logger(configuration.logger_filename) @@ -146,4 +149,4 @@ def main(arguments: List[str]): if __name__ == "__main__": - main(arguments=sys.argv[1:]) + asyncio.run(main(arguments=sys.argv[1:]))