Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
fix: use sys.platform guards so mypy passes on Windows (#7401)
Modusensus7e80d94921dd
diff --git a/lib/crewai/src/crewai/memory/storage/lancedb_storage.py b/lib/crewai/src/crewai/memory/storage/lancedb_storage.pyindex 8c9d640a5..6a97900fd 100644--- a/lib/crewai/src/crewai/memory/storage/lancedb_storage.py+++ b/lib/crewai/src/crewai/memory/storage/lancedb_storage.py@@ -8,6 +8,7 @@ import jsonimport loggingimport osfrom pathlib import Path+import sysimport threadingimport timefrom typing import Any@@ -77,14 +78,15 @@ class LanceDBStorage:self._table_name = table_nameself._db = lancedb.connect(str(self._path))- try:- import resource+ if sys.platform != "win32":+ try:+ import resource- soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE)- if soft < 4096:- resource.setrlimit(resource.RLIMIT_NOFILE, (min(hard, 4096), hard))- except Exception: # noqa: S110- pass # Windows or already at the max hard limit — safe to ignore+ soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE)+ if soft < 4096:+ resource.setrlimit(resource.RLIMIT_NOFILE, (min(hard, 4096), hard))+ except Exception: # noqa: S110+ pass # Already at the max hard limit — safe to ignoreself._compact_every = compact_everyself._save_count = 0diff --git a/lib/crewai/src/crewai/utilities/crew_chat.py b/lib/crewai/src/crewai/utilities/crew_chat.pyindex 8fa5a685c..50d7ebc20 100644--- a/lib/crewai/src/crewai/utilities/crew_chat.py+++ b/lib/crewai/src/crewai/utilities/crew_chat.py@@ -3,7 +3,6 @@import contextvarsimport jsonfrom pathlib import Path-import platformimport reimport sysimport threading@@ -175,11 +174,11 @@ def create_tool_function(crew: Crew, messages: list[LLMMessage]) -> Any:def flush_input() -> None:"""Flush any pending input from the user."""- if platform.system() == "Windows":+ if sys.platform == "win32":import msvcrt- while msvcrt.kbhit(): # type: ignore[attr-defined]- msvcrt.getch() # type: ignore[attr-defined]+ while msvcrt.kbhit():+ msvcrt.getch()else:import termios