Refactor: reformat all code for lefthook using ruff and gofmt (#16585)

This commit is contained in:
Wang Qi
2026-07-03 12:53:39 +08:00
committed by GitHub
parent 19fcb4a981
commit 6a4b9be426
588 changed files with 11123 additions and 15412 deletions

View File

@@ -183,10 +183,7 @@ def test_load_user_api_token_fallback_and_fallback_exception(monkeypatch, caplog
return []
def _query_user(**kwargs):
if (
kwargs.get("id") == "tenant-1"
and kwargs.get("status") == apps_module.StatusEnum.VALID.value
):
if kwargs.get("id") == "tenant-1" and kwargs.get("status") == apps_module.StatusEnum.VALID.value:
return [beta_user]
return []

View File

@@ -122,9 +122,7 @@ def _load_system_module(monkeypatch):
monkeypatch.setitem(sys.modules, "api.db.services.knowledgebase_service", kb_service_mod)
user_service_mod = ModuleType("api.db.services.user_service")
user_service_mod.UserTenantService = SimpleNamespace(
query=lambda **_kwargs: [SimpleNamespace(role="owner", tenant_id="tenant-1")]
)
user_service_mod.UserTenantService = SimpleNamespace(query=lambda **_kwargs: [SimpleNamespace(role="owner", tenant_id="tenant-1")])
monkeypatch.setitem(sys.modules, "api.db.services.user_service", user_service_mod)
db_models_mod = ModuleType("api.db.db_models")
@@ -214,6 +212,7 @@ def test_status_branch_matrix_unit(monkeypatch):
assert "Lost connection!" in res["data"]["redis"]["error"]
assert res["data"]["task_executor_heartbeats"] == {}
@pytest.mark.p2
def test_get_config_returns_register_enabled_unit(monkeypatch):
module = _load_system_module(monkeypatch)