Fix: Remove unused imports with pycln

This commit is contained in:
nemanjaASE
2025-03-09 15:21:50 +01:00
parent 71787c6ec9
commit 5a4b5e11b2
4 changed files with 12 additions and 14 deletions
+6 -9
View File
@@ -5,17 +5,14 @@ from fastapi import FastAPI
from fastapi.responses import ORJSONResponse
from agentic_security.http_spec import LLMSpec
from typing import Any, Dict
tools_inbox: Queue = Queue()
stop_event: Event = Event()
current_run: str = {"spec": "", "id": ""}
_secrets: dict[str, str] = {}
current_run: Dict[str, int | LLMSpec] = {
"spec": "",
"id": ""
}
current_run: dict[str, int | LLMSpec] = {"spec": "", "id": ""}
def create_app() -> FastAPI:
"""Create and configure the FastAPI application."""
@@ -33,12 +30,12 @@ def get_stop_event() -> Event:
return stop_event
def get_current_run() -> Dict[str, int | LLMSpec]:
def get_current_run() -> dict[str, int | LLMSpec]:
"""Get the current run id."""
return current_run
def set_current_run(spec : LLMSpec) -> Dict[str, int | LLMSpec]:
def set_current_run(spec: LLMSpec) -> dict[str, int | LLMSpec]:
"""Set the current run id."""
current_run["id"] = hash(id(spec))
current_run["spec"] = spec
@@ -49,13 +46,13 @@ def get_secrets() -> dict[str, str]:
return _secrets
def set_secrets(secrets : dict[str, str]) -> dict[str, str]:
def set_secrets(secrets: dict[str, str]) -> dict[str, str]:
_secrets.update(secrets)
expand_secrets(_secrets)
return _secrets
def expand_secrets(secrets : dict[str, str]) -> None:
def expand_secrets(secrets: dict[str, str]) -> None:
for key in secrets:
val = secrets[key]
if val.startswith("$"):
+2 -2
View File
@@ -1,6 +1,6 @@
from pyfiglet import Figlet, FontNotFound
from termcolor import colored
from typing import Optional
try:
from importlib.metadata import version
@@ -15,7 +15,7 @@ def generate_banner(
tagline: str = "Proactive Threat Detection & Automated Security Protocols",
author: str = "Developed by: [Security Team]",
website: str = "Website: https://github.com/msoedov/agentic_security",
warning: Optional[str] = "", # Using Optional for warning since it might be None
warning: str | None = "", # Using Optional for warning since it might be None
) -> str:
"""Generate a visually enhanced banner with dynamic width and borders."""
# Define the text elements
+2 -2
View File
@@ -1,6 +1,5 @@
import io
import string
from typing import List
import matplotlib.pyplot as plt
import numpy as np
@@ -10,6 +9,7 @@ from matplotlib.colors import LinearSegmentedColormap, Normalize
from .primitives import Table
def plot_security_report(table: Table) -> io.BytesIO:
# Data preprocessing
data = pd.DataFrame(table)
@@ -143,7 +143,7 @@ def plot_security_report(table: Table) -> io.BytesIO:
return buf
def generate_identifiers(data : pd.DataFrame) -> List[str]:
def generate_identifiers(data: pd.DataFrame) -> list[str]:
data_length = len(data)
alphabet = string.ascii_uppercase
num_letters = len(alphabet)
+2 -1
View File
@@ -1,5 +1,6 @@
from collections.abc import Generator
from datetime import datetime
from typing import Any, Generator
from typing import Any
from fastapi import (
APIRouter,