mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-01 13:18:10 +00:00
Fix lint: remove unused imports, fix E402 noqa, add type: ignore annotations
Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -78,7 +78,9 @@ ROLE_AGENT = Role.ROLE_AGENT
|
||||
# Protobuf objects don't have model_dump() / model_copy().
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
from google.protobuf.json_format import MessageToDict # type: ignore[import-untyped] # noqa: E402
|
||||
from google.protobuf.json_format import ( # noqa: E402
|
||||
MessageToDict,
|
||||
)
|
||||
|
||||
|
||||
def proto_to_json(msg: Any) -> str:
|
||||
|
||||
@@ -10,8 +10,6 @@ See: https://a2a-protocol.org/latest/topics/extensions/
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from a2a.client.interceptors import BeforeArgs, ClientCallInterceptor
|
||||
from a2a.extensions.common import (
|
||||
HTTP_EXTENSION_HEADER,
|
||||
|
||||
@@ -4,19 +4,12 @@ from __future__ import annotations
|
||||
|
||||
from collections.abc import AsyncIterator
|
||||
from typing import TYPE_CHECKING, Any
|
||||
import uuid
|
||||
|
||||
from a2a.client.errors import A2AClientError
|
||||
from a2a.types import (
|
||||
AgentCard,
|
||||
Message,
|
||||
Part,
|
||||
Role,
|
||||
StreamResponse,
|
||||
Task,
|
||||
TaskArtifactUpdateEvent,
|
||||
TaskState,
|
||||
TaskStatusUpdateEvent,
|
||||
)
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
@@ -31,12 +24,9 @@ from crewai.a2a._compat import (
|
||||
TASK_STATE_SUBMITTED,
|
||||
TASK_STATE_WORKING,
|
||||
agent_card_to_dict,
|
||||
is_stream_artifact_update,
|
||||
is_stream_message,
|
||||
is_stream_status_update,
|
||||
is_stream_task,
|
||||
new_text_message,
|
||||
new_text_part,
|
||||
part_is_text,
|
||||
part_text,
|
||||
)
|
||||
|
||||
@@ -5,7 +5,6 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import time
|
||||
from typing import TYPE_CHECKING, Any
|
||||
import uuid
|
||||
|
||||
from a2a.client import Client
|
||||
from a2a.client.errors import A2AClientError
|
||||
@@ -13,18 +12,14 @@ from a2a.types import (
|
||||
AgentCard,
|
||||
GetTaskRequest,
|
||||
Message,
|
||||
Part,
|
||||
Role,
|
||||
TaskState,
|
||||
)
|
||||
from typing_extensions import Unpack
|
||||
|
||||
from crewai.a2a._compat import (
|
||||
ROLE_AGENT,
|
||||
TASK_STATE_FAILED,
|
||||
new_text_message,
|
||||
)
|
||||
from typing_extensions import Unpack
|
||||
|
||||
from crewai.a2a.errors import A2APollingTimeoutError
|
||||
from crewai.a2a.task_helpers import (
|
||||
ACTIONABLE_STATES,
|
||||
|
||||
@@ -4,26 +4,20 @@ from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, Any
|
||||
import uuid
|
||||
|
||||
from a2a.client import Client
|
||||
from a2a.client.errors import A2AClientError
|
||||
from a2a.types import (
|
||||
AgentCard,
|
||||
Message,
|
||||
Part,
|
||||
Role,
|
||||
TaskState,
|
||||
)
|
||||
from typing_extensions import Unpack
|
||||
|
||||
from crewai.a2a._compat import (
|
||||
ROLE_AGENT,
|
||||
TASK_STATE_FAILED,
|
||||
new_text_message,
|
||||
new_text_part,
|
||||
)
|
||||
from typing_extensions import Unpack
|
||||
|
||||
from crewai.a2a.task_helpers import (
|
||||
TaskStateResult,
|
||||
process_task_state,
|
||||
|
||||
@@ -5,7 +5,6 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import logging
|
||||
from typing import Final
|
||||
import uuid
|
||||
|
||||
from a2a.client import Client
|
||||
from a2a.client.errors import A2AClientError
|
||||
@@ -13,22 +12,15 @@ from a2a.types import (
|
||||
AgentCard,
|
||||
GetTaskRequest,
|
||||
Message,
|
||||
Part,
|
||||
Role,
|
||||
StreamResponse,
|
||||
SubscribeToTaskRequest,
|
||||
Task,
|
||||
TaskArtifactUpdateEvent,
|
||||
TaskState,
|
||||
TaskStatusUpdateEvent,
|
||||
)
|
||||
from typing_extensions import Unpack
|
||||
|
||||
from crewai.a2a._compat import (
|
||||
ROLE_AGENT,
|
||||
TASK_STATE_FAILED,
|
||||
agent_card_to_dict,
|
||||
is_status_update_final,
|
||||
is_stream_artifact_update,
|
||||
is_stream_message,
|
||||
is_stream_status_update,
|
||||
|
||||
@@ -14,13 +14,16 @@ from typing import TYPE_CHECKING
|
||||
|
||||
from a2a.client.errors import A2AClientError
|
||||
from a2a.types import AgentCapabilities, AgentCard, AgentInterface, AgentSkill
|
||||
from google.protobuf.json_format import ParseDict # type: ignore[import-untyped]
|
||||
|
||||
from crewai.a2a._compat import agent_card_to_dict, agent_card_protocol_version, proto_copy
|
||||
from aiocache import cached # type: ignore[import-untyped]
|
||||
from aiocache.serializers import PickleSerializer # type: ignore[import-untyped]
|
||||
from google.protobuf.json_format import ParseDict # type: ignore[import-untyped]
|
||||
import httpx
|
||||
|
||||
from crewai.a2a._compat import (
|
||||
agent_card_protocol_version,
|
||||
agent_card_to_dict,
|
||||
proto_copy,
|
||||
)
|
||||
from crewai.a2a.auth.client_schemes import APIKeyAuth, HTTPDigestAuth
|
||||
from crewai.a2a.auth.utils import (
|
||||
_auth_store,
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import base64
|
||||
from collections.abc import AsyncIterator, Callable, MutableMapping
|
||||
import concurrent.futures
|
||||
from contextlib import asynccontextmanager
|
||||
@@ -12,7 +11,7 @@ import logging
|
||||
from typing import TYPE_CHECKING, Any, Final, Literal
|
||||
import uuid
|
||||
|
||||
from a2a.client import Client, ClientConfig, ClientFactory
|
||||
from a2a.client import Client, ClientFactory
|
||||
from a2a.types import (
|
||||
AgentCard,
|
||||
Message,
|
||||
@@ -21,11 +20,11 @@ from a2a.types import (
|
||||
TaskPushNotificationConfig,
|
||||
)
|
||||
import httpx
|
||||
from pydantic import BaseModel
|
||||
|
||||
from crewai.a2a._compat import (
|
||||
ROLE_USER,
|
||||
agent_card_interfaces,
|
||||
agent_card_preferred_transport,
|
||||
agent_card_protocol_version,
|
||||
agent_card_to_dict,
|
||||
agent_card_url,
|
||||
@@ -33,8 +32,6 @@ from crewai.a2a._compat import (
|
||||
new_text_part,
|
||||
proto_copy,
|
||||
)
|
||||
from pydantic import BaseModel
|
||||
|
||||
from crewai.a2a.auth.client_schemes import APIKeyAuth, HTTPDigestAuth
|
||||
from crewai.a2a.auth.utils import (
|
||||
_auth_store,
|
||||
@@ -50,8 +47,6 @@ from crewai.a2a.task_helpers import TaskStateResult
|
||||
from crewai.a2a.types import (
|
||||
HANDLER_REGISTRY,
|
||||
HandlerType,
|
||||
PartsDict,
|
||||
PartsMetadataDict,
|
||||
TransportType,
|
||||
)
|
||||
from crewai.a2a.updates import (
|
||||
|
||||
@@ -13,11 +13,15 @@ import os
|
||||
from typing import TYPE_CHECKING, Any, ParamSpec, TypeVar, cast
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from a2a.helpers.proto_helpers import (
|
||||
new_data_artifact,
|
||||
new_text_artifact,
|
||||
new_text_message as new_agent_text_message,
|
||||
)
|
||||
from a2a.server.agent_execution import RequestContext
|
||||
from a2a.server.events import EventQueue
|
||||
from a2a.types import (
|
||||
Artifact,
|
||||
InternalError,
|
||||
InvalidParamsError,
|
||||
Message,
|
||||
Part,
|
||||
@@ -26,28 +30,20 @@ from a2a.types import (
|
||||
TaskStatus,
|
||||
TaskStatusUpdateEvent,
|
||||
)
|
||||
from a2a.helpers.proto_helpers import (
|
||||
new_data_artifact,
|
||||
new_text_artifact,
|
||||
new_text_message as new_agent_text_message,
|
||||
)
|
||||
from a2a.utils.errors import A2AError as ServerError
|
||||
from aiocache import SimpleMemoryCache, caches # type: ignore[import-untyped]
|
||||
from pydantic import BaseModel
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
from crewai.a2a._compat import (
|
||||
ROLE_AGENT,
|
||||
TASK_STATE_CANCELED,
|
||||
TASK_STATE_COMPLETED,
|
||||
TASK_STATE_FAILED,
|
||||
part_has_data,
|
||||
part_has_file,
|
||||
part_is_text,
|
||||
part_text,
|
||||
proto_copy,
|
||||
)
|
||||
from aiocache import SimpleMemoryCache, caches # type: ignore[import-untyped]
|
||||
from pydantic import BaseModel
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
from crewai.a2a.utils.agent_card import _get_server_config
|
||||
from crewai.a2a.utils.content_type import validate_message_parts
|
||||
from crewai.events.event_bus import crewai_event_bus
|
||||
@@ -81,7 +77,9 @@ def _get_data_parts(parts: list[Part]) -> list[dict[str, Any]]:
|
||||
result: list[dict[str, Any]] = []
|
||||
for part in parts:
|
||||
if part_has_data(part):
|
||||
from google.protobuf.json_format import MessageToDict # type: ignore[import-untyped]
|
||||
from google.protobuf.json_format import (
|
||||
MessageToDict, # type: ignore[import-untyped]
|
||||
)
|
||||
|
||||
val = MessageToDict(part.data)
|
||||
if isinstance(val, dict):
|
||||
|
||||
@@ -14,7 +14,6 @@ import json
|
||||
from types import MethodType
|
||||
from typing import TYPE_CHECKING, Any, NamedTuple
|
||||
|
||||
from a2a.types import Role, TaskState
|
||||
from pydantic import BaseModel, ValidationError
|
||||
|
||||
from crewai.a2a._compat import (
|
||||
|
||||
Reference in New Issue
Block a user