style: sort imports in controller

This commit is contained in:
Mark Paronyan 2026-09-30 20:51:22 +03:00
parent 61caa20524
commit 55df230864
23 changed files with 182 additions and 194 deletions

View File

@ -15,43 +15,42 @@
# 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 os
import sys
import uuid
import shutil
import asyncio
import random
import json
import os
import random
import shutil
import sys
import threading
import uuid
try:
import importlib_resources
except ImportError:
from importlib import resources as importlib_resources
from watchdog.events import FileSystemEventHandler, DirDeletedEvent, FileDeletedEvent
import logging
from watchdog.events import DirDeletedEvent, FileDeletedEvent, FileSystemEventHandler
from watchdog.observers import Observer
from ..config import Config
from ..utils import parse_version, md5sum
from ..utils.images import default_images_directory
from ..db.tasks import update_disk_checksums
from ..utils import md5sum, parse_version
from ..utils.asyncio import wait_run_in_executor
from .project import Project
from .node import Node
from ..utils.images import default_images_directory
from ..version import __version__
from .appliance import Appliance
from .appliance_manager import ApplianceManager
from .compute import Compute, ComputeError
from .notification import Notification
from .symbols import Symbols
from .topology import load_topology
from .controller_error import ControllerError, ControllerNotFoundError
from .gns3vm import GNS3VM
from .gns3vm.gns3_vm_error import GNS3VMError
from .controller_error import ControllerError, ControllerNotFoundError
from ..db.tasks import update_disk_checksums
from ..version import __version__
import logging
from .node import Node
from .notification import Notification
from .project import Project
from .symbols import Symbols
from .topology import load_topology
log = logging.getLogger(__name__)

View File

@ -15,37 +15,34 @@
# 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 os
import json
import asyncio
import platformdirs
import json
import logging
import os
from typing import List, Optional, Tuple
from aiohttp.client_exceptions import ClientError
from uuid import UUID
import platformdirs
from aiohttp.client_exceptions import ClientError
from pydantic import ValidationError
from sqlalchemy.exc import SQLAlchemyError
from .appliance import Appliance
from gns3server import schemas
from gns3server.db.repositories.images import ImagesRepository
from gns3server.db.repositories.rbac import RbacRepository
from gns3server.db.repositories.templates import TemplatesRepository
from gns3server.schemas.controller.appliances import ApplianceModel
from gns3server.services.templates import TemplatesService
from gns3server.utils.images import default_images_directory
from ..config import Config
from ..utils.asyncio import locking
from ..utils.http_client import HTTPClient
from .controller_error import ControllerBadRequestError, ControllerNotFoundError, ControllerError
from .appliance_to_template import ApplianceToTemplate
from ..utils.images import InvalidImageError, write_image, read_image_info
from ..utils.image_inventory import image_lock
from gns3server import schemas
from gns3server.schemas.controller.appliances import ApplianceModel
from gns3server.utils.images import default_images_directory
from gns3server.db.repositories.images import ImagesRepository
from gns3server.db.repositories.templates import TemplatesRepository
from gns3server.services.templates import TemplatesService
from gns3server.db.repositories.rbac import RbacRepository
import logging
from ..utils.images import InvalidImageError, read_image_info, write_image
from .appliance import Appliance
from .appliance_to_template import ApplianceToTemplate
from .controller_error import ControllerBadRequestError, ControllerError, ControllerNotFoundError
log = logging.getLogger(__name__)

View File

@ -17,6 +17,7 @@
import logging
from .controller_error import ControllerError
log = logging.getLogger(__name__)

View File

@ -15,14 +15,14 @@
# 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 ipaddress
import aiohttp
import asyncio
import socket
import json
import sys
import io
import ipaddress
import json
import socket
import sys
import aiohttp
from fastapi import HTTPException
if sys.version_info >= (3, 11):
@ -30,23 +30,22 @@ if sys.version_info >= (3, 11):
else:
from async_timeout import timeout as asynctimeout
from ..utils import parse_version
from ..utils.asyncio import locking, async_iterable_to_stream
import logging
from ..controller.controller_error import (
ControllerError,
ComputeConflictError,
ComputeError,
ControllerBadRequestError,
ControllerNotFoundError,
ControllerError,
ControllerForbiddenError,
ControllerNotFoundError,
ControllerTimeoutError,
ControllerUnauthorizedError,
ComputeError,
ComputeConflictError,
)
from ..utils import parse_version
from ..utils.asyncio import async_iterable_to_stream, locking
from ..version import __version__, __version_info__
import logging
log = logging.getLogger(__name__)

View File

@ -15,19 +15,16 @@
# 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 hashlib
import base64
import uuid
import re
import hashlib
import logging
import os
import re
import uuid
import xml.etree.ElementTree as ET
from gns3server.utils.picture import get_size
import logging
log = logging.getLogger(__name__)

View File

@ -15,19 +15,18 @@
# 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 json
import logging
import os
import sys
import json
import asyncio
import aiofiles
import zipfile
import tempfile
from .controller_error import ControllerError, ControllerNotFoundError, ControllerTimeoutError
import zipfile
from datetime import datetime
import logging
import aiofiles
from .controller_error import ControllerError, ControllerNotFoundError, ControllerTimeoutError
log = logging.getLogger(__name__)

View File

@ -15,22 +15,21 @@
# 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 copy
import asyncio
import copy
import ipaddress
import logging
import sys
from ...utils.asyncio import locking
from .vmware_gns3_vm import VMwareGNS3VM
from .virtualbox_gns3_vm import VirtualBoxGNS3VM
from .hyperv_gns3_vm import HyperVGNS3VM
from .remote_gns3_vm import RemoteGNS3VM
from .gns3_vm_error import GNS3VMError
from ...version import __version__
from ..compute import ComputeError
from ..controller_error import ControllerError
import logging
from .gns3_vm_error import GNS3VMError
from .hyperv_gns3_vm import HyperVGNS3VM
from .remote_gns3_vm import RemoteGNS3VM
from .virtualbox_gns3_vm import VirtualBoxGNS3VM
from .vmware_gns3_vm import VMwareGNS3VM
log = logging.getLogger(__name__)

View File

@ -15,10 +15,10 @@
# 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 psutil
import logging
import psutil
log = logging.getLogger(__name__)

View File

@ -15,11 +15,12 @@
# 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 logging
import asyncio
import psutil
import ipaddress
import logging
import sys
import psutil
from .base_gns3_vm import BaseGNS3VM
from .gns3_vm_error import GNS3VMError

View File

@ -15,12 +15,11 @@
# 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 logging
from .base_gns3_vm import BaseGNS3VM
from .gns3_vm_error import GNS3VMError
import logging
log = logging.getLogger(__name__)

View File

@ -15,21 +15,22 @@
# 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 re
import sys
import aiohttp
import logging
import asyncio
import socket
import ipaddress
import logging
import re
import socket
import sys
import aiohttp
from .base_gns3_vm import BaseGNS3VM
from .gns3_vm_error import GNS3VMError
from gns3server.utils import parse_version
from gns3server.utils.http_client import HTTPClient
from gns3server.utils.asyncio import wait_run_in_executor
from gns3server.utils.http_client import HTTPClient
from ...compute.virtualbox import VirtualBox, VirtualBoxError
from .base_gns3_vm import BaseGNS3VM
from .gns3_vm_error import GNS3VMError
log = logging.getLogger(__name__)

View File

@ -15,9 +15,10 @@
# 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 os
import logging
import asyncio
import logging
import os
import psutil
from gns3server.compute.vmware import VMware, VMwareError

View File

@ -15,23 +15,23 @@
# 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 os
import sys
import json
import uuid
import shutil
import aiofiles
import itertools
import tempfile
import json
import logging
import os
import shutil
import stat
import sys
import tempfile
import uuid
import aiofiles
import gns3server.utils.zipfile_zstd as zipfile_zstd
from ..utils.asyncio import aiozipstream, wait_run_in_executor
from .controller_error import ControllerError
from .topology import load_topology
from ..utils.asyncio import wait_run_in_executor
from ..utils.asyncio import aiozipstream
import logging
log = logging.getLogger(__name__)

View File

@ -15,21 +15,21 @@
# 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 html
import logging
import os
import re
import uuid
import html
from .controller_error import ControllerError, ControllerNotFoundError
from gns3server.agent.web_wireshark.manager import WebWiresharkManager
from gns3server.config import Config
from gns3server.utils.packet_filter_validation import (
validate_all_filters,
filter_inactive_filters,
FilterValidationError,
filter_inactive_filters,
validate_all_filters,
)
import logging
from .controller_error import ControllerError, ControllerNotFoundError
log = logging.getLogger(__name__)

View File

@ -63,7 +63,7 @@ import tempfile
import time
from contextlib import asynccontextmanager
from .controller_error import ControllerError, ControllerNotFoundError, ControllerBadRequestError
from .controller_error import ControllerBadRequestError, ControllerError, ControllerNotFoundError
log = logging.getLogger(__name__)

View File

@ -16,21 +16,19 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import asyncio
import html
import copy
import uuid
import os
from .controller_error import ControllerError, ControllerTimeoutError, ComputeError, ComputeConflictError
from .node_types import BUILTIN_NODE_TYPES
from .ports.port_factory import PortFactory, StandardPortFactory, DynamipsPortFactory
from ..utils.images import images_directories
from ..utils.application_id import is_iol_runner_environment
from ..utils import macaddress_to_int, int_to_macaddress
from ..config import Config
import html
import logging
import os
import uuid
from ..config import Config
from ..utils import int_to_macaddress, macaddress_to_int
from ..utils.application_id import is_iol_runner_environment
from ..utils.images import images_directories
from .controller_error import ComputeConflictError, ComputeError, ControllerError, ControllerTimeoutError
from .node_types import BUILTIN_NODE_TYPES
from .ports.port_factory import DynamipsPortFactory, PortFactory, StandardPortFactory
log = logging.getLogger(__name__)

View File

@ -19,6 +19,7 @@ import asyncio
from contextlib import contextmanager
from gns3server.utils.notification_queue import NotificationQueue
from .controller_error import ControllerError

View File

@ -15,18 +15,18 @@
# 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 logging
from gns3server.controller.controller_error import ControllerError
from gns3server.utils import macaddress_to_int, int_to_macaddress
from gns3server.utils import int_to_macaddress, macaddress_to_int
from .atm_port import ATMPort
from .ethernet_port import EthernetPort
from .fastethernet_port import FastEthernetPort
from .frame_relay_port import FrameRelayPort
from .gigabitethernet_port import GigabitEthernetPort
from .fastethernet_port import FastEthernetPort
from .ethernet_port import EthernetPort
from .serial_port import SerialPort
from .pos_port import POSPort
import logging
from .serial_port import SerialPort
log = logging.getLogger(__name__)

View File

@ -15,43 +15,41 @@
# 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 re
import os
import json
import uuid
import copy
import shutil
import time
import asyncio
import aiofiles
import tempfile
import zipfile
import copy
import json
import logging
import os
import pathlib
import re
import shutil
import tempfile
import time
import uuid
import zipfile
from uuid import UUID, uuid4
import aiofiles
from fastapi import HTTPException, status
from .node import Node
from .compute import ComputeError
from .snapshot import Snapshot
from .drawing import Drawing
from .topology import project_to_topology, load_topology
from .udp_link import UDPLink
from .link import _UNSET
from ..config import Config
from ..utils.path import check_path_allowed, get_default_project_directory
from ..utils.application_id import get_next_application_id, is_iol_runner_environment
from ..utils.asyncio.pool import Pool
from ..utils.packet_filter_validation import validate_bpf_syntax
from ..utils.asyncio import locking
from ..utils.asyncio import aiozipstream
from ..utils.asyncio import wait_run_in_executor
from .export_project import export_project
from .import_project import import_project, update_snapshots, regenerate_topology_ids
from .controller_error import ControllerError, ControllerForbiddenError, ControllerNotFoundError
from gns3server.agent.web_wireshark.manager import WebWiresharkManager
import logging
from ..config import Config
from ..utils.application_id import get_next_application_id, is_iol_runner_environment
from ..utils.asyncio import aiozipstream, locking, wait_run_in_executor
from ..utils.asyncio.pool import Pool
from ..utils.packet_filter_validation import validate_bpf_syntax
from ..utils.path import check_path_allowed, get_default_project_directory
from .compute import ComputeError
from .controller_error import ControllerError, ControllerForbiddenError, ControllerNotFoundError
from .drawing import Drawing
from .export_project import export_project
from .import_project import import_project, regenerate_topology_ids, update_snapshots
from .link import _UNSET
from .node import Node
from .snapshot import Snapshot
from .topology import load_topology, project_to_topology
from .udp_link import UDPLink
log = logging.getLogger(__name__)

View File

@ -16,23 +16,22 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
import os
import uuid
import shutil
import tempfile
import aiofiles
import zipfile
import time
import uuid
import zipfile
from datetime import datetime, timezone
import aiofiles
from ..utils.asyncio import aiozipstream, wait_run_in_executor
from .controller_error import ControllerError
from ..utils.asyncio import wait_run_in_executor
from ..utils.asyncio import aiozipstream
from .export_project import export_project
from .import_project import import_project
import logging
log = logging.getLogger(__name__)

View File

@ -15,16 +15,15 @@
# 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 logging
import os
import posixpath
from .symbol_themes import BUILTIN_SYMBOL_THEMES
from .controller_error import ControllerNotFoundError
from ..config import Config
from ..utils.get_resource import get_resource
from ..utils.picture import get_size
from ..config import Config
import logging
from .controller_error import ControllerNotFoundError
from .symbol_themes import BUILTIN_SYMBOL_THEMES
log = logging.getLogger(__name__)

View File

@ -15,36 +15,35 @@
# 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 os
import glob
import html
import json
import uuid
import glob
import logging
import os
import shutil
import uuid
import zipfile
import pydantic
from typing import Optional
from ..version import __version__
from ..utils.qt import qt_font_to_style
from ..compute.dynamips import PLATFORMS_DEFAULT_RAM
from .controller_error import ControllerError
from .compute import Compute
from .drawing import Drawing
from .node import Node
from .link import Link
import pydantic
from gns3server.schemas.compute.dynamips_nodes import DynamipsCreate
from gns3server.schemas.controller.topology import Topology
from gns3server.utils.hostname import (
is_ios_hostname_valid,
is_rfc1123_hostname_valid,
to_rfc1123_hostname,
to_ios_hostname,
to_rfc1123_hostname,
)
from gns3server.schemas.controller.topology import Topology
from gns3server.schemas.compute.dynamips_nodes import DynamipsCreate
import logging
from ..compute.dynamips import PLATFORMS_DEFAULT_RAM
from ..utils.qt import qt_font_to_style
from ..version import __version__
from .compute import Compute
from .controller_error import ControllerError
from .drawing import Drawing
from .link import Link
from .node import Node
log = logging.getLogger(__name__)

View File

@ -19,10 +19,11 @@
import asyncio
import logging
from gns3server.utils.packet_filter_validation import FilterValidationError, validate_bpf_syntax
from .controller_error import ControllerError, ControllerNotFoundError
from .link import Link, _UNSET
from .link import _UNSET, Link
from .node_types import BUILTIN_NODE_TYPES
from gns3server.utils.packet_filter_validation import validate_bpf_syntax, FilterValidationError
# Node types that can host a marker (have a uBridge bridge to attach the
# `mark` filter to). Mirrors _get_filter_node in link.py, minus "nat"