From 883067e2a48b012b68fe14166b7dd5b5fdd4a59a Mon Sep 17 00:00:00 2001 From: Otto Date: Tue, 3 Feb 2026 18:46:03 +0000 Subject: [PATCH] style: move _credential_has_required_scopes after match_user_credentials_to_graph Both find_matching_credential and match_user_credentials_to_graph use this helper, so it belongs after both of them. --- .../backend/api/features/chat/tools/utils.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/autogpt_platform/backend/backend/api/features/chat/tools/utils.py b/autogpt_platform/backend/backend/api/features/chat/tools/utils.py index 71d6ea0619..5b9a239685 100644 --- a/autogpt_platform/backend/backend/api/features/chat/tools/utils.py +++ b/autogpt_platform/backend/backend/api/features/chat/tools/utils.py @@ -314,18 +314,6 @@ def create_credential_meta_from_match( ) -def _credential_has_required_scopes( - credential: Credentials, - requirements: CredentialsFieldInfo, -) -> bool: - """Check if a credential has all the scopes required by the block.""" - if credential.type != "oauth2": - return True - if not requirements.required_scopes: - return True - return set(credential.scopes).issuperset(requirements.required_scopes) - - async def match_user_credentials_to_graph( user_id: str, graph: GraphModel, @@ -418,6 +406,18 @@ async def match_user_credentials_to_graph( return graph_credentials_inputs, missing_creds +def _credential_has_required_scopes( + credential: Credentials, + requirements: CredentialsFieldInfo, +) -> bool: + """Check if a credential has all the scopes required by the block.""" + if credential.type != "oauth2": + return True + if not requirements.required_scopes: + return True + return set(credential.scopes).issuperset(requirements.required_scopes) + + async def check_user_has_required_credentials( user_id: str, required_credentials: list[CredentialsMetaInput],