Open-source AI penetration testing tool to find and fix your app’s vulnerabilities.
Python agentsai-hackingai-penetration-testingai-pentestingai-securityartificial-intelligencebug-bountycode-qualityctf-toolscybersecuritycybersecurity-toolsethical-hackinghackingllm-securityoffensive-securitypenetration-testingpentesting-toolsred-teamingsecuritysecurity-automation
fix(legacy): silence ruff + mypy errors surfaced by litellm 1.83 bump
0xallam3652b449d1b8
diff --git a/pyproject.toml b/pyproject.tomlindex 2cf9986e..59a51efe 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -243,6 +243,10 @@ ignore = [][tool.ruff.lint.per-file-ignores]+# Pre-existing lazy imports inside functions (avoid circular dependency+# with strix.telemetry). Keep until the dependency graph is refactored.+"strix/llm/llm.py" = ["PLC0415"]+"strix/tools/notes/notes_actions.py" = ["PLC0415"]"tests/**/*.py" = ["S106", # Possible hardcoded password"S108", # Possible insecure usage of temporary file/directorydiff --git a/strix/llm/__init__.py b/strix/llm/__init__.pyindex 6f0cd76f..dea83753 100644--- a/strix/llm/__init__.py+++ b/strix/llm/__init__.py@@ -13,7 +13,7 @@ __all__ = ["LLMRequestFailedError",]-litellm._logging._disable_debugging()+litellm._logging._disable_debugging() # type: ignore[no-untyped-call]logging.getLogger("asyncio").setLevel(logging.CRITICAL)logging.getLogger("asyncio").propagate = Falsewarnings.filterwarnings("ignore", category=RuntimeWarning, module="asyncio")diff --git a/strix/llm/llm.py b/strix/llm/llm.pyindex 5e6a01f7..d45533fa 100644--- a/strix/llm/llm.py+++ b/strix/llm/llm.py@@ -275,14 +275,17 @@ class LLM:def _extract_thinking(self, chunks: list[Any]) -> list[dict[str, Any]] | None:if not chunks or not self._supports_reasoning():return None+ blocks: list[dict[str, Any]] | None = Nonetry:resp = stream_chunk_builder(chunks)- if resp.choices and hasattr(resp.choices[0].message, "thinking_blocks"):- blocks: list[dict[str, Any]] = resp.choices[0].message.thinking_blocks- return blocks+ choices: Any = getattr(resp, "choices", None)+ if choices:+ message: Any = getattr(choices[0], "message", None)+ if message is not None and hasattr(message, "thinking_blocks"):+ blocks = message.thinking_blocksexcept Exception: # noqa: BLE001, S110 # nosec B110pass- return None+ return blocksdef _update_usage_stats(self, response: Any) -> None:try:diff --git a/strix/tools/notes/notes_actions.py b/strix/tools/notes/notes_actions.pyindex 450ff35e..77cb8330 100644--- a/strix/tools/notes/notes_actions.py+++ b/strix/tools/notes/notes_actions.py@@ -231,9 +231,7 @@ def _to_note_listing_entry(entry["content"] = contentelif content:if len(content) > _DEFAULT_CONTENT_PREVIEW_CHARS:- entry["content_preview"] = (- f"{content[:_DEFAULT_CONTENT_PREVIEW_CHARS].rstrip()}..."- )+ entry["content_preview"] = f"{content[:_DEFAULT_CONTENT_PREVIEW_CHARS].rstrip()}..."else:entry["content_preview"] = content@@ -375,16 +373,17 @@ def append_note_content(note_id: str, delta: str) -> dict[str, Any]:if note_id not in _notes_storage:return {"success": False, "error": f"Note with ID '{note_id}' not found"}- if not isinstance(delta, str):- return {"success": False, "error": "Delta must be a string"}-note = _notes_storage[note_id]existing_content = str(note.get("content") or "")updated_content = f"{existing_content.rstrip()}{delta}"- return update_note(note_id=note_id, content=updated_content)-+ result: dict[str, Any] = update_note(+ note_id=note_id,+ content=updated_content,+ )except (ValueError, TypeError) as e:return {"success": False, "error": f"Failed to append note content: {e}"}+ else:+ return result@register_tool(sandbox_execution=False)