mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +00:00
fix: resolve remaining lint issues in console formatter
- Add ClassVar import for proper type annotation - Fix variable shadowing by renaming nested loop variables - Break long comment lines to meet 88 character limit - All lint checks now pass locally Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any
|
from typing import Any, ClassVar
|
||||||
|
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
from rich.live import Live
|
from rich.live import Live
|
||||||
@@ -16,7 +16,7 @@ class ConsoleFormatter:
|
|||||||
current_flow_tree: Tree | None = None
|
current_flow_tree: Tree | None = None
|
||||||
current_method_branch: Tree | None = None
|
current_method_branch: Tree | None = None
|
||||||
current_lite_agent_branch: Tree | None = None
|
current_lite_agent_branch: Tree | None = None
|
||||||
tool_usage_counts: dict[str, int] = {}
|
tool_usage_counts: ClassVar[dict[str, int]] = {}
|
||||||
current_reasoning_branch: Tree | None = None # Track reasoning status
|
current_reasoning_branch: Tree | None = None # Track reasoning status
|
||||||
_live_paused: bool = False
|
_live_paused: bool = False
|
||||||
current_llm_tool_tree: Tree | None = None
|
current_llm_tool_tree: Tree | None = None
|
||||||
@@ -115,7 +115,7 @@ class ConsoleFormatter:
|
|||||||
self._live.update(tree, refresh=True)
|
self._live.update(tree, refresh=True)
|
||||||
return # Nothing else to do
|
return # Nothing else to do
|
||||||
|
|
||||||
# Case 2: blank line while a live session is running – ignore so we
|
# Case 2: blank line while a live session is running - ignore so we
|
||||||
# don't break the in-place rendering behaviour
|
# don't break the in-place rendering behaviour
|
||||||
if len(args) == 0 and self._live:
|
if len(args) == 0 and self._live:
|
||||||
return
|
return
|
||||||
@@ -693,7 +693,7 @@ class ConsoleFormatter:
|
|||||||
if tool_branch is not None and "Thinking" in str(tool_branch.label):
|
if tool_branch is not None and "Thinking" in str(tool_branch.label):
|
||||||
thinking_branch_to_remove = tool_branch
|
thinking_branch_to_remove = tool_branch
|
||||||
|
|
||||||
# Method 2: Fallback - search for any thinking node if tool_branch is None or not thinking
|
# Method 2: Fallback - search for any thinking node if tool_branch is None
|
||||||
if thinking_branch_to_remove is None:
|
if thinking_branch_to_remove is None:
|
||||||
parents = [
|
parents = [
|
||||||
self.current_lite_agent_branch,
|
self.current_lite_agent_branch,
|
||||||
@@ -752,7 +752,7 @@ class ConsoleFormatter:
|
|||||||
if tool_branch is not None and "Thinking" in str(tool_branch.label):
|
if tool_branch is not None and "Thinking" in str(tool_branch.label):
|
||||||
thinking_branch_to_update = tool_branch
|
thinking_branch_to_update = tool_branch
|
||||||
|
|
||||||
# Method 2: Fallback - search for any thinking node if tool_branch is None or not thinking
|
# Method 2: Fallback - search for any thinking node if tool_branch is None
|
||||||
if thinking_branch_to_update is None:
|
if thinking_branch_to_update is None:
|
||||||
parents = [
|
parents = [
|
||||||
self.current_lite_agent_branch,
|
self.current_lite_agent_branch,
|
||||||
@@ -1596,9 +1596,9 @@ class ConsoleFormatter:
|
|||||||
|
|
||||||
for child in branch_to_use.children:
|
for child in branch_to_use.children:
|
||||||
if "Memory Retrieval" in str(child.label):
|
if "Memory Retrieval" in str(child.label):
|
||||||
for child in child.children:
|
for inner_child in child.children:
|
||||||
sources_branch = child
|
sources_branch = inner_child
|
||||||
if "Sources Used" in str(child.label):
|
if "Sources Used" in str(inner_child.label):
|
||||||
sources_branch.add(f"✅ {memory_type} ({query_time_ms:.2f}ms)")
|
sources_branch.add(f"✅ {memory_type} ({query_time_ms:.2f}ms)")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
@@ -1629,9 +1629,9 @@ class ConsoleFormatter:
|
|||||||
|
|
||||||
for child in branch_to_use.children:
|
for child in branch_to_use.children:
|
||||||
if "Memory Retrieval" in str(child.label):
|
if "Memory Retrieval" in str(child.label):
|
||||||
for child in child.children:
|
for inner_child in child.children:
|
||||||
sources_branch = child
|
sources_branch = inner_child
|
||||||
if "Sources Used" in str(child.label):
|
if "Sources Used" in str(inner_child.label):
|
||||||
sources_branch.add(f"❌ {memory_type} - Error: {error}")
|
sources_branch.add(f"❌ {memory_type} - Error: {error}")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user