From 03ee4c59eb1b02406df9a3b02bdde48ee57deb3d Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 7 Jul 2025 18:01:35 +0000 Subject: [PATCH] Fix lint and type-checker issues in OAuth2 implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove unused imports (List, Optional, MagicMock) - Fix type annotation: change 'any' to 'Any' in oauth2_token_manager.py - All OAuth2 tests still pass after fixes Co-Authored-By: João --- src/crewai/llms/oauth2_config.py | 2 +- src/crewai/llms/oauth2_token_manager.py | 4 ++-- tests/test_oauth2_llm.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/crewai/llms/oauth2_config.py b/src/crewai/llms/oauth2_config.py index 5373fcefc..1eff2e144 100644 --- a/src/crewai/llms/oauth2_config.py +++ b/src/crewai/llms/oauth2_config.py @@ -1,5 +1,5 @@ from pathlib import Path -from typing import Dict, List, Optional +from typing import Dict, Optional import json from pydantic import BaseModel, Field diff --git a/src/crewai/llms/oauth2_token_manager.py b/src/crewai/llms/oauth2_token_manager.py index af14117f2..c750f2f9d 100644 --- a/src/crewai/llms/oauth2_token_manager.py +++ b/src/crewai/llms/oauth2_token_manager.py @@ -1,6 +1,6 @@ import time import requests -from typing import Dict, Optional +from typing import Dict, Any from .oauth2_config import OAuth2Config @@ -19,7 +19,7 @@ class OAuth2TokenManager: return self._acquire_new_token(config) - def _is_token_valid(self, token_data: Dict[str, any]) -> bool: + def _is_token_valid(self, token_data: Dict[str, Any]) -> bool: """Check if token is still valid (not expired)""" if "expires_at" not in token_data: return False diff --git a/tests/test_oauth2_llm.py b/tests/test_oauth2_llm.py index e60f601a5..4471a9803 100644 --- a/tests/test_oauth2_llm.py +++ b/tests/test_oauth2_llm.py @@ -4,7 +4,7 @@ import requests import tempfile import time from pathlib import Path -from unittest.mock import Mock, patch, MagicMock +from unittest.mock import Mock, patch from crewai.llm import LLM from crewai.llms.oauth2_config import OAuth2Config, OAuth2ConfigLoader from crewai.llms.oauth2_token_manager import OAuth2TokenManager