diff --git a/logsight/enterprise.py b/logsight/enterprise.py index a3adc8f..9ea0934 100644 --- a/logsight/enterprise.py +++ b/logsight/enterprise.py @@ -144,6 +144,6 @@ def send(self, payload: dict[str, Any]) -> bool: ) try: with urllib.request.urlopen(request, timeout=self.timeout) as response: # nosec B310 - return 200 <= response.status < 300 + return bool(200 <= response.status < 300) except (OSError, ValueError): return False diff --git a/logsight/storage.py b/logsight/storage.py index 5c1ca5b..3f1146f 100644 --- a/logsight/storage.py +++ b/logsight/storage.py @@ -9,7 +9,7 @@ import json import urllib.parse import urllib.request -from typing import Any +from typing import Any, cast class ClickHouseStore: @@ -26,7 +26,7 @@ def execute(self, query: str, data: str | None = None) -> bytes: method="POST", ) with urllib.request.urlopen(request, timeout=10) as response: # nosec B310 - return response.read() + return cast(bytes, response.read()) def insert_events(self, events: list[dict[str, Any]]) -> None: if not events: @@ -52,4 +52,4 @@ def upsert(self, points: list[dict[str, Any]]) -> dict[str, Any]: method="PUT", ) with urllib.request.urlopen(request, timeout=10) as response: # nosec B310 - return json.loads(response.read().decode()) + return cast(dict[str, Any], json.loads(response.read().decode())) diff --git a/pyproject.toml b/pyproject.toml index 8d4f0a5..12aa3d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,6 +67,8 @@ strict = true packages = ["logsight"] follow_imports = "skip" disallow_untyped_decorators = false +ignore_missing_imports = true +warn_unused_ignores = false [tool.bandit] exclude_dirs = ["tests", "work"]