1
0
Fork 0

Small cleanup of mypy warnings

This commit is contained in:
Félix Piédallu 2024-02-08 23:09:11 +01:00
parent f6b99fd888
commit 5c660e5652

View file

@ -187,9 +187,11 @@ def main():
with tempfile.TemporaryDirectory(prefix="update_app_levels_") as tmpdir: with tempfile.TemporaryDirectory(prefix="update_app_levels_") as tmpdir:
logging.info("Cloning the repository...") logging.info("Cloning the repository...")
apps_repo = Repo.clone_from(f"git@github.com:{APPS_REPO}", to_path=tmpdir) apps_repo = Repo.clone_from(f"git@github.com:{APPS_REPO}", to_path=tmpdir)
assert apps_repo.working_tree_dir is not None
apps_toml_path = Path(apps_repo.working_tree_dir) / "apps.toml"
# Load the app catalog and filter out the non-working ones # Load the app catalog and filter out the non-working ones
catalog = toml.load((Path(apps_repo.working_tree_dir) / "apps.toml").open("r", encoding="utf-8")) catalog = toml.load(apps_toml_path.open("r", encoding="utf-8"))
new_branch = apps_repo.create_head("update_app_levels", apps_repo.refs.master) new_branch = apps_repo.create_head("update_app_levels", apps_repo.refs.master)
apps_repo.head.reference = new_branch apps_repo.head.reference = new_branch
@ -205,7 +207,7 @@ def main():
# Save the new catalog # Save the new catalog
updated_catalog = toml.dumps(catalog) updated_catalog = toml.dumps(catalog)
updated_catalog = updated_catalog.replace(",]", " ]") updated_catalog = updated_catalog.replace(",]", " ]")
(Path(apps_repo.working_tree_dir) / "apps.toml").open("w", encoding="utf-8").write(updated_catalog) apps_toml_path.open("w", encoding="utf-8").write(updated_catalog)
if args.commit: if args.commit:
logging.info("Committing and pushing the new catalog...") logging.info("Committing and pushing the new catalog...")