Fix type-checker issues with proper type annotations

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-04-27 16:49:18 +00:00
parent 0328a8aaa4
commit a8e7e2db6d
2 changed files with 5 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
import logging import logging
from typing import Any, Callable, Dict, List, Optional, Union from typing import Any, Callable, Dict, List, Mapping, Optional, Union
from crewai.cli.authentication.utils import TokenManager from crewai.cli.authentication.utils import TokenManager
from crewai.tools import BaseTool from crewai.tools import BaseTool

View File

@@ -1,6 +1,6 @@
import json import json
import logging import logging
from typing import Any, Callable, Dict, Optional, Union from typing import Any, Callable, Dict, Mapping, Optional, Union
from urllib.parse import urljoin from urllib.parse import urljoin
import requests import requests
@@ -55,8 +55,8 @@ class SSEClient:
self.headers = headers or {} self.headers = headers or {}
self.timeout = timeout self.timeout = timeout
self.logger = logging.getLogger(__name__) self.logger = logging.getLogger(__name__)
self._client = None self._client: Optional[sseclient.SSEClient] = None
self._response = None self._response: Optional[requests.Response] = None
def connect(self) -> None: def connect(self) -> None:
"""Establish a connection to the SSE server.""" """Establish a connection to the SSE server."""
@@ -93,7 +93,7 @@ class SSEClient:
) )
raise raise
def listen(self, event_handlers: Optional[Dict[str, Callable[[Any], None]]] = None) -> None: def listen(self, event_handlers: Optional[Mapping[str, Callable[[Any], None]]] = None) -> None:
"""Listen for SSE events and process them with registered handlers. """Listen for SSE events and process them with registered handlers.
Args: Args: