MAESTRO: fix linting and formatting

This commit is contained in:
Mariusz Banach
2026-02-18 04:55:03 +01:00
parent af339e784e
commit 930495cd00
13 changed files with 22 additions and 29 deletions

View File

@@ -68,9 +68,7 @@ class Settings(BaseSettings):
parsed = json.loads(text)
if isinstance(parsed, list):
return [
str(item).strip()
for item in parsed
if str(item).strip()
str(item).strip() for item in parsed if str(item).strip()
]
except json.JSONDecodeError:
pass

View File

@@ -114,9 +114,7 @@ class Logger:
colored = colorizingFunc(c, txt)
if not colored:
raise ValueError(
f"Could not strip colors from phrase: ({patt})!"
)
raise ValueError(f"Could not strip colors from phrase: ({patt})!")
s = s.replace(patt, colored)
pos = 0

View File

@@ -1,2 +1 @@
"""Scanner implementations grouped by vendor or function."""

View File

@@ -189,7 +189,7 @@ def _normalize_payload(payload: object) -> tuple[str, str, str, str] | None:
def _combine_payloads(
payloads: list[tuple[str, str, str, str]]
payloads: list[tuple[str, str, str, str]],
) -> tuple[str, str, str, str]:
headers: list[str] = []
values: list[str] = []

View File

@@ -79,9 +79,7 @@ async def analyse(request: Request) -> StreamingResponse:
)
if len(headers) > MAX_HEADERS_LENGTH:
return JSONResponse(
status_code=413, content={"error": "Headers exceed 1 MB"}
)
return JSONResponse(status_code=413, content={"error": "Headers exceed 1 MB"})
headers = _sanitize_headers(headers)
if not headers.strip():
@@ -120,9 +118,7 @@ async def analyse(request: Request) -> StreamingResponse:
elapsed_ms = (perf_counter() - start) * 1000
percentage = 0.0
if total_tests > 0:
percentage = min(
100.0, (current_index + 1) / total_tests * 100.0
)
percentage = min(100.0, (current_index + 1) / total_tests * 100.0)
payload = AnalysisProgress(
current_index=current_index,
total_tests=total_tests,
@@ -168,9 +164,7 @@ async def analyse(request: Request) -> StreamingResponse:
),
)
await send_stream.send(
("result", final_result.model_dump(by_alias=True))
)
await send_stream.send(("result", final_result.model_dump(by_alias=True)))
await send_stream.send(("done", {}))
async def event_stream() -> Any:

View File

@@ -245,9 +245,7 @@ def _b64decode(data: str) -> bytes:
def _prune_challenges_locked() -> None:
now = time.time()
expired = [
token
for token, record in _CHALLENGES.items()
if record.expires_at <= now
token for token, record in _CHALLENGES.items() if record.expires_at <= now
]
for token in expired:
_CHALLENGES.pop(token, None)