mirror of
https://github.com/Strategic-Automation/violin.git
synced 2026-08-14 12:33:37 +02:00
style: format code with ruff
This commit is contained in:
@@ -3,11 +3,11 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Literal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from . import state
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Pydantic v2 Models
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -77,9 +77,7 @@ class RecordHypothesisArgsModel(BaseModel):
|
||||
" no-results/unavailable outcomes are allowed."
|
||||
),
|
||||
)
|
||||
test_command: str = Field(
|
||||
"", description="Exact syntax tested, including argument order"
|
||||
)
|
||||
test_command: str = Field("", description="Exact syntax tested, including argument order")
|
||||
test_response: str = Field("", description="Exact decisive response or error")
|
||||
verification_status: str = ""
|
||||
rejection_reason: str = Field(
|
||||
@@ -112,8 +110,7 @@ class ExecArgsModel(BaseModel):
|
||||
background: bool = Field(
|
||||
False,
|
||||
description=(
|
||||
"Run as a tracked background process; use status/cancel for lifecycle"
|
||||
" management"
|
||||
"Run as a tracked background process; use status/cancel for lifecycle management"
|
||||
),
|
||||
)
|
||||
|
||||
@@ -297,9 +294,7 @@ class TargetArgsModel(BaseModel):
|
||||
eng_dir: str = Field(
|
||||
..., description="engagement dir (required; target resolution is engagement-scoped)"
|
||||
)
|
||||
scope: str = Field(
|
||||
"", description="explicit scope.yaml path (else $ENG_DIR/scope/scope.yaml)"
|
||||
)
|
||||
scope: str = Field("", description="explicit scope.yaml path (else $ENG_DIR/scope/scope.yaml)")
|
||||
host: str = Field("", description="in-scope IP/CIDR to resolve")
|
||||
role: str = Field("", description="named role from scope.yaml targets.roles (e.g. web)")
|
||||
field: Literal["ip", "url", "host"] = Field("ip", description="what to print (default ip)")
|
||||
|
||||
@@ -8,7 +8,6 @@ from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
import re
|
||||
import shlex
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
@@ -198,9 +198,7 @@ def _has_target_literal_in_segment(seg: CommandSegment) -> bool:
|
||||
words = seg.words
|
||||
executable = seg.executable
|
||||
skip_code = (
|
||||
executable in _SCRIPT_INTERPRETERS
|
||||
and executable not in _SHELL_WRAPPERS
|
||||
and "-c" in words
|
||||
executable in _SCRIPT_INTERPRETERS and executable not in _SHELL_WRAPPERS and "-c" in words
|
||||
)
|
||||
c_index = words.index("-c") if skip_code else -1
|
||||
for index, word in enumerate(words):
|
||||
@@ -252,11 +250,7 @@ def _is_local_compilation_or_test(seg: CommandSegment) -> bool:
|
||||
"doctest",
|
||||
}:
|
||||
return True
|
||||
return (
|
||||
"py_compile" in seg.raw_text
|
||||
or "pytest" in lower_words
|
||||
or "unittest" in lower_words
|
||||
)
|
||||
return "py_compile" in seg.raw_text or "pytest" in lower_words or "unittest" in lower_words
|
||||
|
||||
|
||||
def _block_terminal_segment(seg: CommandSegment) -> str | None:
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"""Unit tests for bashlex AST parsing and terminal policy classification."""
|
||||
|
||||
import pytest
|
||||
|
||||
from plugins.violin_guard import bash_ast, terminal_policy
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user