From f760f1de681bde8e24674918286353dba35a297b Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Fri, 17 Mar 2023 14:30:52 +0100 Subject: [PATCH] linter --- .../simcore_service_catalog/db/repositories/services.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/services/catalog/src/simcore_service_catalog/db/repositories/services.py b/services/catalog/src/simcore_service_catalog/db/repositories/services.py index c0b01051476..a30ce8d6905 100644 --- a/services/catalog/src/simcore_service_catalog/db/repositories/services.py +++ b/services/catalog/src/simcore_service_catalog/db/repositories/services.py @@ -1,6 +1,5 @@ import logging from collections import defaultdict -from distutils.version import Version from itertools import chain from typing import Any, Iterable, Optional, cast @@ -143,8 +142,8 @@ async def list_service_releases( releases.append(ServiceMetaDataAtDB.from_orm(row)) # Now sort naturally from latest first: (This is lame, the sorting should be done in the db) - def _by_version(x: ServiceMetaDataAtDB) -> Version: - return cast(Version, packaging.version.parse(x.version)) + def _by_version(x: ServiceMetaDataAtDB) -> packaging.version.Version: + return cast(packaging.version.Version, packaging.version.parse(x.version)) releases_sorted = sorted(releases, key=_by_version, reverse=True) return releases_sorted @@ -269,7 +268,7 @@ async def get_service_access_rights( async with self.db_engine.connect() as conn: async for row in await conn.stream(query): - services_in_db.append(ServiceAccessRightsAtDB(**row)) + services_in_db.append(ServiceAccessRightsAtDB.from_orm(row)) return services_in_db async def list_services_access_rights( @@ -298,7 +297,7 @@ async def list_services_access_rights( row[services_access_rights.c.key], row[services_access_rights.c.version], ) - ].append(ServiceAccessRightsAtDB(**row)) + ].append(ServiceAccessRightsAtDB.from_orm(row)) return service_to_access_rights async def upsert_service_access_rights(