style: sort imports in compute, db and services modules

This commit is contained in:
Mark Paronyan committed 2026-10-02 12:43:26 +03:00
1 parent 38e9ddca09
commit b9cdac487c
42 files changed
+247 -256

No files matched your search

+6 -5
View File
@@ -14,18 +14,19 @@
# 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 uuid import UUID
from typing import Optional, List, cast
import logging
from datetime import datetime, timezone
from sqlalchemy import select, update, delete, func
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
from .base import BaseRepository
import gns3server.db.models as models
import logging
from .base import BaseRepository
log = logging.getLogger(__name__)
+6 -6
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/>.
from typing import List, Optional, Union, cast
from uuid import UUID
from typing import Optional, List, Union
from sqlalchemy import select, update, delete
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.engine import CursorResult
from typing import cast
from .base import BaseRepository
from sqlalchemy import delete, select, update
from sqlalchemy.engine import CursorResult
from sqlalchemy.ext.asyncio import AsyncSession
import gns3server.db.models as models
from gns3server import schemas
from .base import BaseRepository
class ComputesRepository(BaseRepository):
def __init__(self, db_session: AsyncSession) -> None:
+8 -9
View File
@@ -15,23 +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 os
import asyncio
import logging
import os
from datetime import datetime, timezone
from typing import Callable, List, Optional, cast
from typing import Optional, List, Callable, cast
from sqlalchemy import select, delete, update
from sqlalchemy import delete, select, update
from sqlalchemy.engine import CursorResult
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.asyncio import AsyncSession
import gns3server.db.models as models
from gns3server.utils.image_inventory import fingerprint, image_lock, normalized_path
from .base import BaseRepository
import gns3server.db.models as models
import logging
log = logging.getLogger(__name__)
@@ -73,7 +72,7 @@ class ImagesRepository(BaseRepository):
async def is_usable(self, image: models.Image) -> bool:
"""Validate a checksum candidate without trusting stale catalog/sidecar data."""
from gns3server.utils.images import inspect_image_file, InvalidImageError
from gns3server.utils.images import InvalidImageError, inspect_image_file
try:
current = await asyncio.to_thread(fingerprint, image.path)
@@ -15,16 +15,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/>.
from uuid import UUID
from typing import Optional, List, Dict, Any, cast
from sqlalchemy import select, update, delete, and_
from sqlalchemy.engine import CursorResult
from datetime import datetime
import logging
from datetime import datetime
from typing import Any, Dict, List, Optional, cast
from uuid import UUID
from sqlalchemy import and_, delete, select, update
from sqlalchemy.engine import CursorResult
import gns3server.db.models as models
from .base import BaseRepository
import gns3server.db.models as models
log = logging.getLogger(__name__)
+5 -5
View File
@@ -15,19 +15,19 @@
# 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 typing import List, Optional, Union, cast
from uuid import UUID
from typing import Optional, List, Union, cast
from sqlalchemy import select, update, delete
from sqlalchemy import delete, select, update
from sqlalchemy.engine import CursorResult
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import selectinload
from .base import BaseRepository
import gns3server.db.models as models
from gns3server import schemas
import logging
from .base import BaseRepository
log = logging.getLogger(__name__)
+6 -6
View File
@@ -15,20 +15,20 @@
# 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 uuid import UUID
import logging
from typing import List, Optional, Union, cast
from urllib.parse import urlparse
from typing import Optional, List, Union, cast
from sqlalchemy import select, update, delete
from uuid import UUID
from sqlalchemy import delete, select, update
from sqlalchemy.engine import CursorResult
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import selectinload
from .base import BaseRepository
import gns3server.db.models as models
from gns3server import schemas
import logging
from .base import BaseRepository
log = logging.getLogger(__name__)
+6 -6
View File
@@ -15,25 +15,25 @@
# 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 uuid
import logging
from typing import List, Optional, Union, cast
from uuid import UUID
from typing import List, Union, Optional, cast
from sqlalchemy import select, delete
from sqlalchemy import delete, select
from sqlalchemy.engine import CursorResult
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import selectinload
from sqlalchemy.orm.session import make_transient
from .base import BaseRepository
import gns3server.db.models as models
from gns3server import schemas
from gns3server.utils.image_inventory import image_lock
from gns3server.controller.controller_error import ControllerNotFoundError
from .base import BaseRepository
log = logging.getLogger(__name__)
TEMPLATE_TYPE_TO_MODEL = {
+5 -5
View File
@@ -15,20 +15,20 @@
# 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 typing import List, Optional, Union, cast
from uuid import UUID
from typing import Optional, List, Union, cast
from sqlalchemy import select, update, delete, func
from sqlalchemy import delete, func, select, update
from sqlalchemy.engine import CursorResult
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import selectinload
from .base import BaseRepository
import gns3server.db.models as models
from gns3server import schemas
from gns3server.services import auth_service
import logging
from .base import BaseRepository
log = logging.getLogger(__name__)