mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
chore: remove bare excepts
Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 867666149
This commit is contained in:
committed by
Copybara-Service
parent
fd8a9e3962
commit
0758f877b1
@@ -570,19 +570,16 @@ async def _execute_single_function_call_async(
|
||||
return function_response_event
|
||||
|
||||
with tracer.start_as_current_span(f'execute_tool {tool.name}'):
|
||||
function_response_event = None
|
||||
try:
|
||||
function_response_event = await _run_with_trace()
|
||||
return function_response_event
|
||||
finally:
|
||||
trace_tool_call(
|
||||
tool=tool,
|
||||
args=function_args,
|
||||
function_response_event=function_response_event,
|
||||
)
|
||||
return function_response_event
|
||||
except:
|
||||
trace_tool_call(
|
||||
tool=tool, args=function_args, function_response_event=None
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
async def handle_function_calls_live(
|
||||
@@ -720,19 +717,16 @@ async def _execute_single_function_call_live(
|
||||
return function_response_event
|
||||
|
||||
with tracer.start_as_current_span(f'execute_tool {tool.name}'):
|
||||
function_response_event = None
|
||||
try:
|
||||
function_response_event = await _run_with_trace()
|
||||
return function_response_event
|
||||
finally:
|
||||
trace_tool_call(
|
||||
tool=tool,
|
||||
args=function_args,
|
||||
function_response_event=function_response_event,
|
||||
)
|
||||
return function_response_event
|
||||
except:
|
||||
trace_tool_call(
|
||||
tool=tool, args=function_args, function_response_event=None
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
async def _process_function_live_helper(
|
||||
|
||||
@@ -27,6 +27,7 @@ from urllib.parse import parse_qs
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from google.auth import default as default_service_credential
|
||||
from google.auth.exceptions import DefaultCredentialsError
|
||||
from google.auth.transport.requests import Request
|
||||
from google.oauth2 import service_account
|
||||
import requests
|
||||
@@ -329,7 +330,7 @@ class APIHubClient(BaseAPIHubClient):
|
||||
credentials, _ = default_service_credential(
|
||||
scopes=["https://www.googleapis.com/auth/cloud-platform"]
|
||||
)
|
||||
except:
|
||||
except DefaultCredentialsError:
|
||||
credentials = None
|
||||
|
||||
if not credentials:
|
||||
|
||||
@@ -815,7 +815,7 @@ class ConnectionsClient:
|
||||
credentials, _ = default_service_credential(
|
||||
scopes=["https://www.googleapis.com/auth/cloud-platform"]
|
||||
)
|
||||
except:
|
||||
except google.auth.exceptions.DefaultCredentialsError:
|
||||
credentials = None
|
||||
|
||||
if not credentials:
|
||||
|
||||
@@ -253,7 +253,7 @@ class IntegrationClient:
|
||||
credentials, project_id = default_service_credential(
|
||||
scopes=["https://www.googleapis.com/auth/cloud-platform"]
|
||||
)
|
||||
except:
|
||||
except google.auth.exceptions.DefaultCredentialsError:
|
||||
credentials = None
|
||||
if credentials:
|
||||
quota_project_id = getattr(credentials, "quota_project_id", None)
|
||||
|
||||
@@ -176,7 +176,7 @@ def _execute_sql(
|
||||
try:
|
||||
# if the json serialization of the value succeeds, use it as is
|
||||
json.dumps(val)
|
||||
except:
|
||||
except (TypeError, ValueError, OverflowError):
|
||||
val = str(val)
|
||||
row_values[key] = val
|
||||
rows.append(row_values)
|
||||
|
||||
@@ -101,7 +101,7 @@ def execute_sql(
|
||||
try:
|
||||
# if the json serialization of the value succeeds, use it as is
|
||||
json.dumps(val)
|
||||
except:
|
||||
except (TypeError, ValueError, OverflowError):
|
||||
val = str(val)
|
||||
row_values[key] = val
|
||||
rows.append(row_values)
|
||||
|
||||
@@ -277,7 +277,7 @@ def get_table_schema(
|
||||
|
||||
try:
|
||||
json.dumps(results)
|
||||
except:
|
||||
except (TypeError, ValueError, OverflowError):
|
||||
results = str(results)
|
||||
|
||||
return {"status": "SUCCESS", "results": results}
|
||||
@@ -375,7 +375,7 @@ def list_table_indexes(
|
||||
|
||||
try:
|
||||
json.dumps(index_info)
|
||||
except:
|
||||
except (TypeError, ValueError, OverflowError):
|
||||
index_info = str(index_info)
|
||||
|
||||
indexes.append(index_info)
|
||||
@@ -479,7 +479,7 @@ def list_table_index_columns(
|
||||
|
||||
try:
|
||||
json.dumps(index_column_info)
|
||||
except:
|
||||
except (TypeError, ValueError, OverflowError):
|
||||
index_column_info = str(index_column_info)
|
||||
|
||||
index_columns.append(index_column_info)
|
||||
|
||||
@@ -515,7 +515,7 @@ def similarity_search(
|
||||
try:
|
||||
# if the json serialization of the row succeeds, use it as is
|
||||
json.dumps(row)
|
||||
except:
|
||||
except (TypeError, ValueError, OverflowError):
|
||||
row = str(row)
|
||||
|
||||
rows.append(row)
|
||||
|
||||
@@ -107,7 +107,7 @@ def execute_sql(
|
||||
try:
|
||||
# if the json serialization of the row succeeds, use it as is
|
||||
json.dumps(row)
|
||||
except:
|
||||
except (TypeError, ValueError, OverflowError):
|
||||
row = str(row)
|
||||
|
||||
rows.append(row)
|
||||
|
||||
Reference in New Issue
Block a user