mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
style: fix linter issues - black formatting
- Remove extra blank lines - Use explicit 'is not None' check for registry_pubsub - Format multi-line function calls per black style
This commit is contained in:
@@ -81,7 +81,7 @@ async def event_broadcaster(manager: ConnectionManager):
|
||||
|
||||
# Track registry pubsub for cleanup
|
||||
from redis.asyncio.client import PubSub
|
||||
|
||||
|
||||
registry_pubsub: PubSub | None = None
|
||||
|
||||
async def registry_refresh_worker():
|
||||
@@ -122,7 +122,7 @@ async def event_broadcaster(manager: ConnectionManager):
|
||||
# Ensure PubSub connections are closed on any exit to prevent leaks
|
||||
await execution_bus.close()
|
||||
await notification_bus.close()
|
||||
if registry_pubsub:
|
||||
if registry_pubsub is not None:
|
||||
await registry_pubsub.close()
|
||||
|
||||
|
||||
|
||||
@@ -1667,12 +1667,12 @@ async def migrate_llm_models(migrate_to: LlmModel):
|
||||
from backend.data import llm_registry
|
||||
|
||||
enum_values = list(llm_registry.get_all_model_slugs_for_validation())
|
||||
|
||||
|
||||
# Skip migration if registry is empty (fresh deployment before seeding)
|
||||
if not enum_values:
|
||||
logger.warning("LLM registry is empty, skipping model migration")
|
||||
return
|
||||
|
||||
|
||||
escaped_enum_values = repr(tuple(enum_values)) # hack but works
|
||||
|
||||
# Update each block
|
||||
|
||||
@@ -398,9 +398,7 @@ async def toggle_model(
|
||||
# This ensures no nodes are missed between query and update
|
||||
async with transaction() as tx:
|
||||
# Validate replacement model exists and is enabled (inside transaction to prevent TOCTOU)
|
||||
replacement = await tx.llmmodel.find_unique(
|
||||
where={"slug": migrate_to_slug}
|
||||
)
|
||||
replacement = await tx.llmmodel.find_unique(where={"slug": migrate_to_slug})
|
||||
if not replacement:
|
||||
raise ValueError(f"Replacement model '{migrate_to_slug}' not found")
|
||||
if not replacement.isEnabled:
|
||||
|
||||
Reference in New Issue
Block a user