Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Typecasts to fix linting errors

Prateekcfadb82689b2
diff --git a/python/composio/core/models/connected_accounts.py b/python/composio/core/models/connected_accounts.py
index 427ae958a..c8960d9ce 100644
--- a/python/composio/core/models/connected_accounts.py
+++ b/python/composio/core/models/connected_accounts.py
@@ -128,16 +128,19 @@ class AuthScheme:
"""
Create a new connected account using Composio Link.
"""
- return {
- "auth_scheme": "COMPOSIO_LINK",
- "val": t.cast(
- connected_account_create_params.ConnectionStateUnionMember2Val,
- {
- **options,
- "status": "INITIALIZING",
- },
- ),
- }
+ return t.cast(
+ connected_account_create_params.ConnectionState,
+ {
+ "auth_scheme": "COMPOSIO_LINK",
+ "val": t.cast(
+ connected_account_create_params.ConnectionStateUnionMember2Val,
+ {
+ **options,
+ "status": "INITIALIZING",
+ },
+ ),
+ },
+ )
def api_key(
self, options: connected_account_create_params.ConnectionStateUnionMember3Val
@@ -145,16 +148,19 @@ class AuthScheme:
"""
Create a new connected account using an API key.
"""
- return {
- "auth_scheme": "API_KEY",
- "val": t.cast(
- connected_account_create_params.ConnectionStateUnionMember3Val,
- {
- **options,
- "status": "ACTIVE",
- },
- ),
- }
+ return t.cast(
+ connected_account_create_params.ConnectionState,
+ {
+ "auth_scheme": "API_KEY",
+ "val": t.cast(
+ connected_account_create_params.ConnectionStateUnionMember3Val,
+ {
+ **options,
+ "status": "ACTIVE",
+ },
+ ),
+ },
+ )
def basic(
self, options: connected_account_create_params.ConnectionStateUnionMember4Val
@@ -162,16 +168,19 @@ class AuthScheme:
"""
Create a new connected account using basic auth.
"""
- return {
- "auth_scheme": "BASIC",
- "val": t.cast(
- connected_account_create_params.ConnectionStateUnionMember4Val,
- {
- **options,
- "status": "ACTIVE",
- },
- ),
- }
+ return t.cast(
+ connected_account_create_params.ConnectionState,
+ {
+ "auth_scheme": "BASIC",
+ "val": t.cast(
+ connected_account_create_params.ConnectionStateUnionMember4Val,
+ {
+ **options,
+ "status": "ACTIVE",
+ },
+ ),
+ },
+ )
def bearer_token(
self, options: connected_account_create_params.ConnectionStateUnionMember5Val
@@ -179,16 +188,19 @@ class AuthScheme:
"""
Create a new connected account using a bearer token.
"""
- return {
- "auth_scheme": "BEARER_TOKEN",
- "val": t.cast(
- connected_account_create_params.ConnectionStateUnionMember5Val,
- {
- **options,
- "status": "ACTIVE",
- },
- ),
- }
+ return t.cast(
+ connected_account_create_params.ConnectionState,
+ {
+ "auth_scheme": "BEARER_TOKEN",
+ "val": t.cast(
+ connected_account_create_params.ConnectionStateUnionMember5Val,
+ {
+ **options,
+ "status": "ACTIVE",
+ },
+ ),
+ },
+ )
def google_service_account(
self, options: connected_account_create_params.ConnectionStateUnionMember6Val
@@ -196,16 +208,19 @@ class AuthScheme:
"""
Create a new connected account using a Google service account.
"""
- return {
- "auth_scheme": "GOOGLE_SERVICE_ACCOUNT",
- "val": t.cast(
- connected_account_create_params.ConnectionStateUnionMember6Val,
- {
- **options,
- "status": "ACTIVE",
- },
- ),
- }
+ return t.cast(
+ connected_account_create_params.ConnectionState,
+ {
+ "auth_scheme": "GOOGLE_SERVICE_ACCOUNT",
+ "val": t.cast(
+ connected_account_create_params.ConnectionStateUnionMember6Val,
+ {
+ **options,
+ "status": "ACTIVE",
+ },
+ ),
+ },
+ )
def no_auth(
self, options: connected_account_create_params.ConnectionStateUnionMember7Val
@@ -247,16 +262,19 @@ class AuthScheme:
"""
Create a new connected account using Bill.com auth.
"""
- return {
- "auth_scheme": "BILLCOM_AUTH",
- "val": t.cast(
- connected_account_create_params.ConnectionStateUnionMember9Val,
- {
- **options,
- "status": "ACTIVE",
- },
- ),
- }
+ return t.cast(
+ connected_account_create_params.ConnectionState,
+ {
+ "auth_scheme": "BILLCOM_AUTH",
+ "val": t.cast(
+ connected_account_create_params.ConnectionStateUnionMember9Val,
+ {
+ **options,
+ "status": "ACTIVE",
+ },
+ ),
+ },
+ )
def basic_with_jwt(
self, options: connected_account_create_params.ConnectionStateUnionMember10Val
@@ -264,16 +282,19 @@ class AuthScheme:
"""
Create a new connected account using basic auth with JWT.
"""
- return {
- "auth_scheme": "BASIC_WITH_JWT",
- "val": t.cast(
- connected_account_create_params.ConnectionStateUnionMember10Val,
- {
- **options,
- "status": "ACTIVE",
- },
- ),
- }
+ return t.cast(
+ connected_account_create_params.ConnectionState,
+ {
+ "auth_scheme": "BASIC_WITH_JWT",
+ "val": t.cast(
+ connected_account_create_params.ConnectionStateUnionMember10Val,
+ {
+ **options,
+ "status": "ACTIVE",
+ },
+ ),
+ },
+ )
class ConnectedAccounts:
diff --git a/python/composio/utils/pydantic.py b/python/composio/utils/pydantic.py
index 17eb34977..8462e7532 100644
--- a/python/composio/utils/pydantic.py
+++ b/python/composio/utils/pydantic.py
@@ -4,7 +4,7 @@ import pydantic
from composio_client import omit
-def none_to_omit(value: t.Optional[t.Any]) -> t.Union[t.Any, type(omit)]:
+def none_to_omit(value: t.Optional[t.Any]) -> t.Any:
"""Convert None to omit for composio_client API calls.
This utility function helps convert Python's None values to composio_client's