mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-26 03:42:22 +02:00
style: sort imports in api and utils modules
This commit is contained in:
parent
4ebc941951
commit
634189d443
@ -15,43 +15,44 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from fastapi import FastAPI, Request, Depends
|
||||
import logging
|
||||
|
||||
from fastapi import Depends, FastAPI, Request
|
||||
from fastapi.responses import JSONResponse
|
||||
from starlette.exceptions import HTTPException as StarletteHTTPException
|
||||
from gns3server.controller.gns3vm.gns3_vm_error import GNS3VMError
|
||||
from gns3server.compute.error import ImageMissingError, NodeError
|
||||
from gns3server.compute.ubridge.ubridge_error import UbridgeError
|
||||
|
||||
from .dependencies.authentication import compute_authentication
|
||||
|
||||
from gns3server.compute.compute_error import (
|
||||
ComputeError,
|
||||
ComputeForbiddenError,
|
||||
ComputeNotFoundError,
|
||||
ComputeTimeoutError,
|
||||
ComputeForbiddenError,
|
||||
ComputeUnauthorizedError,
|
||||
)
|
||||
from gns3server.compute.error import ImageMissingError, NodeError
|
||||
from gns3server.compute.ubridge.ubridge_error import UbridgeError
|
||||
from gns3server.controller.gns3vm.gns3_vm_error import GNS3VMError
|
||||
|
||||
from . import capabilities
|
||||
from . import compute
|
||||
from . import projects
|
||||
from . import notifications
|
||||
from . import images
|
||||
from . import atm_switch_nodes
|
||||
from . import cloud_nodes
|
||||
from . import docker_nodes
|
||||
from . import dynamips_nodes
|
||||
from . import ethernet_hub_nodes
|
||||
from . import ethernet_switch_nodes
|
||||
from . import frame_relay_switch_nodes
|
||||
from . import iou_nodes
|
||||
from . import nat_nodes
|
||||
from . import qemu_nodes
|
||||
from . import virtualbox_nodes
|
||||
from . import vmware_nodes
|
||||
from . import vpcs_nodes
|
||||
|
||||
import logging
|
||||
from . import (
|
||||
atm_switch_nodes,
|
||||
capabilities,
|
||||
cloud_nodes,
|
||||
compute,
|
||||
docker_nodes,
|
||||
dynamips_nodes,
|
||||
ethernet_hub_nodes,
|
||||
ethernet_switch_nodes,
|
||||
frame_relay_switch_nodes,
|
||||
images,
|
||||
iou_nodes,
|
||||
nat_nodes,
|
||||
notifications,
|
||||
projects,
|
||||
qemu_nodes,
|
||||
virtualbox_nodes,
|
||||
vmware_nodes,
|
||||
vpcs_nodes,
|
||||
)
|
||||
from .dependencies.authentication import compute_authentication
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -18,13 +18,13 @@
|
||||
API routes for ATM switch nodes.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
import os
|
||||
from typing import Any
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, Body, Path, status, HTTPException
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, Path, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from uuid import UUID
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.dynamips import Dynamips
|
||||
|
||||
@ -19,14 +19,14 @@ API routes for capabilities
|
||||
"""
|
||||
|
||||
import sys
|
||||
import psutil
|
||||
|
||||
import psutil
|
||||
from fastapi import APIRouter, Request
|
||||
|
||||
from gns3server.version import __version__
|
||||
from gns3server import schemas
|
||||
from gns3server.compute import MODULES
|
||||
from gns3server.utils.path import get_default_project_directory
|
||||
from gns3server import schemas
|
||||
from gns3server.version import __version__
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@ -19,13 +19,13 @@ API routes for cloud nodes.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, Depends, Path, status, HTTPException
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Any, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Path, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.builtin import Builtin
|
||||
from gns3server.compute.builtin.nodes.cloud import Cloud
|
||||
|
||||
@ -20,26 +20,26 @@ API routes for compute.
|
||||
"""
|
||||
|
||||
import os
|
||||
import psutil
|
||||
import cpuinfo
|
||||
|
||||
from functools import lru_cache
|
||||
from gns3server.config import Config
|
||||
from gns3server.utils.cpu_percent import CpuPercent
|
||||
from gns3server.version import __version__
|
||||
from gns3server.utils.path import get_default_project_directory, is_safe_path
|
||||
from typing import List, Optional
|
||||
from uuid import UUID
|
||||
|
||||
import cpuinfo
|
||||
import psutil
|
||||
from fastapi import APIRouter, Body, HTTPException, Response, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.port_manager import PortManager
|
||||
from gns3server.compute.project_manager import ProjectManager
|
||||
from gns3server.utils.interfaces import interfaces
|
||||
from gns3server.compute.qemu import Qemu
|
||||
from gns3server.compute.virtualbox import VirtualBox
|
||||
from gns3server.compute.vmware import VMware
|
||||
from gns3server import schemas
|
||||
|
||||
from fastapi import APIRouter, HTTPException, Body, Response, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from uuid import UUID
|
||||
from typing import Optional, List
|
||||
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.version import __version__
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@ -14,16 +14,17 @@
|
||||
# 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 secrets
|
||||
import base64
|
||||
import binascii
|
||||
import logging
|
||||
import secrets
|
||||
from typing import Optional, Union
|
||||
|
||||
from fastapi import Depends, HTTPException, WebSocket, status
|
||||
from fastapi.security import HTTPBasic, HTTPBasicCredentials
|
||||
from fastapi.security.utils import get_authorization_scheme_param
|
||||
|
||||
from gns3server.config import Config
|
||||
from typing import Optional, Union
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
security = HTTPBasic(auto_error=False)
|
||||
|
||||
@ -19,16 +19,17 @@ API routes for Docker nodes.
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import Any, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, WebSocket, Depends, Body, status, HTTPException
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, WebSocket, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from uuid import UUID
|
||||
from typing import Any, Union
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.docker import Docker
|
||||
from gns3server.compute.docker.docker_vm import DockerVM
|
||||
|
||||
from .dependencies.authentication import compute_authentication, ws_compute_authentication
|
||||
|
||||
responses: dict[int | str, dict[str, Any]] = {
|
||||
|
||||
@ -19,16 +19,16 @@ API routes for Dynamips nodes.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, WebSocket, Body, Depends, status, HTTPException
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Any, List, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, WebSocket, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.dynamips import Dynamips
|
||||
from gns3server.compute.dynamips.nodes.router import Router
|
||||
from gns3server import schemas
|
||||
|
||||
from .dependencies.authentication import compute_authentication, ws_compute_authentication
|
||||
|
||||
|
||||
@ -18,17 +18,17 @@
|
||||
API routes for Ethernet hub nodes.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, Depends, Body, Path, status, HTTPException
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Any
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, Path, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.dynamips import Dynamips
|
||||
from gns3server.compute.dynamips.nodes.ethernet_hub import EthernetHub
|
||||
from gns3server import schemas
|
||||
|
||||
responses: dict[int | str, dict[str, Any]] = {
|
||||
404: {"model": schemas.ErrorMessage, "description": "Could not find project or Ethernet hub node"}
|
||||
|
||||
@ -22,17 +22,17 @@ through uBridge's ``brctl`` module (see
|
||||
``gns3server.compute.builtin.nodes.ethernet_switch``).
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, Depends, Body, Path, status, HTTPException
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Any
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, Path, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.builtin import Builtin
|
||||
from gns3server.compute.builtin.nodes.ethernet_switch import EthernetSwitch
|
||||
from gns3server import schemas
|
||||
|
||||
responses: dict[int | str, dict[str, Any]] = {
|
||||
404: {"model": schemas.ErrorMessage, "description": "Could not find project or Ethernet switch node"}
|
||||
|
||||
@ -18,13 +18,13 @@
|
||||
API routes for Frame Relay switch nodes.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
import os
|
||||
from typing import Any
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, Body, Path, status, HTTPException
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, Path, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from uuid import UUID
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.dynamips import Dynamips
|
||||
|
||||
@ -20,11 +20,11 @@ API routes for images.
|
||||
|
||||
import os
|
||||
import urllib.parse
|
||||
|
||||
from fastapi import APIRouter, Body, Request, status, Response, HTTPException
|
||||
from fastapi.responses import FileResponse
|
||||
from typing import List
|
||||
|
||||
from fastapi import APIRouter, Body, HTTPException, Request, Response, status
|
||||
from fastapi.responses import FileResponse
|
||||
|
||||
from gns3server.compute.docker import Docker
|
||||
from gns3server.compute.dynamips import Dynamips
|
||||
from gns3server.compute.iou import IOU
|
||||
|
||||
@ -19,13 +19,13 @@ API routes for IOU nodes.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, WebSocket, Depends, Body, status, HTTPException
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Any, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, WebSocket, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.iou import IOU
|
||||
from gns3server.compute.iou.iou_vm import IOUVM
|
||||
|
||||
@ -19,13 +19,13 @@ API routes for NAT nodes.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, Depends, Path, status, HTTPException
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Any, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Path, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.builtin import Builtin
|
||||
from gns3server.compute.builtin.nodes.nat import Nat
|
||||
|
||||
@ -18,14 +18,15 @@
|
||||
API routes for compute notifications.
|
||||
"""
|
||||
|
||||
from fastapi import APIRouter, Depends, WebSocket, WebSocketDisconnect
|
||||
import logging
|
||||
from typing import Union
|
||||
|
||||
from fastapi import APIRouter, Depends, WebSocket, WebSocketDisconnect
|
||||
from websockets.exceptions import ConnectionClosed, WebSocketException
|
||||
|
||||
from gns3server.compute.notification_manager import NotificationManager
|
||||
from .dependencies.authentication import ws_compute_authentication
|
||||
|
||||
import logging
|
||||
from .dependencies.authentication import ws_compute_authentication
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -18,28 +18,27 @@
|
||||
API routes for projects.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import inspect
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import urllib.parse
|
||||
import inspect
|
||||
import asyncio
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger()
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Request, Response, status, Query
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import FileResponse
|
||||
from typing import List
|
||||
from uuid import UUID
|
||||
|
||||
from gns3server.compute.project_manager import ProjectManager
|
||||
from gns3server.compute.project import Project
|
||||
from gns3server.compute.base_manager import BaseManager
|
||||
from gns3server.utils.path import is_safe_path
|
||||
from gns3server import schemas
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query, Request, Response, 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
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@ -18,21 +18,21 @@
|
||||
API routes for Qemu nodes.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, WebSocket, Depends, Body, Path, status, HTTPException
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Any, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, Path, WebSocket, status
|
||||
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
|
||||
from .dependencies.authentication import compute_authentication, ws_compute_authentication
|
||||
|
||||
import logging
|
||||
from .dependencies.authentication import compute_authentication, ws_compute_authentication
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -19,12 +19,12 @@ API routes for VirtualBox nodes.
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import Any, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, WebSocket, Depends, Path, status
|
||||
from fastapi import APIRouter, Depends, Path, WebSocket, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from uuid import UUID
|
||||
from typing import Any, Union
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.virtualbox import VirtualBox
|
||||
|
||||
@ -19,12 +19,12 @@ API routes for VMware nodes.
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import Any, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, WebSocket, Depends, Path, status
|
||||
from fastapi import APIRouter, Depends, Path, WebSocket, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from uuid import UUID
|
||||
from typing import Any, Union
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.vmware import VMware
|
||||
|
||||
@ -19,16 +19,17 @@ API routes for VPCS nodes.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, WebSocket, Depends, Body, Path, status, HTTPException
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Any, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, Path, WebSocket, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.vpcs import VPCS
|
||||
from gns3server.compute.vpcs.vpcs_vm import VPCSVM
|
||||
|
||||
from .dependencies.authentication import compute_authentication, ws_compute_authentication
|
||||
|
||||
responses: dict[int | str, dict[str, Any]] = {
|
||||
|
||||
@ -16,12 +16,12 @@
|
||||
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, Request, HTTPException, status
|
||||
from fastapi.responses import RedirectResponse, HTMLResponse, FileResponse
|
||||
from fastapi import APIRouter, HTTPException, Request, status
|
||||
from fastapi.responses import FileResponse, HTMLResponse, RedirectResponse
|
||||
from fastapi.templating import Jinja2Templates
|
||||
|
||||
from gns3server.version import __version__
|
||||
from gns3server.utils.get_resource import get_resource
|
||||
from gns3server.version import __version__
|
||||
|
||||
router = APIRouter()
|
||||
templates = Jinja2Templates(directory=os.path.join("gns3server", "templates"))
|
||||
|
||||
@ -18,19 +18,19 @@
|
||||
Reads the configuration file and store the settings for the server.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
import secrets
|
||||
import configparser
|
||||
|
||||
from enum import Enum
|
||||
from pydantic import ValidationError
|
||||
from .schemas import ServerConfig
|
||||
from .version import __version_info__
|
||||
from .utils.file_watcher import FileWatcher
|
||||
|
||||
import logging
|
||||
import os
|
||||
import secrets
|
||||
import shutil
|
||||
import sys
|
||||
from enum import Enum
|
||||
|
||||
from pydantic import ValidationError
|
||||
|
||||
from .schemas import ServerConfig
|
||||
from .utils.file_watcher import FileWatcher
|
||||
from .version import __version_info__
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -16,21 +16,19 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import asyncio
|
||||
|
||||
from fastapi import FastAPI
|
||||
import logging
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.config import Config
|
||||
from fastapi import FastAPI
|
||||
|
||||
from gns3server.compute import MODULES
|
||||
from gns3server.compute.port_manager import PortManager
|
||||
from gns3server.compute.marker.marker_manager import MarkerManager
|
||||
from gns3server.utils.http_client import HTTPClient
|
||||
from gns3server.db.tasks import connect_to_db, get_computes, disconnect_from_db
|
||||
from gns3server.compute.port_manager import PortManager
|
||||
from gns3server.config import Config
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.db.tasks import connect_to_db, disconnect_from_db, get_computes
|
||||
from gns3server.services.image_reconciliation import get_image_reconciliation_service
|
||||
|
||||
|
||||
import logging
|
||||
from gns3server.utils.http_client import HTTPClient
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -2,11 +2,10 @@ import asyncio
|
||||
import os
|
||||
from logging.config import fileConfig
|
||||
|
||||
from alembic import context
|
||||
from sqlalchemy import pool
|
||||
from sqlalchemy.ext.asyncio import async_engine_from_config
|
||||
|
||||
from alembic import context
|
||||
|
||||
# this is the Alembic Config object, which provides
|
||||
# access to the values within the .ini file in use.
|
||||
config = context.config
|
||||
|
||||
@ -6,8 +6,8 @@ Create Date: 2026-03-03
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy import inspect
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
|
||||
@ -6,9 +6,8 @@ Create Date: 2023-01-11 08:55:25.116126
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "7ceeddd9c9a8"
|
||||
|
||||
@ -6,9 +6,8 @@ Create Date: 2026-08-14 10:00:00.000000
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "8f2a1c4e9d3b"
|
||||
|
||||
@ -6,9 +6,8 @@ Create Date: 2026-02-23 18:23:59.857607
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "98083573d011"
|
||||
|
||||
@ -6,9 +6,8 @@ Create Date: 2024-09-18 17:52:53.429522
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "9a5292aa4389"
|
||||
|
||||
@ -6,10 +6,11 @@ Create Date: 2026-05-26
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from uuid import uuid4
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "a8829e6c069b"
|
||||
down_revision = "aff810fc119a"
|
||||
|
||||
@ -6,8 +6,8 @@ Create Date: 2026-04-06 19:49:12.155446
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "aff810fc119a"
|
||||
|
||||
@ -6,9 +6,8 @@ Create Date: 2026-08-16 10:00:00.000000
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "b3c7e2a91d4f"
|
||||
|
||||
@ -6,9 +6,8 @@ Create Date: 2026-08-16 12:00:00.000000
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "c7e4a9f1d2b6"
|
||||
|
||||
@ -6,8 +6,8 @@ Create Date: 2026-04-03 19:51:06.173013
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "ec4b7b198555"
|
||||
@ -21,8 +21,8 @@ def convert_pickle_to_json(conn, table_name: str, column_name: str) -> None:
|
||||
Convert a PickleType column to JSON for all rows in a table.
|
||||
"""
|
||||
|
||||
import pickle
|
||||
import json
|
||||
import pickle
|
||||
|
||||
result = conn.execute(sa.text(f"SELECT template_id, {column_name} FROM {table_name}"))
|
||||
for row in result:
|
||||
@ -49,8 +49,8 @@ def convert_json_to_pickle(conn, table_name: str, column_name: str) -> None:
|
||||
Convert a JSON column to PickleType for all rows in a table.
|
||||
"""
|
||||
|
||||
import pickle
|
||||
import json
|
||||
import pickle
|
||||
|
||||
result = conn.execute(sa.text(f"SELECT template_id, {column_name} FROM {table_name}"))
|
||||
for row in result:
|
||||
|
||||
@ -6,8 +6,9 @@ Create Date: 2026-06-11 10:00:00.000000
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
import gns3server.db.models.base as models
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
|
||||
@ -17,12 +17,11 @@
|
||||
|
||||
"""Provide a pretty logging on console"""
|
||||
|
||||
import gzip
|
||||
import logging
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
import gzip
|
||||
|
||||
import sys
|
||||
from logging.handlers import RotatingFileHandler
|
||||
|
||||
|
||||
|
||||
@ -25,14 +25,14 @@ Entry point of the server. It's support daemonize the process
|
||||
# if is not writetable the application crash. It's the user fault
|
||||
# because one day the user as used sudo to run an egg and break his
|
||||
# filesystem permissions, but it's a common mistake.
|
||||
import gns3server.utils.get_resource
|
||||
|
||||
import os
|
||||
import sys
|
||||
import asyncio
|
||||
import argparse
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
import resource
|
||||
import sys
|
||||
|
||||
import gns3server.utils.get_resource
|
||||
|
||||
|
||||
def daemonize():
|
||||
|
||||
@ -20,25 +20,25 @@
|
||||
Start the program. Use main.py to load it.
|
||||
"""
|
||||
|
||||
import os
|
||||
import datetime
|
||||
import locale
|
||||
import psutil
|
||||
import sys
|
||||
import asyncio
|
||||
import signal
|
||||
import datetime
|
||||
import functools
|
||||
import uvicorn
|
||||
import locale
|
||||
import logging
|
||||
import os
|
||||
import secrets
|
||||
import signal
|
||||
import string
|
||||
import sys
|
||||
|
||||
import psutil
|
||||
import uvicorn
|
||||
from pydantic import SecretStr, ValidationError
|
||||
|
||||
from gns3server.logger import init_logger
|
||||
from gns3server.version import __version__
|
||||
from gns3server.config import Config
|
||||
from gns3server.crash_report import CrashReport
|
||||
from pydantic import ValidationError, SecretStr
|
||||
|
||||
import logging
|
||||
from gns3server.logger import init_logger
|
||||
from gns3server.version import __version__
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -16,14 +16,14 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import sys
|
||||
import re
|
||||
import shlex
|
||||
import textwrap
|
||||
import posixpath
|
||||
import socket
|
||||
import errno
|
||||
import hashlib
|
||||
import posixpath
|
||||
import re
|
||||
import shlex
|
||||
import socket
|
||||
import sys
|
||||
import textwrap
|
||||
|
||||
|
||||
def force_unix_path(path):
|
||||
|
||||
@ -15,10 +15,10 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from gns3server.controller.controller_error import ControllerError
|
||||
|
||||
import logging
|
||||
|
||||
from gns3server.controller.controller_error import ControllerError
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
# IOU draws from the lower half: uBridge's iol_bridge uses application_id + 512
|
||||
|
||||
@ -15,12 +15,12 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import functools
|
||||
import asyncio
|
||||
import sys
|
||||
import os
|
||||
import threading
|
||||
import functools
|
||||
import inspect
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
|
||||
|
||||
async def wait_run_in_executor(func, *args, **kwargs):
|
||||
|
||||
@ -22,16 +22,17 @@ Derived directly from zipfile.py and the zipstream project
|
||||
https://github.com/allanlei/python-zipstream
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
import stat
|
||||
import struct
|
||||
import sys
|
||||
import time
|
||||
import zipfile
|
||||
import asyncio
|
||||
import aiofiles
|
||||
from concurrent import futures
|
||||
|
||||
import aiofiles
|
||||
|
||||
structCentralDir = "<4s4B4HL2L5H2L"
|
||||
structEndArchive64 = "<4sQ2H2L4Q"
|
||||
structEndArchive = b"<4s4H2LH"
|
||||
|
||||
@ -16,24 +16,24 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import sys
|
||||
import asyncio
|
||||
import inspect
|
||||
import io
|
||||
import sys
|
||||
|
||||
from prompt_toolkit import prompt
|
||||
from prompt_toolkit.history import InMemoryHistory
|
||||
from prompt_toolkit.contrib.completers import WordCompleter
|
||||
from prompt_toolkit.enums import DEFAULT_BUFFER
|
||||
from prompt_toolkit.eventloop.base import EventLoop
|
||||
from prompt_toolkit.history import InMemoryHistory
|
||||
from prompt_toolkit.input import StdinInput
|
||||
from prompt_toolkit.interface import CommandLineInterface
|
||||
from prompt_toolkit.layout.screen import Size
|
||||
from prompt_toolkit.shortcuts import create_prompt_application, create_asyncio_eventloop
|
||||
from prompt_toolkit.shortcuts import create_asyncio_eventloop, create_prompt_application
|
||||
from prompt_toolkit.terminal.vt100_output import Vt100_Output
|
||||
from prompt_toolkit.input import StdinInput
|
||||
|
||||
from gns3server.utils.asyncio.telnet_server import AsyncioTelnetServer, TelnetConnection
|
||||
from gns3server.utils.asyncio.input_stream import InputStream
|
||||
from gns3server.utils.asyncio.telnet_server import AsyncioTelnetServer, TelnetConnection
|
||||
|
||||
|
||||
class EmbedShell:
|
||||
|
||||
@ -5,11 +5,10 @@ Parser for VT100 input stream.
|
||||
# Copied from prompt_toolkit/terminal/vt100_input.py due to dependency on termios (which is not available on Windows)
|
||||
|
||||
import re
|
||||
|
||||
import six
|
||||
|
||||
|
||||
from prompt_toolkit.keys import Keys
|
||||
from prompt_toolkit.key_binding.input_processor import KeyPress
|
||||
from prompt_toolkit.keys import Keys
|
||||
|
||||
# __all__ = (
|
||||
# 'InputStream',
|
||||
|
||||
@ -15,8 +15,8 @@
|
||||
# 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 asyncio
|
||||
import sys
|
||||
|
||||
|
||||
class Pool:
|
||||
|
||||
@ -14,12 +14,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 re
|
||||
import copy
|
||||
import asyncio
|
||||
import asyncio.subprocess
|
||||
|
||||
import copy
|
||||
import logging
|
||||
import re
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
|
||||
import asyncio
|
||||
|
||||
from gns3server.utils.asyncio import wait_for_file_creation
|
||||
from gns3server.compute.error import NodeError
|
||||
from gns3server.utils.asyncio import wait_for_file_creation
|
||||
|
||||
"""
|
||||
This module handle connection to unix socket
|
||||
|
||||
@ -14,9 +14,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 time
|
||||
|
||||
import psutil
|
||||
|
||||
|
||||
class CpuPercent:
|
||||
"""
|
||||
|
||||
@ -19,9 +19,10 @@ Encryption utilities for sensitive data like API keys.
|
||||
Uses Fernet symmetric encryption.
|
||||
"""
|
||||
|
||||
import os
|
||||
import logging
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
from cryptography.fernet import Fernet
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -15,11 +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 zlib
|
||||
import asyncio
|
||||
import os
|
||||
|
||||
import logging
|
||||
import os
|
||||
import zlib
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -15,11 +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 aiohttp
|
||||
from pydantic import SecretStr
|
||||
import logging
|
||||
import socket
|
||||
|
||||
import logging
|
||||
import aiohttp
|
||||
from pydantic import SecretStr
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -14,30 +14,31 @@
|
||||
# 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 hashlib
|
||||
import stat
|
||||
import aiofiles
|
||||
import asyncio
|
||||
import hashlib
|
||||
import os
|
||||
import stat
|
||||
import tempfile
|
||||
|
||||
from gns3server.utils.image_inventory import fingerprint, stat_fingerprint, image_lock, publish_image, contained_path
|
||||
import aiofiles
|
||||
|
||||
from gns3server.utils.image_inventory import contained_path, fingerprint, image_lock, publish_image, stat_fingerprint
|
||||
|
||||
try:
|
||||
import importlib_resources
|
||||
except ImportError:
|
||||
from importlib import resources as importlib_resources
|
||||
|
||||
from typing import List, AsyncGenerator
|
||||
from ..config import Config
|
||||
from . import force_unix_path
|
||||
import logging
|
||||
from io import DEFAULT_BUFFER_SIZE
|
||||
from typing import AsyncGenerator, List
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server.db.repositories.images import ImagesRepository
|
||||
from gns3server.utils.asyncio import wait_run_in_executor
|
||||
|
||||
import logging
|
||||
from ..config import Config
|
||||
from . import force_unix_path
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -16,9 +16,10 @@
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
import socket
|
||||
import struct
|
||||
import sys
|
||||
|
||||
import psutil
|
||||
|
||||
from gns3server.compute.compute_error import ComputeError
|
||||
@ -94,8 +95,8 @@ def get_windows_interfaces():
|
||||
:returns: list of windows interfaces
|
||||
"""
|
||||
|
||||
import win32com.client
|
||||
import pywintypes
|
||||
import win32com.client
|
||||
|
||||
interfaces = []
|
||||
try:
|
||||
|
||||
@ -17,14 +17,14 @@
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
import time
|
||||
|
||||
import psutil
|
||||
|
||||
from gns3server.utils.cpu_percent import CpuPercent
|
||||
from gns3server.utils.path import get_default_project_directory
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ Packet filter parameter validation utilities.
|
||||
|
||||
import logging
|
||||
import subprocess
|
||||
from typing import Dict, List, Any, Optional
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -16,9 +16,10 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from fastapi import HTTPException, status
|
||||
|
||||
from ..config import Config
|
||||
|
||||
|
||||
|
||||
@ -15,8 +15,8 @@
|
||||
# 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 io
|
||||
import re
|
||||
import struct
|
||||
from xml.etree.ElementTree import ElementTree, ParseError
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
|
||||
import hashlib
|
||||
|
||||
|
||||
# Display/port allocation range (stable across process restarts)
|
||||
DISPLAY_RANGE = 10000
|
||||
DISPLAY_MODULO = 10000
|
||||
|
||||
@ -6,8 +6,8 @@ from ASGI scope dictionaries for logging and debugging purposes.
|
||||
"""
|
||||
|
||||
import logging
|
||||
from typing import Any, Dict, Optional
|
||||
from urllib.parse import parse_qs
|
||||
from typing import Dict, Any, Optional
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -7,10 +7,10 @@ Usage:
|
||||
gns3server-uninstall-ai-features -y
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def _find_base_dir():
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
import argparse
|
||||
import re
|
||||
|
||||
|
||||
UUID_PATTERN = re.compile(r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", re.IGNORECASE)
|
||||
|
||||
|
||||
|
||||
@ -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 sys
|
||||
import os
|
||||
import ipaddress
|
||||
import argparse
|
||||
import ipaddress
|
||||
import os
|
||||
import shutil
|
||||
|
||||
import sys
|
||||
from collections import OrderedDict
|
||||
|
||||
if sys.platform.startswith("darwin"):
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# NOTE: this patches the standard zipfile module
|
||||
from . import _zipfile
|
||||
|
||||
from zipfile import *
|
||||
|
||||
from . import _zipfile
|
||||
from ._zipfile import (
|
||||
ZIP_ZSTANDARD,
|
||||
ZSTANDARD_VERSION,
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import zipfile as _zipfile_module
|
||||
import zstandard as zstd
|
||||
import inspect
|
||||
import zipfile as _zipfile_module
|
||||
from typing import Any
|
||||
|
||||
import zstandard as zstd
|
||||
|
||||
from ._patcher import patch
|
||||
|
||||
zipfile: Any = _zipfile_module
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user