Skip to content

Commit

Permalink
Use Generator Expressions Instead of List Comprehensions
Browse files Browse the repository at this point in the history
  • Loading branch information
denniszelada committed Dec 11, 2023
1 parent f7f19df commit 0c254d2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion agenta-backend/agenta_backend/services/app_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion agenta-backend/agenta_backend/services/db_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 0c254d2

Please sign in to comment.