fix mypy issue for org tokens (#3541)

This commit is contained in:
Shuchang Zheng
2025-09-26 16:35:47 -07:00
committed by GitHub
parent 7cd1b37d9c
commit 8c54475fda
9 changed files with 15 additions and 13 deletions

View File

@@ -874,22 +874,23 @@ class AgentDB:
async def get_valid_org_auth_token(
self,
organization_id: str,
token_type: Literal[OrganizationAuthTokenType.api, OrganizationAuthTokenType.onepassword_service_account],
token_type: Literal["api", "onepassword_service_account"],
) -> OrganizationAuthToken | None: ...
@overload
async def get_valid_org_auth_token(
self,
organization_id: str,
token_type: Literal[OrganizationAuthTokenType.azure_client_secret_credential],
token_type: Literal["azure_client_secret_credential"],
) -> AzureOrganizationAuthToken | None: ...
async def get_valid_org_auth_token(
self,
organization_id: str,
token_type: OrganizationAuthTokenType,
token_type: Literal["api", "onepassword_service_account", "azure_client_secret_credential"],
) -> OrganizationAuthToken | AzureOrganizationAuthToken | None:
try:
print("lol")
async with self.Session() as session:
if token := (
await session.scalars(

View File

@@ -200,7 +200,7 @@ def convert_to_organization(org_model: OrganizationModel) -> Organization:
async def convert_to_organization_auth_token(
org_auth_token: OrganizationAuthTokenModel, token_type: OrganizationAuthTokenType
org_auth_token: OrganizationAuthTokenModel, token_type: str
) -> OrganizationAuthToken | AzureOrganizationAuthToken:
token = org_auth_token.token
if org_auth_token.encrypted_token and org_auth_token.encrypted_method: