From 0c254d2e512d41a684fb95723ee1bede6c5dc9f2 Mon Sep 17 00:00:00 2001 From: Dennis Zelada Date: Mon, 11 Dec 2023 22:04:12 +0100 Subject: [PATCH] Use Generator Expressions Instead of List Comprehensions --- agenta-backend/agenta_backend/services/app_manager.py | 2 +- agenta-backend/agenta_backend/services/db_manager.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/agenta-backend/agenta_backend/services/app_manager.py b/agenta-backend/agenta_backend/services/app_manager.py index 2a27a2abb1..b15c335c4f 100644 --- a/agenta-backend/agenta_backend/services/app_manager.py +++ b/agenta-backend/agenta_backend/services/app_manager.py @@ -392,7 +392,7 @@ async def add_variant_based_on_image( variants = await db_manager.list_app_variants_for_app_id( app_id=str(app.id), **user_org_data ) - already_exists = any([av for av in variants if av.variant_name == variant_name]) + already_exists = any(av for av in variants if av.variant_name == variant_name) if already_exists: logger.error("App variant with the same name already exists") raise ValueError("App variant with the same name already exists") diff --git a/agenta-backend/agenta_backend/services/db_manager.py b/agenta-backend/agenta_backend/services/db_manager.py index 538132e87a..261673b9ba 100644 --- a/agenta-backend/agenta_backend/services/db_manager.py +++ b/agenta-backend/agenta_backend/services/db_manager.py @@ -753,7 +753,7 @@ async def add_variant_from_base_and_config( app_variant_for_base = await list_variants_for_base(base_db) already_exists = any( - [av for av in app_variant_for_base if av.config_name == new_config_name] + av for av in app_variant_for_base if av.config_name == new_config_name ) if already_exists: raise ValueError("App variant with the same name already exists")