mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-02 07:42:40 +00:00
fix: add missing type annotations to fix mypy strict mode errors
Added type annotations to 10 files to resolve mypy type checking errors: - Added return type annotations to methods missing them - Added parameter type annotations where missing - Fixed Optional type hints to be explicit - Removed redundant type cast in crew.py - Changed _execute_with_timeout return type from str to Any in agent.py Additional type errors remain in other files throughout the codebase.
This commit is contained in:
@@ -20,18 +20,18 @@ class RPMController(BaseModel):
|
||||
_shutdown_flag: bool = PrivateAttr(default=False)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def reset_counter(self):
|
||||
def reset_counter(self) -> "RPMController":
|
||||
if self.max_rpm is not None:
|
||||
if not self._shutdown_flag:
|
||||
self._lock = threading.Lock()
|
||||
self._reset_request_count()
|
||||
return self
|
||||
|
||||
def check_or_wait(self):
|
||||
def check_or_wait(self) -> bool:
|
||||
if self.max_rpm is None:
|
||||
return True
|
||||
|
||||
def _check_and_increment():
|
||||
def _check_and_increment() -> bool:
|
||||
if self.max_rpm is not None and self._current_rpm < self.max_rpm:
|
||||
self._current_rpm += 1
|
||||
return True
|
||||
@@ -55,12 +55,12 @@ class RPMController(BaseModel):
|
||||
self._timer.cancel()
|
||||
self._timer = None
|
||||
|
||||
def _wait_for_next_minute(self):
|
||||
def _wait_for_next_minute(self) -> None:
|
||||
time.sleep(60)
|
||||
self._current_rpm = 0
|
||||
|
||||
def _reset_request_count(self):
|
||||
def _reset():
|
||||
def _reset_request_count(self) -> None:
|
||||
def _reset() -> None:
|
||||
self._current_rpm = 0
|
||||
if not self._shutdown_flag:
|
||||
self._timer = threading.Timer(60.0, self._reset_request_count)
|
||||
|
||||
Reference in New Issue
Block a user