style(acms): apply ruff format to fix CI lint format check failure

The CI lint job runs both ruff check and ruff format --check. The format
check was failing because 5 files had formatting inconsistencies. Applied
ruff format to fix the CI lint failure.

ISSUES CLOSED: #9584
This commit is contained in:
2026-05-04 22:07:10 +00:00
committed by Forgejo
parent 7faab96582
commit e023366858
4 changed files with 23 additions and 46 deletions
@@ -31,9 +31,7 @@ def step_have_loader(context: Any) -> None:
@given("I have a YAML configuration file with:")
def step_have_yaml_file(context: Any) -> None:
"""Create a temporary YAML configuration file."""
with tempfile.NamedTemporaryFile(
mode="w", suffix=".yaml", delete=False
) as tmp:
with tempfile.NamedTemporaryFile(mode="w", suffix=".yaml", delete=False) as tmp:
tmp.write(context.text)
context.config_path = tmp.name
@@ -41,9 +39,7 @@ def step_have_yaml_file(context: Any) -> None:
@given("I have a TOML configuration file with:")
def step_have_toml_file(context: Any) -> None:
"""Create a temporary TOML configuration file."""
with tempfile.NamedTemporaryFile(
mode="w", suffix=".toml", delete=False
) as tmp:
with tempfile.NamedTemporaryFile(mode="w", suffix=".toml", delete=False) as tmp:
tmp.write(context.text)
context.config_path = tmp.name
@@ -169,9 +165,7 @@ def step_check_file_not_found_error(context: Any) -> None:
@given("I have a configuration file with unsupported format {fmt}")
def step_have_unsupported_format(context: Any, fmt: str) -> None:
"""Create a file with unsupported format."""
with tempfile.NamedTemporaryFile(
mode="w", suffix=fmt, delete=False
) as tmp:
with tempfile.NamedTemporaryFile(mode="w", suffix=fmt, delete=False) as tmp:
tmp.write("{}")
context.config_path = tmp.name
@@ -239,8 +233,7 @@ def step_have_policy_config(context: Any) -> None:
context.policy_config = ViewPolicyConfiguration(
view_name=config_dict.get("view_name", "default"),
policies=[
ContextPolicyConfig(name=p["name"])
for p in config_dict.get("policies", [])
ContextPolicyConfig(name=p["name"]) for p in config_dict.get("policies", [])
],
)
@@ -345,7 +338,9 @@ def step_apply_policy(context: Any) -> None:
def step_check_assembled_budget(context: Any, budget: int) -> None:
"""Check the budget in the assembled context."""
# Support both direct assembler context and integration context
assembled = getattr(context, "assembled", None) or getattr(context, "llm_context", None)
assembled = getattr(context, "assembled", None) or getattr(
context, "llm_context", None
)
assert assembled is not None
assert assembled["assembled_data"].get("budget") == budget
@@ -368,7 +363,9 @@ def step_policy_disabled(context: Any) -> None:
def step_policy_not_applied(context: Any) -> None:
"""Check that the policy was not applied."""
# Support both direct assembler context and integration context
assembled = getattr(context, "assembled", None) or getattr(context, "llm_context", None)
assembled = getattr(context, "assembled", None) or getattr(
context, "llm_context", None
)
assert assembled is not None
assert "policy1" not in assembled.get("policies_applied", [])
@@ -402,7 +399,9 @@ def step_policy_multiple_scopes(context: Any) -> None:
context.policy_config.policies[0].scopes.append(scope)
@when("I apply the policy to context with multiple scopes: file_type {file_type} path {path}")
@when(
"I apply the policy to context with multiple scopes: file_type {file_type} path {path}"
)
def step_apply_policy_multiple_scopes(context: Any, file_type: str, path: str) -> None:
"""Apply policy to context with multiple scope values."""
context.test_context = {"file_type": file_type, "path": path}
@@ -35,9 +35,7 @@ def step_no_policy_config(context: Any) -> None:
@given("I have a policy configuration with {count:d} policy")
def step_have_policy_config(context: Any, count: int) -> None:
"""Create a policy configuration with specified number of policies."""
policies = [
ContextPolicyConfig(name=f"policy{i+1}") for i in range(count)
]
policies = [ContextPolicyConfig(name=f"policy{i + 1}") for i in range(count)]
context.policy_config = ViewPolicyConfiguration(
view_name="test_view",
policies=policies,
@@ -61,9 +59,7 @@ def step_have_raw_context(context: Any) -> None:
def step_prepare_llm_context(context: Any) -> None:
"""Prepare LLM context from raw context."""
context.raw_context = {"file_type": "python", "path": "src/module.py"}
context.llm_context = context.integration.prepare_llm_context(
context.raw_context
)
context.llm_context = context.integration.prepare_llm_context(context.raw_context)
@then("the LLM context should be the same as the raw context")
@@ -88,9 +84,7 @@ def step_have_policy_file(context: Any) -> None:
"view_name": "test_view",
"policies": [{"name": "policy1"}],
}
with tempfile.NamedTemporaryFile(
mode="w", suffix=".yaml", delete=False
) as tmp:
with tempfile.NamedTemporaryFile(mode="w", suffix=".yaml", delete=False) as tmp:
yaml.dump(config_data, tmp)
context.config_path = tmp.name
@@ -156,9 +150,7 @@ def step_load_toml_policy_string(context: Any) -> None:
@when("I prepare LLM context for plan execution")
def step_prepare_llm_context_plan(context: Any) -> None:
"""Prepare LLM context for plan execution."""
context.llm_context = context.integration.prepare_llm_context(
context.raw_context
)
context.llm_context = context.integration.prepare_llm_context(context.raw_context)
@then("the LLM context should include applied policies")
@@ -245,9 +237,7 @@ def step_scope_rule(context: Any, value: str) -> None:
def step_prepare_context_file_type(context: Any, file_type: str) -> None:
"""Prepare LLM context with specific file type."""
context.raw_context = {"file_type": file_type}
context.llm_context = context.integration.prepare_llm_context(
context.raw_context
)
context.llm_context = context.integration.prepare_llm_context(context.raw_context)
@then("the policy should be applied")