From 4f758cd3b040b3b01aa8bf056f3e45b41f65f45c Mon Sep 17 00:00:00 2001 From: Harshad Khetpal Date: Mon, 24 Aug 2026 18:45:15 +0530 Subject: [PATCH] fix: use identity checks for type comparisons; remove mutable default argument Co-Authored-By: Claude Fable 5 Signed-off-by: Harshad Khetpal --- opencontractserver/llms/tools/tool_factory.py | 10 +++++----- opencontractserver/pipeline/utils.py | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/opencontractserver/llms/tools/tool_factory.py b/opencontractserver/llms/tools/tool_factory.py index 9c7e93f4c1..d60433b4dc 100644 --- a/opencontractserver/llms/tools/tool_factory.py +++ b/opencontractserver/llms/tools/tool_factory.py @@ -175,15 +175,15 @@ def parameters(self) -> dict[str, Any]: # Try to infer type from annotation if param.annotation != inspect.Parameter.empty: - if param.annotation == int: + if param.annotation is int: param_info["type"] = "integer" - elif param.annotation == float: + elif param.annotation is float: param_info["type"] = "number" - elif param.annotation == bool: + elif param.annotation is bool: param_info["type"] = "boolean" - elif param.annotation == list: + elif param.annotation is list: param_info["type"] = "array" - elif param.annotation == dict: + elif param.annotation is dict: param_info["type"] = "object" properties[param_name] = param_info diff --git a/opencontractserver/pipeline/utils.py b/opencontractserver/pipeline/utils.py index 2ba07aa4ae..11bb98b9db 100644 --- a/opencontractserver/pipeline/utils.py +++ b/opencontractserver/pipeline/utils.py @@ -444,7 +444,7 @@ def run_post_processors( processor_paths: list[str], zip_bytes: bytes, export_data: OpenContractsExportDataJsonPythonType, - input_kwargs: dict[str, Any] = {}, + input_kwargs: dict[str, Any] | None = None, ) -> tuple[bytes, OpenContractsExportDataJsonPythonType]: """ Load and run post-processors in sequence. @@ -459,6 +459,7 @@ def run_post_processors( - Modified zip bytes - Modified export data dictionary """ + input_kwargs = input_kwargs or {} current_zip_bytes = zip_bytes current_export_data = export_data