mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 23:58:34 +00:00
fix: resolve lint issues in ChunkBasedTask implementation
- Remove unused Dict import from typing - Fix f-string without placeholders - Remove unused imports and variables in tests Co-Authored-By: Jo\u00E3o <joao@crewai.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import datetime
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
from typing import Any, List, Optional, Union
|
||||
from pydantic import Field, field_validator
|
||||
|
||||
from crewai.task import Task
|
||||
@@ -61,7 +61,7 @@ class ChunkBasedTask(Task):
|
||||
"""Create a task description for processing a single chunk."""
|
||||
chunk_context = f"Processing chunk {chunk_index + 1} of {total_chunks}"
|
||||
if self.chunk_results:
|
||||
chunk_context += f"\n\nPrevious chunk insights from memory will be available."
|
||||
chunk_context += "\n\nPrevious chunk insights from memory will be available."
|
||||
|
||||
return f"{chunk_context}\n\n{self.description}\n\nChunk content:\n{chunk}"
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ from pathlib import Path
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from crewai.tasks.chunk_based_task import ChunkBasedTask
|
||||
from crewai.agent import Agent
|
||||
from crewai.tasks.task_output import TaskOutput
|
||||
|
||||
|
||||
@@ -110,7 +109,7 @@ class TestChunkBasedTask:
|
||||
mock_agent.role = "test_agent"
|
||||
mock_agent.crew = None
|
||||
|
||||
result = task._execute_core(mock_agent, None, None)
|
||||
task._execute_core(mock_agent, None, None)
|
||||
|
||||
assert len(task.chunk_results) > 1
|
||||
assert mock_execute.call_count > len(task.chunk_results)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import pytest
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
@@ -42,7 +41,7 @@ class TestChunkBasedTaskIntegration:
|
||||
agent=agent
|
||||
)
|
||||
|
||||
crew = Crew(
|
||||
Crew(
|
||||
agents=[agent],
|
||||
tasks=[task],
|
||||
memory=True
|
||||
|
||||
Reference in New Issue
Block a user