fix(websearch): use the three-arg getattr to satisfy B009

The pure revert restored `getattr(llm_router, "search_tools")`, whose
two-argument constant-attribute form ruff flags as B009, and the
strict-rule budget has since ratcheted below what that costs

Passing an explicit `None` default keeps behavior identical, the
preceding `hasattr` guard already proves the attribute is there, while
staying inside the budget
This commit is contained in:
Yuneng Jiang 2026-09-01 11:21:19 -07:00
parent 201f60d19c
commit 2814aa54a3
No known key found for this signature in database

View file

@ -1633,7 +1633,7 @@ class WebSearchInterceptionLogger(CustomLogger):
def _select_search_tool_from_router(self, llm_router: object) -> "_SearchToolConfig | None":
if llm_router is None or not hasattr(llm_router, "search_tools"):
return None
search_tools: Final = list(getattr(llm_router, "search_tools") or [])
search_tools: Final = list(getattr(llm_router, "search_tools", None) or [])
return self._select_search_tool_from_list(search_tools=search_tools, source="router")
def _select_search_tool_from_list(