Skip to content

Commit

Permalink
Fix all pre-commit errors
Browse files Browse the repository at this point in the history
When running pre-commit run --all-files

src/crewai/__init__.py:1:26: F401 `crewai.agent.Agent` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/__init__.py:2:25: F401 `crewai.crew.Crew` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/__init__.py:3:28: F401 `crewai.process.Process` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/__init__.py:4:25: F401 `crewai.task.Task` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/agents/__init__.py:1:34: F401 `.cache.cache_handler.CacheHandler` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/agents/__init__.py:2:23: F401 `.executor.CrewAgentExecutor` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/agents/__init__.py:3:21: F401 `.parser.CrewAgentParser` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/agents/__init__.py:4:28: F401 `.tools_handler.ToolsHandler` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/agents/cache/__init__.py:1:28: F401 `.cache_handler.CacheHandler` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/memory/__init__.py:1:35: F401 `.entity.entity_memory.EntityMemory` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/memory/__init__.py:2:41: F401 `.long_term.long_term_memory.LongTermMemory` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/memory/__init__.py:3:43: F401 `.short_term.short_term_memory.ShortTermMemory` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/project/__init__.py:1:26: F401 `.annotations.agent` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/project/__init__.py:1:33: F401 `.annotations.crew` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/project/__init__.py:1:39: F401 `.annotations.task` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/project/__init__.py:2:24: F401 `.crew_base.CrewBase` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/telemetry/__init__.py:1:24: F401 `.telemetry.Telemetry` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/utilities/__init__.py:1:24: F401 `.converter.Converter` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/utilities/__init__.py:1:35: F401 `.converter.ConverterError` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/utilities/__init__.py:2:19: F401 `.i18n.I18N` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/utilities/__init__.py:3:25: F401 `.instructor.Instructor` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/utilities/__init__.py:4:21: F401 `.logger.Logger` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/utilities/__init__.py:5:22: F401 `.printer.Printer` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/utilities/__init__.py:6:22: F401 `.prompts.Prompts` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/utilities/__init__.py:7:29: F401 `.rpm_controller.RPMController` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/utilities/__init__.py:8:26: F401 `.fileHandler.FileHandler` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/utilities/__init__.py:9:21: F401 `.parser.YamlParser` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
src/crewai/utilities/logger.py:16:25: F821 Undefined name `datetime`
  • Loading branch information
arnaudgelas committed Jun 8, 2024
1 parent 2a0e21c commit c908dff
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/crewai/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
__all__ = ["Agent", "Crew", "Process", "Task"]
from crewai.agent import Agent
from crewai.crew import Crew
from crewai.process import Process
Expand Down
1 change: 1 addition & 0 deletions src/crewai/agents/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
__all__ = ["CacheHandler", "CrewAgentExecutor", "CrewAgentParser", "ToolsHandler"]
from .cache.cache_handler import CacheHandler
from .executor import CrewAgentExecutor
from .parser import CrewAgentParser
Expand Down
1 change: 1 addition & 0 deletions src/crewai/agents/cache/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__all__ = ["CacheHandler"]
from .cache_handler import CacheHandler
1 change: 1 addition & 0 deletions src/crewai/memory/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
__all__ = ["EntityMemory", "LongTermMemory", "ShortTermMemory"]
from .entity.entity_memory import EntityMemory
from .long_term.long_term_memory import LongTermMemory
from .short_term.short_term_memory import ShortTermMemory
1 change: 1 addition & 0 deletions src/crewai/project/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
__all__ = ["agent", "crew", "task", "CrewBase"]
from .annotations import agent, crew, task
from .crew_base import CrewBase
1 change: 1 addition & 0 deletions src/crewai/telemetry/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__all__ = ["Telemetry"]
from .telemetry import Telemetry
12 changes: 12 additions & 0 deletions src/crewai/utilities/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
__all__ = [
"Converter",
"ConverterError",
"I18N",
"Instructor",
"Logger",
"Printer",
"Prompts",
"RPMController",
"FileHandler",
"YamlParser",
]
from .converter import Converter, ConverterError
from .i18n import I18N
from .instructor import Instructor
Expand Down
2 changes: 1 addition & 1 deletion src/crewai/utilities/fileHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ def __init__(self, file_path):
def log(self, **kwargs):
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
message = f"{now}: ".join([f"{key}={value}" for key, value in kwargs.items()])
with open(self._path, "a", encoding = 'utf-8') as file:
with open(self._path, "a", encoding="utf-8") as file:
file.write(message + "\n")
8 changes: 5 additions & 3 deletions src/crewai/utilities/logger.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import datetime
from crewai.utilities.printer import Printer


Expand All @@ -13,6 +14,7 @@ def __init__(self, verbose_level=0):
def log(self, level, message, color="bold_green"):
level_map = {"debug": 1, "info": 2}
if self.verbose_level and level_map.get(level, 0) <= self.verbose_level:
timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
self._printer.print(f"[{timestamp}][{level.upper()}]: {message}", color=color)

timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
self._printer.print(
f"[{timestamp}][{level.upper()}]: {message}", color=color
)
2 changes: 2 additions & 0 deletions tests/agent_tools/agent_tools_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def test_ask_question():
== "As an AI researcher, I don't have personal feelings or emotions like love or hate. However, I recognize the importance of AI Agents in today's technological landscape. They have the potential to greatly enhance our lives and make tasks more efficient. At the same time, it is crucial to consider the ethical implications and societal impacts that come with their use. My role is to provide objective research and analysis on these topics."
)


@pytest.mark.vcr(filter_headers=["authorization"])
def test_ask_question_with_wrong_co_worker_variable():
result = tools.ask_question(
Expand All @@ -68,6 +69,7 @@ def test_ask_question_with_wrong_co_worker_variable():
== "No, I don't hate AI agents. In fact, I find them quite fascinating. They are powerful tools that can greatly assist in various tasks, including my research. As a technology researcher, AI and AI agents are subjects of interest to me due to their potential in advancing our understanding and capabilities in various fields. My supposed love for them stems from this professional interest and the potential they hold."
)


@pytest.mark.vcr(filter_headers=["authorization"])
def test_delegate_work_withwith_coworker_as_array():
result = tools.delegate_work(
Expand Down
5 changes: 1 addition & 4 deletions tests/memory/short_term_memory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ def short_term_memory():
expected_output="A list of relevant URLs based on the search query.",
agent=agent,
)
return ShortTermMemory(crew=Crew(
agents=[agent],
tasks=[task]
))
return ShortTermMemory(crew=Crew(agents=[agent], tasks=[task]))


@pytest.mark.vcr(filter_headers=["authorization"])
Expand Down

0 comments on commit c908dff

Please sign in to comment.