fix: Replace deprecated typing imports with built-in types

- Replace Dict, List, Set, Tuple with dict, list, set, tuple throughout codebase
- Add missing type annotations to crew_events.py methods
- Add proper type annotations to test_crew_cancellation.py
- Use type: ignore[method-assign] comments for mock assignments
- Maintain backward compatibility while modernizing type hints

This resolves lint and type-checker failures in CI while preserving
the cancellation functionality.

Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
Devin AI
2025-09-04 02:07:02 +00:00
parent 3a54cc859a
commit 3619d4dc50
108 changed files with 662 additions and 672 deletions

View File

@@ -7,7 +7,7 @@ traversal attacks and ensure paths remain within allowed boundaries.
import os
from pathlib import Path
from typing import List, Union
from typing import Union
def safe_path_join(*parts: str, root: Union[str, Path, None] = None) -> str:
@@ -101,7 +101,7 @@ def validate_path_exists(path: Union[str, Path], file_type: str = "file") -> str
raise ValueError(f"Invalid path: {str(e)}")
def list_files(directory: Union[str, Path], pattern: str = "*") -> List[str]:
def list_files(directory: Union[str, Path], pattern: str = "*") -> list[str]:
"""
Safely list files in a directory matching a pattern.
@@ -114,7 +114,7 @@ def list_files(directory: Union[str, Path], pattern: str = "*") -> List[str]:
Returns
-------
List[str]
list[str]
List of matching file paths.
Raises