mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-03 09:10:11 +03:00
style: remove unused noqa directives
This commit is contained in:
parent
eb3ce3804d
commit
9e5ab02147
@ -391,10 +391,10 @@ def create_pre_model_hook(
|
||||
max_tokens_for_trim = max_input_tokens - tool_tokens
|
||||
|
||||
# Validate budget and provide actionable warnings
|
||||
if system_tokens + tool_tokens > max_input_tokens: # noqa: E501
|
||||
if system_tokens + tool_tokens > max_input_tokens:
|
||||
logger.error(
|
||||
"System prompt (%d tokens) + tools (%d tokens) EXCEED input "
|
||||
"budget (%d tokens). This will likely cause LLM call failures. " # noqa: E501
|
||||
"budget (%d tokens). This will likely cause LLM call failures. "
|
||||
"Recommendations: 1) Reduce system prompt length, 2) Reduce "
|
||||
"number of tools, 3) Use a model with larger context window, "
|
||||
"or 4) Switch to 'conservative' strategy.",
|
||||
|
||||
@ -57,7 +57,7 @@ from gns3server.agent.gns3_copilot.utils.command_filter import (
|
||||
# Import custom Netmiko device types for GNS3 emulation
|
||||
# This registers gns3_huawei_telnet_ce and other custom device types
|
||||
# NOTE: Must be imported BEFORE any Nornir operations to ensure device types are registered
|
||||
from gns3server.agent.gns3_copilot.utils import custom_netmiko # noqa: F401
|
||||
from gns3server.agent.gns3_copilot.utils import custom_netmiko
|
||||
|
||||
# Explicitly register custom device types to ensure they are available
|
||||
# This is a safety measure in case the auto-registration on import doesn't work
|
||||
|
||||
@ -57,7 +57,7 @@ from gns3server.agent.gns3_copilot.utils.command_filter import (
|
||||
# Import custom Netmiko device types for GNS3 emulation
|
||||
# This registers gns3_huawei_telnet_ce and other custom device types
|
||||
# NOTE: Must be imported BEFORE any Nornir operations to ensure device types are registered
|
||||
from gns3server.agent.gns3_copilot.utils import custom_netmiko # noqa: F401
|
||||
from gns3server.agent.gns3_copilot.utils import custom_netmiko
|
||||
|
||||
# Explicitly register custom device types to ensure they are available
|
||||
# This is a safety measure in case the auto-registration on import doesn't work
|
||||
|
||||
@ -54,7 +54,7 @@ from gns3server.agent.gns3_copilot.utils import get_device_ports_from_topology
|
||||
# Import custom Netmiko device types for GNS3 emulation
|
||||
# This registers gns3_vpcs_telnet and other custom device types
|
||||
# NOTE: Must be imported BEFORE any Nornir operations to ensure device types are registered
|
||||
from gns3server.agent.gns3_copilot.utils import custom_netmiko # noqa: F401
|
||||
from gns3server.agent.gns3_copilot.utils import custom_netmiko
|
||||
|
||||
# Explicitly register VPCS device type to ensure it is available
|
||||
try:
|
||||
|
||||
@ -61,17 +61,17 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
# Import all custom drivers (auto-registers them with Netmiko)
|
||||
try:
|
||||
from . import huawei_ce # noqa: F401
|
||||
from . import huawei_ce
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to import Huawei CE driver: {e}", exc_info=True)
|
||||
|
||||
try:
|
||||
from .ruijie_telnet import RuijieTelnetEnhanced # noqa: F401
|
||||
from .ruijie_telnet import RuijieTelnetEnhanced
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to import Ruijie driver: {e}", exc_info=True)
|
||||
|
||||
try:
|
||||
from . import vpcs_telnet # noqa: F401
|
||||
from . import vpcs_telnet
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to import VPCS driver: {e}", exc_info=True)
|
||||
|
||||
|
||||
@ -157,7 +157,7 @@ class TestHuaweiTelnetCEIntegration(unittest.TestCase):
|
||||
|
||||
def test_mock_telnet_connection(self):
|
||||
"""Test telnet_login logic with mocked connection."""
|
||||
from gns3server.agent.gns3_copilot.utils.custom_netmiko.huawei_ce import ( # noqa: E501
|
||||
from gns3server.agent.gns3_copilot.utils.custom_netmiko.huawei_ce import (
|
||||
GNS3HuaweiTelnetCE,
|
||||
)
|
||||
|
||||
|
||||
@ -178,7 +178,7 @@ class TestRuijieTelnetEnhancedIntegration(unittest.TestCase):
|
||||
|
||||
def test_send_config_set_calls_preprocess(self):
|
||||
"""Test that send_config_set calls preprocessing."""
|
||||
from gns3server.agent.gns3_copilot.utils.custom_netmiko.ruijie_telnet import ( # noqa: E501
|
||||
from gns3server.agent.gns3_copilot.utils.custom_netmiko.ruijie_telnet import (
|
||||
RuijieTelnetEnhanced,
|
||||
)
|
||||
|
||||
@ -205,7 +205,7 @@ class TestRuijieTelnetEnhancedIntegration(unittest.TestCase):
|
||||
|
||||
def test_multiple_interactive_patterns(self):
|
||||
"""Test that multiple interactive commands are detected."""
|
||||
from gns3server.agent.gns3_copilot.utils.custom_netmiko.ruijie_telnet import ( # noqa: E501
|
||||
from gns3server.agent.gns3_copilot.utils.custom_netmiko.ruijie_telnet import (
|
||||
RuijieTelnetEnhanced,
|
||||
)
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@ class TestVPCSTelnetInit(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
"""Set up test fixtures."""
|
||||
from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import ( # noqa: E501
|
||||
from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import (
|
||||
VPCSTelnet,
|
||||
)
|
||||
|
||||
@ -165,7 +165,7 @@ class TestVPCSTelnetMethods(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
"""Set up test fixtures."""
|
||||
from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import ( # noqa: E501
|
||||
from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import (
|
||||
VPCSTelnet,
|
||||
)
|
||||
|
||||
@ -208,7 +208,7 @@ class TestVPCSTelnetSendCommand(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
"""Set up test fixtures."""
|
||||
from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import ( # noqa: E501
|
||||
from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import (
|
||||
VPCSTelnet,
|
||||
)
|
||||
|
||||
@ -273,7 +273,7 @@ class TestVPCSTelnetTelnetLogin(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
"""Set up test fixtures."""
|
||||
from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import ( # noqa: E501
|
||||
from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import (
|
||||
VPCSTelnet,
|
||||
)
|
||||
|
||||
@ -353,7 +353,7 @@ class TestVPCSTelnetAnsiStripping(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
"""Set up test fixtures."""
|
||||
from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import ( # noqa: E501
|
||||
from gns3server.agent.gns3_copilot.utils.custom_netmiko.vpcs_telnet import (
|
||||
VPCSTelnet,
|
||||
)
|
||||
|
||||
|
||||
@ -238,7 +238,7 @@ def generate_ellipse_svg(
|
||||
svg_height: int,
|
||||
) -> str:
|
||||
"""Generate SVG for ellipse."""
|
||||
return f"""<svg width="{svg_width}" height="{svg_height}"><ellipse cx="{rx}" cy="{ry}" rx="{rx}" ry="{ry}" fill="{color_scheme["fill"]}" fill-opacity="{color_scheme["fill_opacity"]}"/></svg>""" # noqa: E501
|
||||
return f"""<svg width="{svg_width}" height="{svg_height}"><ellipse cx="{rx}" cy="{ry}" rx="{rx}" ry="{ry}" fill="{color_scheme["fill"]}" fill-opacity="{color_scheme["fill_opacity"]}"/></svg>"""
|
||||
|
||||
|
||||
def generate_rectangle_svg(
|
||||
@ -247,7 +247,7 @@ def generate_rectangle_svg(
|
||||
color_scheme: dict[str, Any],
|
||||
) -> str:
|
||||
"""Generate SVG for rectangle."""
|
||||
return f"""<svg width="{width}" height="{height}"><rect x="0" y="0" width="{width}" height="{height}" fill="{color_scheme["fill"]}" fill-opacity="{color_scheme["fill_opacity"]}"/></svg>""" # noqa: E501
|
||||
return f"""<svg width="{width}" height="{height}"><rect x="0" y="0" width="{width}" height="{height}" fill="{color_scheme["fill"]}" fill-opacity="{color_scheme["fill_opacity"]}"/></svg>"""
|
||||
|
||||
|
||||
def generate_text_svg(text: str, color_scheme: dict[str, Any]) -> str:
|
||||
@ -255,7 +255,7 @@ def generate_text_svg(text: str, color_scheme: dict[str, Any]) -> str:
|
||||
text_width = len(text) * 8 + 20
|
||||
text_height = DEFAULT_FONT_SIZE + 16
|
||||
|
||||
return f"""<svg width="{text_width}" height="{text_height}"><text font-family="TypeWriter" font-size="{DEFAULT_FONT_SIZE}.0" font-weight="bold" fill="{color_scheme["stroke"]}" text-anchor="middle" x="{text_width / 2}" y="{text_height / 2 + 4}">{text}</text></svg>""" # noqa: E501
|
||||
return f"""<svg width="{text_width}" height="{text_height}"><text font-family="TypeWriter" font-size="{DEFAULT_FONT_SIZE}.0" font-weight="bold" fill="{color_scheme["stroke"]}" text-anchor="middle" x="{text_width / 2}" y="{text_height / 2 + 4}">{text}</text></svg>"""
|
||||
|
||||
|
||||
def _hsv_to_hex(h: int, s: int, v: int) -> str:
|
||||
|
||||
@ -64,7 +64,7 @@ def _load_netmiko_device_types() -> schemas.NetmikoDeviceTypeList:
|
||||
# imported them yet); failures are logged by the package itself, do not
|
||||
# fail the whole endpoint.
|
||||
try:
|
||||
from gns3server.agent.gns3_copilot.utils import custom_netmiko # noqa: F401
|
||||
from gns3server.agent.gns3_copilot.utils import custom_netmiko
|
||||
except Exception as e:
|
||||
log.warning(f"Could not register GNS3-copilot custom Netmiko drivers: {e}")
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user