From 206d19ec522332dc6ec342f126801e54ee74e8a2 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sat, 17 Feb 2024 11:48:37 +0900 Subject: [PATCH] Remove six from db module This is part of the steps to remove usage of six library, which is no longer needed since python 2 support was removed. Change-Id: I529759167f960714ebf93be7b89ee849040361b2 --- magnum/db/api.py | 4 +--- magnum/db/sqlalchemy/api.py | 3 +-- magnum/db/sqlalchemy/models.py | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/magnum/db/api.py b/magnum/db/api.py index 2727dc0ab4..ee8add5eb8 100644 --- a/magnum/db/api.py +++ b/magnum/db/api.py @@ -19,7 +19,6 @@ import abc from oslo_config import cfg from oslo_db import api as db_api -import six from magnum.common import profiler @@ -35,8 +34,7 @@ def get_instance(): @profiler.trace_cls("db") -@six.add_metaclass(abc.ABCMeta) -class Connection(object): +class Connection(object, metaclass=abc.ABCMeta): """Base class for storage system connections.""" @abc.abstractmethod diff --git a/magnum/db/sqlalchemy/api.py b/magnum/db/sqlalchemy/api.py index 46457a981a..f6f30877f6 100644 --- a/magnum/db/sqlalchemy/api.py +++ b/magnum/db/sqlalchemy/api.py @@ -13,7 +13,6 @@ # under the License. """SQLAlchemy storage backend.""" -import six from oslo_db import exception as db_exc from oslo_db.sqlalchemy import session as db_session @@ -440,7 +439,7 @@ class Connection(api.Connection): # NOTE(flwang): We only allow to update ClusterTemplate to be # public, hidden and rename if (not self._is_publishing_cluster_template(values) and - list(six.viewkeys(values)) != ["name"]): + list(values.keys()) != ["name"]): raise exception.ClusterTemplateReferenced( clustertemplate=cluster_template_id) diff --git a/magnum/db/sqlalchemy/models.py b/magnum/db/sqlalchemy/models.py index a35dd07331..fa31dfa853 100644 --- a/magnum/db/sqlalchemy/models.py +++ b/magnum/db/sqlalchemy/models.py @@ -15,10 +15,10 @@ """ SQLAlchemy models for container service """ +from urllib import parse as urlparse from oslo_db.sqlalchemy import models from oslo_serialization import jsonutils -import six.moves.urllib.parse as urlparse from sqlalchemy import Boolean from sqlalchemy import Column from sqlalchemy import DateTime