The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
core: Add ruff rules TD and FIX (#30654)
Christophe Bornet43b5dc71915c
diff --git a/libs/core/langchain_core/outputs/chat_generation.py b/libs/core/langchain_core/outputs/chat_generation.pyindex 1579d95d2c..d01ae51694 100644--- a/libs/core/langchain_core/outputs/chat_generation.py+++ b/libs/core/langchain_core/outputs/chat_generation.py@@ -53,7 +53,7 @@ class ChatGeneration(Generation):text = ""if isinstance(self.message.content, str):text = self.message.content- # HACK: Assumes text in content blocks in OpenAI format.+ # Assumes text in content blocks in OpenAI format.# Uses first text block.elif isinstance(self.message.content, list):for block in self.message.content:diff --git a/libs/core/pyproject.toml b/libs/core/pyproject.tomlindex 6117bfe869..4e20673157 100644--- a/libs/core/pyproject.toml+++ b/libs/core/pyproject.toml@@ -82,12 +82,15 @@ ignore = ["C90", # McCabe complexity"COM812", # Messes with the formatter"FA100", # Can't activate since we exclude UP007 for now+ "FIX002", # Line contains TODO"ISC001", # Messes with the formatter"PERF203", # Rarely useful"PLR09", # Too many something (arg, statements, etc)"TC001", # Doesn't play well with Pydantic"TC002", # Doesn't play well with Pydantic"TC003", # Doesn't play well with Pydantic+ "TD002", # Missing author in TODO+ "TD003", # Missing issue link in TODO"UP007", # Doesn't play well with Pydantic in Python 3.9# TODO rules@@ -99,13 +102,11 @@ ignore = ["DTZ","FBT001","FBT002",- "FIX","PGH","PLR","PYI","RUF","SLF",- "TD",]flake8-type-checking.runtime-evaluated-base-classes = ["pydantic.BaseModel","langchain_core.load.serializable.Serializable","langchain_core.runnables.base.RunnableSerializable"]flake8-annotations.allow-star-arg-any = truediff --git a/libs/core/tests/unit_tests/runnables/test_runnable.py b/libs/core/tests/unit_tests/runnables/test_runnable.pyindex 8309ab128a..71b006d662 100644--- a/libs/core/tests/unit_tests/runnables/test_runnable.py+++ b/libs/core/tests/unit_tests/runnables/test_runnable.py@@ -3228,7 +3228,8 @@ def test_map_stream() -> None:{"llm": "i"},{"chat": _any_id_ai_message_chunk(content="i")},]- if not ( # TODO(Rewrite properly) statement above+ if not (+ # TODO: Rewrite properly the statement abovestreamed_chunks[0] == {"llm": "i"}or {"chat": _any_id_ai_message_chunk(content="i")}):