mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-11 09:08:31 +00:00
Fix lint issues and add parameter validation
- Remove unused Optional import from mlflow.py - Add noqa comment for mlflow import in try block - Add parameter type validation with TypeError for non-boolean inputs - Add MLflow listener import to events/__init__.py - Clean up unused imports in test files Addresses code review feedback from João regarding parameter validation and return type annotations while fixing CI lint failures. Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
"""MLflow integration for CrewAI"""
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from crewai.utilities.events.crewai_event_bus import crewai_event_bus
|
||||
from crewai.utilities.events.third_party.mlflow_listener import mlflow_listener
|
||||
@@ -18,9 +17,14 @@ def autolog(
|
||||
Args:
|
||||
disable: If True, disable autologging. If False, enable it.
|
||||
silent: If True, suppress logging messages.
|
||||
|
||||
Raises:
|
||||
TypeError: If disable or silent are not boolean values.
|
||||
"""
|
||||
if not isinstance(disable, bool) or not isinstance(silent, bool):
|
||||
raise TypeError("Parameters 'disable' and 'silent' must be boolean")
|
||||
try:
|
||||
import mlflow
|
||||
import mlflow # noqa: F401
|
||||
except ImportError:
|
||||
if not silent:
|
||||
logger.warning(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Optional, Dict, Any
|
||||
from typing import Dict, Any
|
||||
import logging
|
||||
|
||||
from crewai.utilities.events.crew_events import (
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
"""
|
||||
Final test for MLflow integration issue #2947
|
||||
"""
|
||||
import pytest
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
|
||||
|
||||
def test_mlflow_autolog_availability():
|
||||
|
||||
Reference in New Issue
Block a user