diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..081bf01 --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +# Python +__pycache__/ +*.py[cod] +*.egg-info/ +.eggs/ +build/ +dist/ + +# 虚拟环境 +.venv/ +venv/ +env/ + +# 测试与工具缓存 +.pytest_cache/ +.mypy_cache/ +.coverage +htmlcov/ + +# IDE / 编辑器 +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# 本地配置 +.env +*.local diff --git a/src/fault_log_analyzer/__pycache__/__init__.cpython-310.pyc b/src/fault_log_analyzer/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 1e2ac98..0000000 Binary files a/src/fault_log_analyzer/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/src/fault_log_analyzer/__pycache__/api.cpython-310.pyc b/src/fault_log_analyzer/__pycache__/api.cpython-310.pyc deleted file mode 100644 index c14f5d4..0000000 Binary files a/src/fault_log_analyzer/__pycache__/api.cpython-310.pyc and /dev/null differ diff --git a/src/fault_log_analyzer/__pycache__/classifier.cpython-310.pyc b/src/fault_log_analyzer/__pycache__/classifier.cpython-310.pyc deleted file mode 100644 index 39da4af..0000000 Binary files a/src/fault_log_analyzer/__pycache__/classifier.cpython-310.pyc and /dev/null differ diff --git a/src/fault_log_analyzer/__pycache__/cluster.cpython-310.pyc b/src/fault_log_analyzer/__pycache__/cluster.cpython-310.pyc deleted file mode 100644 index 709977f..0000000 Binary files a/src/fault_log_analyzer/__pycache__/cluster.cpython-310.pyc and /dev/null differ diff --git a/src/fault_log_analyzer/__pycache__/config.cpython-310.pyc b/src/fault_log_analyzer/__pycache__/config.cpython-310.pyc deleted file mode 100644 index 2934e40..0000000 Binary files a/src/fault_log_analyzer/__pycache__/config.cpython-310.pyc and /dev/null differ diff --git a/src/fault_log_analyzer/__pycache__/filters.cpython-310.pyc b/src/fault_log_analyzer/__pycache__/filters.cpython-310.pyc deleted file mode 100644 index f060d4d..0000000 Binary files a/src/fault_log_analyzer/__pycache__/filters.cpython-310.pyc and /dev/null differ diff --git a/src/fault_log_analyzer/__pycache__/fingerprint.cpython-310.pyc b/src/fault_log_analyzer/__pycache__/fingerprint.cpython-310.pyc deleted file mode 100644 index 93e6204..0000000 Binary files a/src/fault_log_analyzer/__pycache__/fingerprint.cpython-310.pyc and /dev/null differ diff --git a/src/fault_log_analyzer/__pycache__/models.cpython-310.pyc b/src/fault_log_analyzer/__pycache__/models.cpython-310.pyc deleted file mode 100644 index 42d2481..0000000 Binary files a/src/fault_log_analyzer/__pycache__/models.cpython-310.pyc and /dev/null differ diff --git a/src/fault_log_analyzer/__pycache__/parser.cpython-310.pyc b/src/fault_log_analyzer/__pycache__/parser.cpython-310.pyc deleted file mode 100644 index c123b24..0000000 Binary files a/src/fault_log_analyzer/__pycache__/parser.cpython-310.pyc and /dev/null differ diff --git a/src/fault_log_analyzer/__pycache__/pipeline.cpython-310.pyc b/src/fault_log_analyzer/__pycache__/pipeline.cpython-310.pyc deleted file mode 100644 index 3e030db..0000000 Binary files a/src/fault_log_analyzer/__pycache__/pipeline.cpython-310.pyc and /dev/null differ diff --git a/src/fault_log_analyzer/__pycache__/root_cause.cpython-310.pyc b/src/fault_log_analyzer/__pycache__/root_cause.cpython-310.pyc deleted file mode 100644 index 38a66f2..0000000 Binary files a/src/fault_log_analyzer/__pycache__/root_cause.cpython-310.pyc and /dev/null differ diff --git a/src/fault_log_analyzer/__pycache__/storage.cpython-310.pyc b/src/fault_log_analyzer/__pycache__/storage.cpython-310.pyc deleted file mode 100644 index 1c948a4..0000000 Binary files a/src/fault_log_analyzer/__pycache__/storage.cpython-310.pyc and /dev/null differ diff --git a/src/fault_log_analyzer/__pycache__/workers.cpython-310.pyc b/src/fault_log_analyzer/__pycache__/workers.cpython-310.pyc deleted file mode 100644 index ab91a57..0000000 Binary files a/src/fault_log_analyzer/__pycache__/workers.cpython-310.pyc and /dev/null differ diff --git a/src/fault_log_analyzer/api.py b/src/fault_log_analyzer/api.py index 845e8ef..6f9d492 100644 --- a/src/fault_log_analyzer/api.py +++ b/src/fault_log_analyzer/api.py @@ -30,7 +30,7 @@ class _JsonHandler(BaseHTTPRequestHandler): filter_rule_repo: FilterRuleRepository # -- 基础工具 --------------------------------------------------------- - def _send_json(self, code: int, payload: dict, status: int = 200) -> None: + def _send_json(self, payload: dict, status: int = 200) -> None: body = json.dumps(payload, ensure_ascii=False).encode("utf-8") self.send_response(status) self.send_header("Content-Type", "application/json; charset=utf-8") @@ -39,10 +39,10 @@ class _JsonHandler(BaseHTTPRequestHandler): self.wfile.write(body) def _ok(self, data) -> None: - self._send_json(200, {"code": 0, "message": "ok", "data": data}) + self._send_json({"code": 0, "message": "ok", "data": data}) def _error(self, code: int, message: str, status: int = 400) -> None: - self._send_json(status, {"code": code, "message": message, "data": None}) + self._send_json({"code": code, "message": message, "data": None}, status) def _read_body(self) -> dict: length = int(self.headers.get("Content-Length", "0") or "0") diff --git a/tests/__pycache__/__init__.cpython-310.pyc b/tests/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 4205cf8..0000000 Binary files a/tests/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/tests/__pycache__/_bootstrap.cpython-310.pyc b/tests/__pycache__/_bootstrap.cpython-310.pyc deleted file mode 100644 index 71526cf..0000000 Binary files a/tests/__pycache__/_bootstrap.cpython-310.pyc and /dev/null differ diff --git a/tests/__pycache__/test_api.cpython-310.pyc b/tests/__pycache__/test_api.cpython-310.pyc deleted file mode 100644 index 932bc02..0000000 Binary files a/tests/__pycache__/test_api.cpython-310.pyc and /dev/null differ diff --git a/tests/__pycache__/test_classifier.cpython-310.pyc b/tests/__pycache__/test_classifier.cpython-310.pyc deleted file mode 100644 index a2d0844..0000000 Binary files a/tests/__pycache__/test_classifier.cpython-310.pyc and /dev/null differ diff --git a/tests/__pycache__/test_cluster.cpython-310.pyc b/tests/__pycache__/test_cluster.cpython-310.pyc deleted file mode 100644 index 6110c7b..0000000 Binary files a/tests/__pycache__/test_cluster.cpython-310.pyc and /dev/null differ diff --git a/tests/__pycache__/test_config.cpython-310.pyc b/tests/__pycache__/test_config.cpython-310.pyc deleted file mode 100644 index a1bac8d..0000000 Binary files a/tests/__pycache__/test_config.cpython-310.pyc and /dev/null differ diff --git a/tests/__pycache__/test_filters.cpython-310.pyc b/tests/__pycache__/test_filters.cpython-310.pyc deleted file mode 100644 index d5fb0de..0000000 Binary files a/tests/__pycache__/test_filters.cpython-310.pyc and /dev/null differ diff --git a/tests/__pycache__/test_fingerprint.cpython-310.pyc b/tests/__pycache__/test_fingerprint.cpython-310.pyc deleted file mode 100644 index 6101053..0000000 Binary files a/tests/__pycache__/test_fingerprint.cpython-310.pyc and /dev/null differ diff --git a/tests/__pycache__/test_models.cpython-310.pyc b/tests/__pycache__/test_models.cpython-310.pyc deleted file mode 100644 index fd21e20..0000000 Binary files a/tests/__pycache__/test_models.cpython-310.pyc and /dev/null differ diff --git a/tests/__pycache__/test_parser.cpython-310.pyc b/tests/__pycache__/test_parser.cpython-310.pyc deleted file mode 100644 index a58b64d..0000000 Binary files a/tests/__pycache__/test_parser.cpython-310.pyc and /dev/null differ diff --git a/tests/__pycache__/test_pipeline.cpython-310.pyc b/tests/__pycache__/test_pipeline.cpython-310.pyc deleted file mode 100644 index ef9b2c0..0000000 Binary files a/tests/__pycache__/test_pipeline.cpython-310.pyc and /dev/null differ diff --git a/tests/__pycache__/test_root_cause.cpython-310.pyc b/tests/__pycache__/test_root_cause.cpython-310.pyc deleted file mode 100644 index 0daf118..0000000 Binary files a/tests/__pycache__/test_root_cause.cpython-310.pyc and /dev/null differ diff --git a/tests/__pycache__/test_storage.cpython-310.pyc b/tests/__pycache__/test_storage.cpython-310.pyc deleted file mode 100644 index 4f0ca16..0000000 Binary files a/tests/__pycache__/test_storage.cpython-310.pyc and /dev/null differ diff --git a/tests/__pycache__/test_workers.cpython-310.pyc b/tests/__pycache__/test_workers.cpython-310.pyc deleted file mode 100644 index f983574..0000000 Binary files a/tests/__pycache__/test_workers.cpython-310.pyc and /dev/null differ