2323
2424import urllib .parse
2525import asyncio
26- from typing import Any , Callable , List , Literal , Optional , Union
26+ from typing import Any , Callable , List , Literal , Optional
2727from abc import ABC , abstractmethod
2828
2929from google .adk .auth .auth_credential import (
@@ -111,7 +111,7 @@ def __init__(
111111
112112 @abstractmethod
113113 async def _get_credential (
114- self , * , tool_context : Union [ ToolContext | ReadonlyContext ]
114+ self , * , tool_context : ToolContext | ReadonlyContext
115115 ) -> AuthCredential :
116116 """Get or create authentication credential.
117117
@@ -128,7 +128,7 @@ async def _execute_with_credential(
128128 self ,
129129 * ,
130130 args : dict [str , Any ],
131- tool_context : Union [ ToolContext | ReadonlyContext ] ,
131+ tool_context : ToolContext | ReadonlyContext ,
132132 credential : AuthCredential ,
133133 ) -> Any :
134134 """Execute the tool with the provided credential.
@@ -147,7 +147,7 @@ async def run_with_identity_auth(
147147 self ,
148148 * ,
149149 args : dict [str , Any ],
150- tool_context : Union [ ToolContext | ReadonlyContext ] ,
150+ tool_context : ToolContext | ReadonlyContext ,
151151 ) -> Any :
152152 """Execute the tool with Identity authentication.
153153
@@ -177,7 +177,7 @@ class ApiKeyAuthMixin(BaseAuthMixin):
177177 """
178178
179179 async def _get_credential (
180- self , * , tool_context : Union [ ToolContext | ReadonlyContext ]
180+ self , * , tool_context : ToolContext | ReadonlyContext
181181 ) -> AuthCredential :
182182 """Get or create API key credential.
183183
@@ -225,7 +225,7 @@ async def _execute_with_credential(
225225 self ,
226226 * ,
227227 args : dict [str , Any ],
228- tool_context : Union [ ToolContext | ReadonlyContext ] ,
228+ tool_context : ToolContext | ReadonlyContext ,
229229 credential : AuthCredential ,
230230 ) -> Any :
231231 """Default implementation - should be overridden by concrete tool classes.
@@ -259,7 +259,7 @@ class WorkloadAuthMixin(BaseAuthMixin):
259259 """
260260
261261 async def _get_credential (
262- self , * , tool_context : Union [ ToolContext | ReadonlyContext ]
262+ self , * , tool_context : ToolContext | ReadonlyContext
263263 ) -> AuthCredential :
264264 """Get or create Workload Access Token credential.
265265
@@ -301,7 +301,7 @@ async def _execute_with_credential(
301301 self ,
302302 * ,
303303 args : dict [str , Any ],
304- tool_context : Union [ ToolContext | ReadonlyContext ] ,
304+ tool_context : ToolContext | ReadonlyContext ,
305305 credential : AuthCredential ,
306306 ) -> Any :
307307 """Default implementation - should be overridden by concrete tool classes.
@@ -369,7 +369,7 @@ def __init__(
369369 self ._oauth2_auth_poller = oauth2_auth_poller
370370
371371 async def _get_oauth2_token_or_auth_url (
372- self , * , tool_context : Union [ ToolContext | ReadonlyContext ]
372+ self , * , tool_context : ToolContext | ReadonlyContext
373373 ) -> OAuth2TokenResponse :
374374 """Retrieve OAuth2 token or authorization URL from identity service.
375375
@@ -396,7 +396,7 @@ async def _get_oauth2_token_or_auth_url(
396396 )
397397
398398 async def _get_credential (
399- self , * , tool_context : Union [ ToolContext | ReadonlyContext ]
399+ self , * , tool_context : ToolContext | ReadonlyContext
400400 ) -> AuthCredential :
401401 """Get or create OAuth2 credential.
402402
@@ -527,7 +527,7 @@ async def _execute_with_credential(
527527 self ,
528528 * ,
529529 args : dict [str , Any ],
530- tool_context : Union [ ToolContext | ReadonlyContext ] ,
530+ tool_context : ToolContext | ReadonlyContext ,
531531 credential : AuthCredential ,
532532 ) -> Any :
533533 """Default implementation - should be overridden by concrete tool classes.
@@ -611,7 +611,7 @@ def _create_auth_delegate(self, **kwargs):
611611 raise ValueError (f"Unsupported auth config type: { type (self ._auth_config )} " )
612612
613613 async def _get_credential (
614- self , * , tool_context : Union [ ToolContext | ReadonlyContext ]
614+ self , * , tool_context : ToolContext | ReadonlyContext
615615 ) -> AuthCredential :
616616 """Get or create authentication credential using the configured auth type."""
617617 return await self ._auth_delegate ._get_credential (tool_context = tool_context )
@@ -620,7 +620,7 @@ async def _execute_with_credential(
620620 self ,
621621 * ,
622622 args : dict [str , Any ],
623- tool_context : Union [ ToolContext | ReadonlyContext ] ,
623+ tool_context : ToolContext | ReadonlyContext ,
624624 credential : AuthCredential ,
625625 ) -> Any :
626626 """Default implementation - should be overridden by concrete tool classes.
0 commit comments