Skip to content

Commit 35c48ec

Browse files
committed
chore(identity):fix type hints for tool_context in auth mixins
1 parent 62adc03 commit 35c48ec

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

veadk/integrations/ve_identity/auth_mixins.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
import urllib.parse
2525
import asyncio
26-
from typing import Any, Callable, List, Literal, Optional, Union
26+
from typing import Any, Callable, List, Literal, Optional
2727
from abc import ABC, abstractmethod
2828

2929
from 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.

veadk/integrations/ve_identity/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def validate_discovery_url(cls, v: Optional[str]) -> Optional[str]:
198198

199199

200200
class WorkloadToken(BaseModel):
201-
"""workload access token and expiration time.
201+
"""Workload access token and expiration time.
202202
203203
Attributes:
204204
workload_access_token: The workload access token.

0 commit comments

Comments
 (0)