mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-07 11:10:27 +03:00
refactor: remove unused imports
This commit is contained in:
parent
084004586c
commit
306d8fbde4
@ -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(
|
||||
{
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
@ -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__)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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():
|
||||
"""
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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__)
|
||||
|
||||
|
||||
@ -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,7 +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
|
||||
|
||||
@ -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