mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-25 11:22:26 +02:00
Merge pull request #2938 from markparonyan/ruff/pr02-unused-imports
Ruff/pr02 unused imports
This commit is contained in:
commit
38cc7cc0a0
@ -14,4 +14,4 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from .version import __version__
|
||||
from .version import __version__ as __version__
|
||||
|
||||
@ -66,6 +66,7 @@ __all__ = [
|
||||
"get_skill",
|
||||
"get_skills_manager",
|
||||
"get_skills_repository_info",
|
||||
"reload_forbidden_commands",
|
||||
"reload_injection_skills",
|
||||
"reload_skills_repository",
|
||||
"set_skills_manager",
|
||||
|
||||
@ -31,7 +31,6 @@ Supports loading injection skills and device/feature skills.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ from gns3server.agent.gns3_copilot.gns3_client import get_gns3_server_host
|
||||
# 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, get_device_ports_from_topology
|
||||
from gns3server.agent.gns3_copilot.utils import get_device_ports_from_topology
|
||||
from gns3server.agent.gns3_copilot.utils.command_filter import (
|
||||
filter_forbidden_commands,
|
||||
)
|
||||
|
||||
@ -51,7 +51,7 @@ from gns3server.agent.gns3_copilot.gns3_client import get_gns3_server_host
|
||||
# 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, get_device_ports_from_topology
|
||||
from gns3server.agent.gns3_copilot.utils import get_device_ports_from_topology
|
||||
from gns3server.agent.gns3_copilot.utils.command_filter import (
|
||||
filter_forbidden_commands,
|
||||
)
|
||||
|
||||
@ -51,7 +51,7 @@ from gns3server.agent.gns3_copilot.gns3_client import get_gns3_server_host
|
||||
# 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, get_device_ports_from_topology
|
||||
from gns3server.agent.gns3_copilot.utils import get_device_ports_from_topology
|
||||
|
||||
# Explicitly register VPCS device type to ensure it is available
|
||||
try:
|
||||
@ -585,7 +585,6 @@ class VPCSCommands(BaseTool):
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Example usage
|
||||
import sys
|
||||
|
||||
command_groups = json.dumps(
|
||||
{
|
||||
|
||||
@ -66,7 +66,7 @@ except Exception as e:
|
||||
logger.warning(f"Failed to import Huawei CE driver: {e}", exc_info=True)
|
||||
|
||||
try:
|
||||
from .ruijie_telnet import RuijieTelnetEnhanced
|
||||
from .ruijie_telnet import RuijieTelnetEnhanced as RuijieTelnetEnhanced
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to import Ruijie driver: {e}", exc_info=True)
|
||||
|
||||
|
||||
@ -426,7 +426,6 @@ IP/MASK : 192.168.1.20/24"""
|
||||
|
||||
def test_send_command_calls_strip_ansi(self):
|
||||
"""Test that send_command calls _strip_ansi_codes."""
|
||||
from unittest.mock import patch
|
||||
|
||||
instance = self.VPCSTelnet.__new__(self.VPCSTelnet)
|
||||
|
||||
|
||||
@ -41,10 +41,8 @@ from fastapi.responses import Response
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
from mcp.server.transport_security import TransportSecuritySettings
|
||||
from pydantic import Field
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server.agent.gns3_copilot.gns3_client.api_handlers import (
|
||||
available_filters_handler,
|
||||
create_link_handler,
|
||||
@ -80,10 +78,11 @@ from gns3server.agent.gns3_copilot.gns3_client.api_handlers import (
|
||||
write_node_file_handler,
|
||||
)
|
||||
from gns3server.config import Config
|
||||
from gns3server.db import models as models
|
||||
from gns3server.db.repositories.api_keys import ApiKeysRepository
|
||||
from gns3server.db.repositories.users import UsersRepository
|
||||
from gns3server.services import auth_service
|
||||
from gns3server.services.authentication import AuthService
|
||||
from gns3server.services.authentication import AuthService as AuthService
|
||||
from gns3server.utils.request_utils import extract_client_info
|
||||
|
||||
# Symbol tools are disabled for now: they require a vision-capable model to
|
||||
|
||||
@ -73,7 +73,6 @@ import json
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from typing import Optional
|
||||
|
||||
from gns3server.utils.uuid_validator import validate_uuid
|
||||
|
||||
|
||||
@ -19,26 +19,22 @@
|
||||
API routes for compute.
|
||||
"""
|
||||
|
||||
import os
|
||||
from functools import lru_cache
|
||||
from typing import List, Optional
|
||||
from typing import List
|
||||
from uuid import UUID
|
||||
|
||||
import cpuinfo
|
||||
import psutil
|
||||
from fastapi import APIRouter, Body, HTTPException, Response, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi import APIRouter, HTTPException, status
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.port_manager import PortManager
|
||||
from gns3server.compute.project_manager import ProjectManager
|
||||
from gns3server.compute.qemu import Qemu
|
||||
from gns3server.compute.virtualbox import VirtualBox
|
||||
from gns3server.compute.vmware import VMware
|
||||
from gns3server.config import Config
|
||||
from gns3server.utils.cpu_percent import CpuPercent
|
||||
from gns3server.utils.interfaces import interfaces
|
||||
from gns3server.utils.path import get_default_project_directory, is_safe_path
|
||||
from gns3server.utils.path import get_default_project_directory
|
||||
from gns3server.version import __version__
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@ -22,7 +22,7 @@ import os
|
||||
import urllib.parse
|
||||
from typing import List
|
||||
|
||||
from fastapi import APIRouter, Body, HTTPException, Request, Response, status
|
||||
from fastapi import APIRouter, Body, HTTPException, Request, status
|
||||
from fastapi.responses import FileResponse
|
||||
|
||||
from gns3server.compute.docker import Docker
|
||||
|
||||
@ -30,12 +30,11 @@ log = logging.getLogger()
|
||||
from typing import List
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query, Request, Response, status
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query, Request, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import FileResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.base_manager import BaseManager
|
||||
from gns3server.compute.project import Project
|
||||
from gns3server.compute.project_manager import ProjectManager
|
||||
from gns3server.utils.path import is_safe_path
|
||||
|
||||
@ -28,7 +28,6 @@ from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute import qemu
|
||||
from gns3server.compute.qemu import Qemu
|
||||
from gns3server.compute.qemu.qemu_vm import QemuVM
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ import logging
|
||||
import os
|
||||
import signal
|
||||
import time
|
||||
from typing import Dict, List
|
||||
from typing import Dict
|
||||
|
||||
import psutil
|
||||
from fastapi import APIRouter, Depends, FastAPI, Request, WebSocket, WebSocketDisconnect, status
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
API routes for links.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
from typing import Any, List, Union
|
||||
|
||||
@ -63,7 +63,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
|
||||
pass
|
||||
except Exception as e:
|
||||
log.warning(f"Could not register GNS3-copilot custom Netmiko drivers: {e}")
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ log = logging.getLogger(__name__)
|
||||
from typing import Any, List, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query, Request, Response, status
|
||||
from fastapi import APIRouter, Depends, Query, Request, Response, status
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.controller import Controller
|
||||
|
||||
@ -23,7 +23,7 @@ import logging
|
||||
from typing import List, Optional
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Response, status
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
from fastapi.security import OAuth2PasswordRequestForm
|
||||
|
||||
import gns3server.db.models as models
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from ...base_node import BaseNode
|
||||
|
||||
@ -39,14 +39,13 @@ from gns3server.utils.asyncio import monitor_process, wait_for_file_creation, wa
|
||||
from gns3server.utils.asyncio.raw_command_server import AsyncioRawCommandServer
|
||||
from gns3server.utils.asyncio.ssh_server import AsyncioSSHServer
|
||||
from gns3server.utils.asyncio.telnet_server import AsyncioTelnetServer
|
||||
from gns3server.utils.get_resource import get_resource
|
||||
from gns3server.utils.hostname import is_rfc1123_hostname_valid
|
||||
|
||||
from ..adapters.ethernet_adapter import EthernetAdapter
|
||||
from ..base_node import BaseNode
|
||||
from ..error import ImageMissingError
|
||||
from ..nios.nio_udp import NIOUDP
|
||||
from .docker_error import DockerError, DockerHttp304Error, DockerHttp404Error, DockerHttp409Error
|
||||
from .docker_error import DockerError, DockerHttp404Error, DockerHttp409Error
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -48,7 +48,6 @@ import shutil
|
||||
|
||||
from gns3server.compute.adapters.ethernet_adapter import EthernetAdapter
|
||||
from gns3server.compute.docker.docker_error import DockerError, DockerHttp404Error
|
||||
from gns3server.compute.docker.docker_vm import DockerVM
|
||||
from gns3server.compute.docker.vendor_docker_vm import VendorDockerVM
|
||||
from gns3server.compute.iou.utils.iou_export import nvram_export
|
||||
from gns3server.compute.iou.utils.iou_import import nvram_import
|
||||
|
||||
@ -22,7 +22,6 @@ import asyncio
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from gns3server.utils.asyncio import wait_for_process_termination
|
||||
|
||||
|
||||
@ -19,7 +19,6 @@ Base interface for Dynamips Network Input/Output (NIO) module ("nio").
|
||||
http://github.com/GNS3/dynamips/blob/master/README.hypervisor#L451
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from ..dynamips_error import DynamipsError
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
Interface for generic Ethernet NIOs (PCAP library).
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import uuid
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
Interface for Linux Ethernet NIOs (Linux only).
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import uuid
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
Interface for dummy NIOs (mostly for tests).
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import uuid
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
Interface for TAP NIOs (UNIX based OSes only).
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import uuid
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
Interface for UDP NIOs.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import uuid
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
Interface for UNIX NIOs (Unix based OSes only).
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import uuid
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
Interface for VDE (Virtual Distributed Ethernet) NIOs (Unix based OSes only).
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import uuid
|
||||
|
||||
|
||||
@ -19,7 +19,6 @@ Interface for Dynamips virtual ATM switch module ("atmsw").
|
||||
http://github.com/GNS3/dynamips/blob/master/README.hypervisor#L593
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import re
|
||||
|
||||
|
||||
@ -19,8 +19,6 @@ Interface for Dynamips NIO bridge module ("nio_bridge").
|
||||
http://github.com/GNS3/dynamips/blob/master/README.hypervisor#L538
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
|
||||
from .device import Device
|
||||
|
||||
|
||||
|
||||
@ -19,7 +19,6 @@ Interface for Dynamips virtual Cisco 1700 instances module ("c1700")
|
||||
http://github.com/GNS3/dynamips/blob/master/README.hypervisor#L428
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from ..adapters.c1700_mb_1fe import C1700_MB_1FE
|
||||
|
||||
@ -19,7 +19,6 @@ Interface for Dynamips virtual Cisco 2600 instances module ("c2600")
|
||||
http://github.com/GNS3/dynamips/blob/master/README.hypervisor#L404
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from ..adapters.c2600_mb_1e import C2600_MB_1E
|
||||
|
||||
@ -19,7 +19,6 @@ Interface for Dynamips virtual Cisco 2691 instances module ("c2691")
|
||||
http://github.com/GNS3/dynamips/blob/master/README.hypervisor#L387
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from ..adapters.gt96100_fe import GT96100_FE
|
||||
|
||||
@ -19,7 +19,6 @@ Interface for Dynamips virtual Cisco 3600 instances module ("c3600")
|
||||
http://github.com/GNS3/dynamips/blob/master/README.hypervisor#L366
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from ..adapters.leopard_2fe import Leopard_2FE
|
||||
|
||||
@ -19,7 +19,6 @@ Interface for Dynamips virtual Cisco 3725 instances module ("c3725")
|
||||
http://github.com/GNS3/dynamips/blob/master/README.hypervisor#L346
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from ..adapters.gt96100_fe import GT96100_FE
|
||||
|
||||
@ -19,7 +19,6 @@ Interface for Dynamips virtual Cisco 3745 instances module ("c3745")
|
||||
http://github.com/GNS3/dynamips/blob/master/README.hypervisor#L326
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from ..adapters.gt96100_fe import GT96100_FE
|
||||
|
||||
@ -19,7 +19,6 @@ Interface for Dynamips virtual Cisco 7200 instances module ("c7200")
|
||||
http://github.com/GNS3/dynamips/blob/master/README.hypervisor#L294
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from ..adapters.c7200_io_fe import C7200_IO_FE
|
||||
|
||||
@ -19,7 +19,6 @@ Interface for Dynamips virtual Ethernet switch module ("ethsw").
|
||||
http://github.com/GNS3/dynamips/blob/master/README.hypervisor#L558
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from gns3server.utils import parse_version
|
||||
|
||||
@ -19,7 +19,6 @@ Interface for Dynamips virtual Frame-Relay switch module.
|
||||
http://github.com/GNS3/dynamips/blob/master/README.hypervisor#L642
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from ..dynamips_error import DynamipsError
|
||||
|
||||
@ -27,7 +27,6 @@ import logging
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
import time
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -23,7 +23,7 @@ import logging
|
||||
import os
|
||||
|
||||
from ..base_manager import BaseManager
|
||||
from .iou_error import IOUError
|
||||
from .iou_error import IOUError as IOUError
|
||||
from .iou_vm import IOUVM
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -27,7 +27,6 @@ from fastapi import HTTPException, status
|
||||
|
||||
from gns3server.compute.compute_error import ComputeError, ComputeForbiddenError, ComputeNotFoundError
|
||||
|
||||
from ..config import Config
|
||||
from ..utils.asyncio import wait_run_in_executor
|
||||
from ..utils.path import check_path_allowed, get_default_project_directory
|
||||
from .notification_manager import NotificationManager
|
||||
|
||||
@ -25,7 +25,6 @@ import os
|
||||
import re
|
||||
import shlex
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import uuid
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
VPCS server module.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
|
||||
from ..base_manager import BaseManager
|
||||
|
||||
@ -40,7 +40,7 @@ from ..utils import md5sum, parse_version
|
||||
from ..utils.asyncio import wait_run_in_executor
|
||||
from ..utils.images import default_images_directory
|
||||
from ..version import __version__
|
||||
from .appliance import Appliance
|
||||
from .appliance import Appliance as Appliance
|
||||
from .appliance_manager import ApplianceManager
|
||||
from .compute import Compute, ComputeError
|
||||
from .controller_error import ControllerError, ControllerNotFoundError
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from gns3server.utils.packet_filter_validation import FilterValidationError, validate_bpf_syntax
|
||||
from gns3server.utils.packet_filter_validation import validate_bpf_syntax
|
||||
|
||||
from .controller_error import ControllerError, ControllerNotFoundError
|
||||
from .link import _UNSET, Link
|
||||
|
||||
@ -38,3 +38,30 @@ from .templates import (
|
||||
VPCSTemplate,
|
||||
)
|
||||
from .users import User, UserGroup
|
||||
|
||||
__all__ = [
|
||||
"ACE",
|
||||
"ApiKey",
|
||||
"Base",
|
||||
"CloudTemplate",
|
||||
"Compute",
|
||||
"DockerTemplate",
|
||||
"DynamipsTemplate",
|
||||
"EthernetHubTemplate",
|
||||
"EthernetSwitchTemplate",
|
||||
"IOUTemplate",
|
||||
"Image",
|
||||
"ImageSyncJob",
|
||||
"LLMModelConfig",
|
||||
"Privilege",
|
||||
"QemuTemplate",
|
||||
"Resource",
|
||||
"ResourcePool",
|
||||
"Role",
|
||||
"Template",
|
||||
"User",
|
||||
"UserGroup",
|
||||
"VMwareTemplate",
|
||||
"VPCSTemplate",
|
||||
"VirtualBoxTemplate",
|
||||
]
|
||||
|
||||
@ -15,14 +15,12 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
from datetime import datetime, timezone
|
||||
from typing import List, Optional, cast
|
||||
from uuid import UUID
|
||||
|
||||
from sqlalchemy import delete, func, select, update
|
||||
from sqlalchemy.engine import CursorResult
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy.orm import selectinload
|
||||
|
||||
import gns3server.db.models as models
|
||||
|
||||
|
||||
@ -28,7 +28,6 @@ from sqlalchemy.orm import selectinload
|
||||
from sqlalchemy.orm.session import make_transient
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server import schemas
|
||||
from gns3server.controller.controller_error import ControllerNotFoundError
|
||||
from gns3server.utils.image_inventory import image_lock
|
||||
|
||||
|
||||
@ -27,7 +27,6 @@ from alembic.util.exc import CommandError
|
||||
from fastapi import FastAPI
|
||||
from pydantic import ValidationError
|
||||
from sqlalchemy import event
|
||||
from sqlalchemy.engine import Engine
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
|
||||
|
||||
|
||||
@ -6,9 +6,6 @@ Create Date: 2023-01-11 08:55:25.116126
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "7ceeddd9c9a8"
|
||||
down_revision = None
|
||||
|
||||
@ -32,8 +32,6 @@ import os
|
||||
import resource
|
||||
import sys
|
||||
|
||||
import gns3server.utils.get_resource
|
||||
|
||||
|
||||
def daemonize():
|
||||
"""
|
||||
|
||||
@ -145,3 +145,179 @@ from .controller.tokens import ApiKeyCreate, RefreshTokenRequest, Token
|
||||
|
||||
# Schemas for both controller and compute
|
||||
from .qemu_disk_image import QemuDiskImageCreate, QemuDiskImageFormat, QemuDiskImageUpdate
|
||||
|
||||
__all__ = [
|
||||
"ACE",
|
||||
"GNS3VM",
|
||||
"IOU",
|
||||
"NAT",
|
||||
"TAPNIO",
|
||||
"UDPNIO",
|
||||
"VPCS",
|
||||
"ACECreate",
|
||||
"ACEUpdate",
|
||||
"ATMSwitch",
|
||||
"ATMSwitchCreate",
|
||||
"ATMSwitchUpdate",
|
||||
"ApiKeyCreate",
|
||||
"Appliance",
|
||||
"ApplianceVersion",
|
||||
"ApplianceVersionV8",
|
||||
"AutoIdlePC",
|
||||
"BatchNIOCreate",
|
||||
"BatchNIOEntry",
|
||||
"C1700DynamipsTemplate",
|
||||
"C1700DynamipsTemplateUpdate",
|
||||
"C2600DynamipsTemplate",
|
||||
"C2600DynamipsTemplateUpdate",
|
||||
"C2691DynamipsTemplate",
|
||||
"C2691DynamipsTemplateUpdate",
|
||||
"C3600DynamipsTemplate",
|
||||
"C3600DynamipsTemplateUpdate",
|
||||
"C3725DynamipsTemplate",
|
||||
"C3725DynamipsTemplateUpdate",
|
||||
"C3745DynamipsTemplate",
|
||||
"C3745DynamipsTemplateUpdate",
|
||||
"C7200DynamipsTemplate",
|
||||
"C7200DynamipsTemplateUpdate",
|
||||
"Capabilities",
|
||||
"ChatRequest",
|
||||
"ChatResponse",
|
||||
"ChatSession",
|
||||
"Cloud",
|
||||
"CloudCreate",
|
||||
"CloudTemplate",
|
||||
"CloudTemplateUpdate",
|
||||
"CloudUpdate",
|
||||
"Compute",
|
||||
"ComputeCreate",
|
||||
"ComputeDockerImage",
|
||||
"ComputeUpdate",
|
||||
"ComputeVMwareVM",
|
||||
"ComputeVirtualBoxVM",
|
||||
"ConversationHistory",
|
||||
"Credentials",
|
||||
"Docker",
|
||||
"DockerCreate",
|
||||
"DockerTemplate",
|
||||
"DockerTemplateUpdate",
|
||||
"DockerUpdate",
|
||||
"Drawing",
|
||||
"Dynamips",
|
||||
"DynamipsCreate",
|
||||
"DynamipsTemplate",
|
||||
"DynamipsUpdate",
|
||||
"ErrorMessage",
|
||||
"EthernetHub",
|
||||
"EthernetHubCreate",
|
||||
"EthernetHubTemplate",
|
||||
"EthernetHubTemplateUpdate",
|
||||
"EthernetHubUpdate",
|
||||
"EthernetNIO",
|
||||
"EthernetPortInfo",
|
||||
"EthernetSwitch",
|
||||
"EthernetSwitchCreate",
|
||||
"EthernetSwitchTemplate",
|
||||
"EthernetSwitchTemplateUpdate",
|
||||
"EthernetSwitchUpdate",
|
||||
"FrameRelaySwitch",
|
||||
"FrameRelaySwitchCreate",
|
||||
"FrameRelaySwitchUpdate",
|
||||
"IOUCreate",
|
||||
"IOULicense",
|
||||
"IOUStart",
|
||||
"IOUTemplate",
|
||||
"IOUTemplateUpdate",
|
||||
"IOUUpdate",
|
||||
"Image",
|
||||
"ImageSyncJob",
|
||||
"ImageSyncRequest",
|
||||
"ImageType",
|
||||
"LLMModelConfigCreate",
|
||||
"LLMModelConfigData",
|
||||
"LLMModelConfigInheritedResponse",
|
||||
"LLMModelConfigListResponse",
|
||||
"LLMModelConfigResponse",
|
||||
"LLMModelConfigUpdate",
|
||||
"LLMModelConfigWithSource",
|
||||
"Link",
|
||||
"LinkCapture",
|
||||
"LinkCreate",
|
||||
"LinkUpdate",
|
||||
"LoggedInUserUpdate",
|
||||
"MarkerCreate",
|
||||
"MarkerDefinitionCreate",
|
||||
"MarkerRebuild",
|
||||
"MarkerToggle",
|
||||
"MarkerUpdate",
|
||||
"NATCreate",
|
||||
"NATUpdate",
|
||||
"NetmikoDeviceType",
|
||||
"NetmikoDeviceTypeList",
|
||||
"Node",
|
||||
"NodeCapture",
|
||||
"NodeCreate",
|
||||
"NodeDuplicate",
|
||||
"NodeFile",
|
||||
"NodeUpdate",
|
||||
"OpenAIMessage",
|
||||
"OpenAIToolCall",
|
||||
"Privilege",
|
||||
"Project",
|
||||
"ProjectCompression",
|
||||
"ProjectCreate",
|
||||
"ProjectDuplicate",
|
||||
"ProjectFile",
|
||||
"ProjectUpdate",
|
||||
"Qemu",
|
||||
"QemuCreate",
|
||||
"QemuDiskImageCreate",
|
||||
"QemuDiskImageFormat",
|
||||
"QemuDiskImageUpdate",
|
||||
"QemuTemplate",
|
||||
"QemuTemplateUpdate",
|
||||
"QemuUpdate",
|
||||
"RefreshTokenRequest",
|
||||
"RenameSession",
|
||||
"Resource",
|
||||
"ResourceCreate",
|
||||
"ResourcePool",
|
||||
"ResourcePoolCreate",
|
||||
"ResourcePoolUpdate",
|
||||
"Role",
|
||||
"RoleCreate",
|
||||
"RoleUpdate",
|
||||
"ServerConfig",
|
||||
"SettingsResponse",
|
||||
"SettingsUpdate",
|
||||
"SettingsUpdateResponse",
|
||||
"Snapshot",
|
||||
"SnapshotCreate",
|
||||
"Template",
|
||||
"TemplateCreate",
|
||||
"TemplateUpdate",
|
||||
"TemplateUsage",
|
||||
"Token",
|
||||
"UDPPortInfo",
|
||||
"User",
|
||||
"UserCreate",
|
||||
"UserGroup",
|
||||
"UserGroupCreate",
|
||||
"UserGroupUpdate",
|
||||
"UserUpdate",
|
||||
"VMware",
|
||||
"VMwareCreate",
|
||||
"VMwareTemplate",
|
||||
"VMwareTemplateUpdate",
|
||||
"VMwareUpdate",
|
||||
"VPCSCreate",
|
||||
"VPCSTemplate",
|
||||
"VPCSTemplateUpdate",
|
||||
"VPCSUpdate",
|
||||
"Version",
|
||||
"VirtualBox",
|
||||
"VirtualBoxCreate",
|
||||
"VirtualBoxTemplate",
|
||||
"VirtualBoxTemplateUpdate",
|
||||
"VirtualBoxUpdate",
|
||||
]
|
||||
|
||||
@ -18,7 +18,7 @@ import uuid
|
||||
from enum import Enum
|
||||
from typing import Any, List, Optional, Union
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, SecretStr, field_validator, model_validator
|
||||
from pydantic import BaseModel, ConfigDict, Field, SecretStr, model_validator
|
||||
|
||||
from .base import DateTimeModelMixin
|
||||
from .nodes import NodeType
|
||||
|
||||
@ -23,7 +23,6 @@ from gns3server import schemas
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.controller.controller_error import (
|
||||
ControllerBadRequestError,
|
||||
ControllerForbiddenError,
|
||||
ControllerNotFoundError,
|
||||
)
|
||||
from gns3server.db.repositories.computes import ComputesRepository
|
||||
|
||||
@ -20,9 +20,7 @@ import errno
|
||||
import hashlib
|
||||
import posixpath
|
||||
import re
|
||||
import shlex
|
||||
import socket
|
||||
import sys
|
||||
import textwrap
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,6 @@ Parser for VT100 input stream.
|
||||
|
||||
import re
|
||||
|
||||
import six
|
||||
from prompt_toolkit.key_binding.input_processor import KeyPress
|
||||
from prompt_toolkit.keys import Keys
|
||||
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import asyncio
|
||||
import sys
|
||||
|
||||
|
||||
class Pool:
|
||||
|
||||
@ -16,9 +16,7 @@
|
||||
|
||||
import asyncio
|
||||
import asyncio.subprocess
|
||||
import copy
|
||||
import logging
|
||||
import re
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ Packet filter parameter validation utilities.
|
||||
|
||||
import logging
|
||||
import subprocess
|
||||
from typing import Any, Dict, List, Optional
|
||||
from typing import Any, Dict, List
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
# NOTE: this patches the standard zipfile module
|
||||
from zipfile import *
|
||||
|
||||
from . import _zipfile
|
||||
from ._zipfile import (
|
||||
ZIP_ZSTANDARD,
|
||||
ZSTANDARD_VERSION,
|
||||
)
|
||||
from . import _zipfile # noqa: F401
|
||||
from ._zipfile import ZIP_ZSTANDARD, ZSTANDARD_VERSION # noqa: F401
|
||||
|
||||
@ -96,7 +96,6 @@ ignore = [
|
||||
"BLE001", # 214 blind-except
|
||||
"E402", # 129 module-import-not-at-top-of-file
|
||||
"E501", # 655 line-too-long
|
||||
"F401", # 300 unused-import
|
||||
"F841", # 32 unused-variable
|
||||
"PLW0603", # 21 global-statement
|
||||
"PLW2901", # 30 redefined-loop-name
|
||||
|
||||
@ -25,7 +25,7 @@ import time
|
||||
import urllib.request
|
||||
from json import loads as convert
|
||||
|
||||
from dialog import Dialog, PythonDialogBug
|
||||
from dialog import Dialog
|
||||
|
||||
|
||||
class Welcome_dialog:
|
||||
|
||||
@ -8,8 +8,6 @@ device_config_send / device_show_run / vpcs_config_set.
|
||||
import json
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
VPCS_MOD = "gns3server.agent.gns3_copilot.tools_v2.vpcs_tools_netmiko"
|
||||
|
||||
|
||||
|
||||
@ -10,8 +10,6 @@ This catches issues like:
|
||||
"""
|
||||
|
||||
import ast
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
@ -21,8 +21,6 @@ from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
|
||||
from gns3server.compute.project import Project
|
||||
from gns3server.config import Config
|
||||
from gns3server.schemas.config import ServerSettings
|
||||
from gns3server.version import __version__
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
|
||||
import os
|
||||
import stat
|
||||
import sys
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
@ -22,7 +22,7 @@ from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
|
||||
from gns3server.compute.project import Project
|
||||
from tests.utils import AsyncioMagicMock, asyncio_patch
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
# The builtin Ethernet switch talks to uBridge (brctl/bridge modules) instead of
|
||||
# the Dynamips hypervisor. These are the seams we stub so the routes can be
|
||||
|
||||
@ -15,12 +15,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
from gns3server.compute.notification_manager import NotificationManager
|
||||
|
||||
|
||||
# @pytest.mark.asyncio
|
||||
# async def test_notification_ws(compute_api):
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
|
||||
import os
|
||||
import uuid
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from fastapi import FastAPI, status
|
||||
@ -241,7 +240,6 @@ class TestBatchNIOEdgeCases:
|
||||
Dynamips.create_nio is async (returns a coroutine) unlike the sync
|
||||
base version. The batch handler must await it.
|
||||
"""
|
||||
import asyncio as _asyncio
|
||||
import inspect
|
||||
|
||||
class _FakeDynamips:
|
||||
|
||||
@ -21,7 +21,6 @@ from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server.db.repositories.users import UsersRepository
|
||||
from gns3server.schemas.controller.rbac import ACECreate
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import unittest.mock
|
||||
import uuid
|
||||
from pathlib import Path
|
||||
|
||||
@ -21,8 +21,6 @@ import pytest
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.utils.get_resource import get_resource
|
||||
from gns3server.version import __version__
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
import os
|
||||
import tempfile
|
||||
import uuid
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
@ -18,12 +18,11 @@ import os
|
||||
import platform
|
||||
import stat
|
||||
import sys
|
||||
from unittest.mock import MagicMock, patch
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from gns3server.compute.qemu import Qemu
|
||||
from gns3server.compute.qemu.qemu_error import QemuError
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
import os
|
||||
import stat
|
||||
import tempfile
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
@ -20,7 +20,7 @@ import json
|
||||
import os
|
||||
import socket
|
||||
import uuid
|
||||
from unittest.mock import MagicMock, patch
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
from watchdog.events import DirCreatedEvent, FileCreatedEvent
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
from pydantic import SecretStr
|
||||
|
||||
@ -24,7 +24,6 @@ from uuid import uuid4
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from gns3server.config import Config
|
||||
from gns3server.controller.controller_error import (
|
||||
ComputeConflictError,
|
||||
ControllerError,
|
||||
|
||||
@ -20,9 +20,7 @@ import os
|
||||
|
||||
import pytest
|
||||
|
||||
from gns3server.controller.compute import Compute
|
||||
from gns3server.controller.project import Project
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
import uuid
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
from httpx_ws.transport import ASGIWebSocketTransport
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
import os
|
||||
from unittest import mock
|
||||
from unittest.mock import MagicMock, patch
|
||||
from unittest.mock import MagicMock
|
||||
from uuid import uuid4
|
||||
|
||||
import pytest
|
||||
|
||||
@ -18,7 +18,7 @@ from watchdog.events import FileDeletedEvent, FileModifiedEvent, FileMovedEvent
|
||||
from gns3server.db.models import Base, Image, ImageSyncJob, Template
|
||||
from gns3server.db.models.images import image_template_map
|
||||
from gns3server.db.repositories.images import ImagesRepository
|
||||
from gns3server.services.image_reconciliation import ImageReconciliationService, InventoryEvents, enumerate_root
|
||||
from gns3server.services.image_reconciliation import ImageReconciliationService, InventoryEvents
|
||||
from gns3server.utils.image_inventory import ImageLockBusy, fingerprint, image_lock
|
||||
from gns3server.utils.images import InvalidImageError, inspect_image_file, md5sum, write_image
|
||||
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import asyncio
|
||||
|
||||
# from gns3server.utils.asyncio.embed_shell import EmbedShell
|
||||
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user