diff --git a/src/crewai/flow/flow.py b/src/crewai/flow/flow.py index 806d9ec84..dc46aa6d8 100644 --- a/src/crewai/flow/flow.py +++ b/src/crewai/flow/flow.py @@ -95,7 +95,6 @@ def start(condition: Optional[Union[str, dict, Callable]] = None) -> Callable: return decorator - def listen(condition: Union[str, dict, Callable]) -> Callable: """ Creates a listener that executes when specified conditions are met. @@ -198,7 +197,6 @@ def router(condition: Union[str, dict, Callable]) -> Callable: """ def decorator(func): func.__is_router__ = True - # Handle conditions like listen/start if isinstance(condition, str): func.__trigger_methods__ = [condition] func.__condition_type__ = "OR" @@ -220,7 +218,6 @@ def router(condition: Union[str, dict, Callable]) -> Callable: return decorator - def or_(*conditions: Union[str, dict, Callable]) -> dict: """ Combines multiple conditions with OR logic for flow control. diff --git a/src/crewai/flow/flow_visualizer.py b/src/crewai/flow/flow_visualizer.py index ceacee91f..a70e91a18 100644 --- a/src/crewai/flow/flow_visualizer.py +++ b/src/crewai/flow/flow_visualizer.py @@ -18,6 +18,8 @@ from crewai.flow.visualization_utils import ( class FlowPlot: + """Handles the creation and rendering of flow visualization diagrams.""" + def __init__(self, flow): """ Initialize FlowPlot with a flow object. diff --git a/src/crewai/flow/html_template_handler.py b/src/crewai/flow/html_template_handler.py index 396af5546..f0d2d89ad 100644 --- a/src/crewai/flow/html_template_handler.py +++ b/src/crewai/flow/html_template_handler.py @@ -6,6 +6,8 @@ from crewai.flow.path_utils import safe_path_join, validate_path_exists class HTMLTemplateHandler: + """Handles HTML template processing and generation for flow visualization diagrams.""" + def __init__(self, template_path, logo_path): """ Initialize HTMLTemplateHandler with validated template and logo paths. @@ -29,19 +31,23 @@ class HTMLTemplateHandler: raise ValueError(f"Invalid template or logo path: {e}") def read_template(self): + """Read and return the HTML template file contents.""" with open(self.template_path, "r", encoding="utf-8") as f: return f.read() def encode_logo(self): + """Convert the logo SVG file to base64 encoded string.""" with open(self.logo_path, "rb") as logo_file: logo_svg_data = logo_file.read() return base64.b64encode(logo_svg_data).decode("utf-8") def extract_body_content(self, html): + """Extract and return content between body tags from HTML string.""" match = re.search("