Don't ignore H306 pep8 check

H306: import in alphabeical order

Imports should be grouped in the following order:
standard library imports
related third party imports
local application/library specific imports
put a blank line between each group of imports.
https://docs.openstack.org/hacking/latest/user/hacking.html#imports

Change-Id: I2c188d27f0595ac3b2d71f4612d93829915e389c
This commit is contained in:
wu.chunyang 2023-05-30 17:51:16 +08:00
parent e854cb5853
commit c1761147ba
48 changed files with 95 additions and 85 deletions

View File

@ -16,8 +16,8 @@ import re
from oslo_log import log as logging
from backup import utils
from backup.drivers import base
from backup import utils
from backup.utils import postgresql as psql_util
LOG = logging.getLogger(__name__)

View File

@ -15,8 +15,8 @@
import hashlib
import json
from keystoneauth1 import session
from keystoneauth1.identity import v3
from keystoneauth1 import session
from oslo_config import cfg
from oslo_log import log as logging
import swiftclient

View File

@ -58,8 +58,9 @@ ignore-path = .venv,.tox,.git,dist,doc,*egg-info,tools,etc,build,*.po,*.pot,inte
[flake8]
show-source = True
ignore = E125,E129,E402,E731,F601,F821,H301,H306,H404,H405,H501,W503,W504,W605
ignore = E125,E129,E402,E731,F601,F821,H301,H404,H405,H501,W503,W504,W605
enable-extensions = H203,H106
import-order-style = pep8
builtins = _
# add *.yaml for playbooks/trove-devstack-base.yaml, as it will be matched by
# trove-* in the "filename" configuration.

View File

@ -24,9 +24,9 @@ from trove.common import cfg
from trove.common import clients
from trove.common import constants
from trove.common import exception
from trove.common.i18n import _
from trove.common import swift
from trove.common import utils
from trove.common.i18n import _
from trove.datastore import models as datastore_models
from trove.db.models import DatabaseModelBase
from trove.quota.quota import run_with_quotas

View File

@ -16,17 +16,17 @@
from oslo_log import log as logging
from oslo_utils import strutils
from trove.backup import views
from trove.backup.models import Backup
from trove.backup.models import BackupStrategy
from trove.backup import views
from trove.common import apischema
from trove.common import exception
from trove.common import notification
from trove.common.notification import StartNotification
from trove.common import pagination
from trove.common import policy
from trove.common import utils
from trove.common import wsgi
from trove.common.notification import StartNotification
LOG = logging.getLogger(__name__)

View File

@ -20,8 +20,8 @@ import os.path
from keystoneauth1 import loading
from keystonemiddleware import auth_token
from oslo_config import cfg
from oslo_config import types
from oslo_config.cfg import NoSuchOptError
from oslo_config import types
from oslo_log import log as logging
from oslo_log import versionutils
from oslo_middleware import cors

View File

@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import netaddr
from neutronclient.common import exceptions as neutron_exceptions
from oslo_cache import core
from oslo_log import log as logging
from neutronclient.common import exceptions as neutron_exceptions
from trove.common import cache
from trove.common import cfg

View File

@ -17,17 +17,18 @@ from eventlet.timeout import Timeout
from oslo_log import log as logging
from trove.common import cfg
from trove.common import utils
from trove.common.exception import PollTimeOut
from trove.common.strategies.cluster import base
from trove.common import utils
from trove.instance import models
from trove.instance import tasks as inst_tasks
from trove.instance.models import DBInstance
from trove.instance.models import Instance
from trove.instance.service_status import ServiceStatuses
from trove.instance import tasks as inst_tasks
from trove.taskmanager import api as task_api
from trove.taskmanager import models as task_models
LOG = logging.getLogger(__name__)
CONF = cfg.CONF

View File

@ -15,8 +15,8 @@
import abc
import ast
import csv
import configparser
import csv
import io
import re
import sys

View File

@ -19,8 +19,8 @@ import inspect
import os
import shlex
import shutil
import uuid
import urllib.parse as urlparse
import uuid
from eventlet.timeout import Timeout
import jinja2

View File

@ -16,8 +16,8 @@
from sqlalchemy.schema import Column
from sqlalchemy.schema import MetaData
from trove.db.sqlalchemy.migrate_repo.schema import Table
from trove.db.sqlalchemy.migrate_repo.schema import String
from trove.db.sqlalchemy.migrate_repo.schema import Table
def upgrade(migrate_engine):

View File

@ -14,15 +14,15 @@
# under the License.
from migrate.changeset.constraint import UniqueConstraint
from sqlalchemy import text
from sqlalchemy.schema import Column
from sqlalchemy.schema import MetaData
from sqlalchemy.sql.expression import select
from sqlalchemy.sql.expression import update
from sqlalchemy import text
from trove.db.sqlalchemy import utils as db_utils
from trove.db.sqlalchemy.migrate_repo.schema import String
from trove.db.sqlalchemy.migrate_repo.schema import Table
from trove.db.sqlalchemy import utils as db_utils
def upgrade(migrate_engine):

View File

@ -16,12 +16,12 @@ from oslo_log import log as logging
from trove.backup import models as backup_model
from trove.common import apischema
from trove.common.auth import admin_context
from trove.common import clients
from trove.common import exception
from trove.common import glance as common_glance
from trove.common import utils
from trove.common import wsgi
from trove.common.auth import admin_context
from trove.configuration import models as config_model
from trove.datastore import models
from trove.extensions.mgmt.datastores import views

View File

@ -26,9 +26,9 @@ import tempfile
from oslo_concurrency.processutils import UnknownArgumentError
from trove.common import exception
from trove.common import utils
from trove.common.i18n import _
from trove.common.stream_codecs import IdentityCodec
from trove.common import utils
REDHAT = 'redhat'
DEBIAN = 'debian'

View File

@ -26,15 +26,15 @@ from trove.common import cfg
from trove.common import exception
from trove.common.i18n import _
from trove.common.notification import EndNotification
from trove.guestagent import dbaas
from trove.guestagent import guest_log
from trove.guestagent import volume
from trove.guestagent.common import guestagent_utils
from trove.guestagent.common import operating_system
from trove.guestagent.common.operating_system import FileMode
from trove.guestagent import dbaas
from trove.guestagent import guest_log
from trove.guestagent.module import driver_manager
from trove.guestagent.module import module_manager
from trove.guestagent.strategies import replication as repl_strategy
from trove.guestagent import volume
from trove.instance import service_status
LOG = logging.getLogger(__name__)

View File

@ -16,10 +16,10 @@
from oslo_log import log as logging
from trove.common import exception
from trove.common import utils
from trove.guestagent.datastore.mysql_common import service as mysql_service
from trove.guestagent.utils import mysql as mysql_util
from trove.common import utils
from trove.common import exception
LOG = logging.getLogger(__name__)

View File

@ -22,11 +22,11 @@ from oslo_log import log as logging
from trove.common import cfg
from trove.common import configurations
from trove.common import exception
from trove.common import utils
from trove.common.notification import EndNotification
from trove.guestagent import guest_log
from trove.common import utils
from trove.guestagent.common import operating_system
from trove.guestagent.datastore import manager
from trove.guestagent import guest_log
from trove.guestagent.utils import docker as docker_util
from trove.guestagent.utils import mysql as mysql_util
from trove.instance import service_status

View File

@ -25,16 +25,16 @@ from sqlalchemy import exc
from sqlalchemy.sql.expression import text
from trove.common import cfg
from trove.common import exception
from trove.common import utils
from trove.common.configurations import MySQLConfParser
from trove.common.db.mysql import models
from trove.common import exception
from trove.common.i18n import _
from trove.common import utils
from trove.guestagent.common.configuration import ConfigurationManager
from trove.guestagent.common.configuration import ImportOverrideStrategy
from trove.guestagent.common import guestagent_utils
from trove.guestagent.common import operating_system
from trove.guestagent.common import sql_query
from trove.guestagent.common.configuration import ConfigurationManager
from trove.guestagent.common.configuration import ImportOverrideStrategy
from trove.guestagent.datastore import service
from trove.guestagent.utils import docker as docker_util
from trove.guestagent.utils import mysql as mysql_util

View File

@ -19,12 +19,12 @@ from oslo_service import periodic_task
from trove.common import cfg
from trove.common import exception
from trove.common import utils
from trove.common.notification import EndNotification
from trove.guestagent import guest_log
from trove.common import utils
from trove.guestagent.common import operating_system
from trove.guestagent.datastore import manager
from trove.guestagent.datastore.postgres import service
from trove.guestagent import guest_log
LOG = logging.getLogger(__name__)
CONF = cfg.CONF

View File

@ -17,15 +17,15 @@ from oslo_log import log as logging
import psycopg2
from trove.common import cfg
from trove.common.db.postgresql import models
from trove.common import exception
from trove.common import stream_codecs
from trove.common import utils
from trove.common.db.postgresql import models
from trove.guestagent.common import configuration
from trove.guestagent.common import guestagent_utils
from trove.guestagent.common import operating_system
from trove.guestagent.datastore import service
from trove.guestagent.datastore.postgres import query
from trove.guestagent.datastore import service
from trove.guestagent.utils import docker as docker_util
from trove.instance import service_status

View File

@ -23,8 +23,8 @@ from trove.backup.state import BackupState
from trove.common import cfg
from trove.common import context as trove_context
from trove.common import exception
from trove.common import stream_codecs
from trove.common.i18n import _
from trove.common import stream_codecs
from trove.conductor import api as conductor_api
from trove.guestagent.common import guestagent_utils
from trove.guestagent.common import operating_system

View File

@ -21,9 +21,9 @@ from oslo_log import log as logging
from oslo_utils import netutils
from trove.common import cfg
from trove.common.db.mysql import models
from trove.common import exception
from trove.common import utils
from trove.common.db.mysql import models
from trove.guestagent.common import operating_system
from trove.guestagent.strategies.replication import base

View File

@ -17,9 +17,9 @@ from oslo_log import log as logging
from oslo_utils import netutils
from trove.common import cfg
from trove.common.db.postgresql import models
from trove.common import exception
from trove.common import utils
from trove.common.db.postgresql import models
from trove.guestagent.common import operating_system
from trove.guestagent.common.operating_system import FileMode
from trove.guestagent.datastore.postgres import service as pg_service

View File

@ -35,18 +35,18 @@ from trove.common import cfg
from trove.common import clients
from trove.common import crypto_utils as cu
from trove.common import exception
from trove.common.i18n import _
from trove.common import neutron
from trove.common import notification
from trove.common import server_group as srv_grp
from trove.common import template
from trove.common import timeutils
from trove.common import utils
from trove.common.i18n import _
from trove.common.trove_remote import create_trove_client
from trove.common import utils
from trove.configuration.models import Configuration
from trove.datastore import models as datastore_models
from trove.datastore.models import DBDatastoreVersionMetadata
from trove.datastore.models import DatastoreVersionMetadata as dvm
from trove.datastore.models import DBDatastoreVersionMetadata
from trove.db import get_db_api
from trove.db import models as dbmodels
from trove.extensions.security_group.models import SecurityGroup

View File

@ -21,24 +21,19 @@ from eventlet.timeout import Timeout
from oslo_log import log as logging
from swiftclient.client import ClientException
from trove import rpc
from trove.backup import models as bkup_models
from trove.backup.models import Backup
from trove.backup.models import DBBackup
from trove.backup.state import BackupState
from trove.cluster import tasks
from trove.cluster.models import Cluster
from trove.cluster.models import DBCluster
from trove.cluster import tasks
from trove.common import cfg
from trove.common import clients
from trove.common import exception
from trove.common import neutron
from trove.common import template
from trove.common import timeutils
from trove.common import utils
from trove.common.clients import create_cinder_client
from trove.common.clients import create_dns_client
from trove.common.clients import create_guest_client
from trove.common import exception
from trove.common.exception import BackupCreationError
from trove.common.exception import GuestError
from trove.common.exception import GuestTimeout
@ -47,6 +42,7 @@ from trove.common.exception import PollTimeOut
from trove.common.exception import TroveError
from trove.common.exception import VolumeCreationFailure
from trove.common.i18n import _
from trove.common import neutron
from trove.common.notification import DBaaSInstanceRestart
from trove.common.notification import DBaaSInstanceUpgrade
from trove.common.notification import EndNotification
@ -54,20 +50,24 @@ from trove.common.notification import StartNotification
from trove.common.notification import TroveInstanceCreate
from trove.common.notification import TroveInstanceModifyFlavor
from trove.common.strategies.cluster import strategy
from trove.common import template
from trove.common import timeutils
from trove.common import utils
from trove.common.utils import try_recover
from trove.configuration import models as config_models
from trove.extensions.mysql import models as mysql_models
from trove.instance import models as inst_models
from trove.instance import service_status as srvstatus
from trove.instance.models import DBInstance
from trove.instance.models import FreshInstance
from trove.instance.models import Instance
from trove.instance.models import InstanceServiceStatus
from trove.instance.models import InstanceStatus
from trove.instance import service_status as srvstatus
from trove.instance.tasks import InstanceTasks
from trove.module import models as module_models
from trove.module import views as module_views
from trove.quota.quota import run_with_quotas
from trove import rpc
LOG = logging.getLogger(__name__)
CONF = cfg.CONF

View File

@ -25,9 +25,9 @@ from proboscis import test
from troveclient.compat import exceptions
from trove import tests
from trove.tests.api import configurations
from trove.tests.api.instances import instance_info
from trove.tests.config import CONFIG
from trove.tests.api import configurations
def do_not_delete_instance():

View File

@ -21,15 +21,15 @@ from oslo_messaging._drivers.common import RPCException
from proboscis import test
from testtools import TestCase
from trove.common import template
from trove.common import utils
from trove.common.exception import PollTimeOut
from trove.common.exception import TroveError
from trove.common import template
from trove.common import utils
from trove.datastore.models import DatastoreVersion
from trove.guestagent import api as guest
from trove.instance import service_status as srvstatus
from trove.instance.models import DBInstance
from trove.instance.models import InstanceServiceStatus
from trove.instance import service_status as srvstatus
from trove.instance.tasks import InstanceTasks
from trove.taskmanager import models
from trove.tests.fakes import nova

View File

@ -16,21 +16,21 @@ from unittest import mock
from novaclient.v2.servers import Server
from proboscis import after_class
from proboscis.asserts import assert_equal
from proboscis.asserts import assert_raises
from proboscis import before_class
from proboscis import SkipTest
from proboscis import test
from proboscis.asserts import assert_equal
from proboscis.asserts import assert_raises
from trove.backup import models as backup_models
from trove.backup import state
from trove.common import exception
from trove.common.context import TroveContext
from trove.common import exception
from trove.extensions.mgmt.instances.models import MgmtInstance
from trove.extensions.mgmt.instances.service import MgmtInstanceController
from trove.instance import models as imodels
from trove.instance import service_status as srvstatus
from trove.instance.models import DBInstance
from trove.instance import service_status as srvstatus
from trove.instance.tasks import InstanceTasks
from trove.tests.config import CONFIG
from trove.tests.util import create_dbaas_client

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import http
from hashlib import md5
import http
from unittest.mock import MagicMock, patch
import json
import os

View File

@ -17,10 +17,10 @@
Tests dealing with HTTP rate-limiting.
"""
import io
from http import client as http_client
import io
from unittest.mock import Mock, MagicMock, patch
from oslo_serialization import jsonutils
import webob

View File

@ -20,8 +20,8 @@ import jsonschema
from testtools.matchers import Equals
from trove.backup import models
from trove.backup import state
from trove.backup.service import BackupController
from trove.backup import state
from trove.common import apischema
from trove.common import context
from trove.common import wsgi

View File

@ -16,6 +16,7 @@ import datetime
from unittest.mock import DEFAULT
from unittest.mock import MagicMock
from unittest.mock import patch
from swiftclient.client import ClientException
from trove.backup import models

View File

@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import uuid
from unittest.mock import Mock
from unittest.mock import patch
import uuid
from trove.cluster.models import Cluster
from trove.cluster.models import ClusterTasks
from trove.cluster.models import DBCluster

View File

@ -11,11 +11,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import uuid
from unittest.mock import Mock
from unittest.mock import patch
import uuid
from novaclient import exceptions as nova_exceptions
from trove.cluster.models import Cluster
from trove.cluster.models import ClusterTasks
from trove.cluster.models import DBCluster

View File

@ -11,11 +11,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import uuid
from unittest.mock import Mock
from unittest.mock import patch
import uuid
from novaclient import exceptions as nova_exceptions
from trove.cluster.models import Cluster
from trove.cluster.models import ClusterTasks
from trove.cluster.models import DBCluster

View File

@ -14,6 +14,7 @@
from unittest.mock import Mock
from unittest.mock import patch
from oslo_upgradecheck.upgradecheck import Code
from trove.cmd import status

View File

@ -18,14 +18,14 @@ from unittest.mock import patch
from oslo_utils import timeutils
from trove import rpc
from trove.common import cfg
from trove.common.context import TroveContext
from trove.common import exception
from trove.common import notification
from trove.common.context import TroveContext
from trove.common.notification import EndNotification
from trove.common.notification import StartNotification
from trove.conductor import api as conductor_api
from trove import rpc
from trove.tests.unittests import trove_testtools

View File

@ -14,6 +14,7 @@
from unittest.mock import MagicMock
from unittest.mock import patch
from oslo_service import service as os_service
from trove.cmd import common as common_cmd

View File

@ -13,6 +13,7 @@
# under the License.
from unittest.mock import patch
from oslo_utils import timeutils
from trove.backup import models as bkup_models

View File

@ -16,6 +16,7 @@
from unittest.mock import call
from unittest.mock import Mock
from unittest.mock import patch
from sqlalchemy.engine import reflection
from sqlalchemy.schema import Column

View File

@ -16,6 +16,7 @@
from unittest.mock import Mock
from unittest.mock import patch
from oslo_config.cfg import NoSuchOptError
from trove.common import exception

View File

@ -16,11 +16,11 @@
from testtools.matchers import Equals
from testtools.matchers import Is
from testtools.matchers import Not
import uuid
from unittest.mock import ANY
from unittest.mock import MagicMock
from unittest.mock import patch
import uuid
from novaclient.client import Client
from novaclient.v2.flavors import Flavor
from novaclient.v2.flavors import FlavorManager
@ -28,17 +28,18 @@ from novaclient.v2.servers import Server
from novaclient.v2.servers import ServerManager
from oslo_config import cfg
from trove import rpc
from trove.backup.models import Backup
from trove.common import clients
from trove.common import exception
from trove.datastore import models as datastore_models
import trove.extensions.mgmt.instances.models as mgmtmodels
from trove.guestagent.api import API
from trove.instance import service_status as srvstatus
from trove.instance.models import DBInstance
from trove.instance.models import InstanceServiceStatus
from trove.instance import service_status as srvstatus
from trove.instance.tasks import InstanceTasks
from trove import rpc
from trove.tests.unittests import trove_testtools
from trove.tests.unittests.util import util

View File

@ -26,9 +26,9 @@ from trove.instance import models
from trove.instance.models import DBInstance
from trove.instance.models import DBInstanceFault
from trove.instance.models import Instance
from trove.instance.models import instance_encryption_key_cache
from trove.instance.models import InstanceServiceStatus
from trove.instance.models import SimpleInstance
from trove.instance.models import instance_encryption_key_cache
from trove.instance.service_status import ServiceStatuses
from trove.instance.tasks import InstanceTasks
from trove.taskmanager import api as task_api

View File

@ -14,9 +14,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
from unittest.mock import Mock
from unittest.mock import patch
from unittest import mock
from trove.common import context
from trove.common import exception

View File

@ -21,9 +21,9 @@ from unittest.mock import patch
from trove.cluster.models import ClusterTasks as ClusterTaskStatus
from trove.cluster.models import DBCluster
from trove.common import utils
from trove.common.strategies.cluster.experimental.mongodb.taskmanager import (
MongoDbClusterTasks as ClusterTasks)
from trove.common import utils
from trove.datastore import models as datastore_models
from trove.instance.models import BaseInstance
from trove.instance.models import DBInstance

View File

@ -13,43 +13,39 @@
# under the License.
import json
import os
from tempfile import NamedTemporaryFile
from unittest import mock
from unittest.mock import call
from unittest.mock import MagicMock
from unittest.mock import Mock
from unittest.mock import PropertyMock
from unittest.mock import call
from unittest.mock import patch
import cinderclient.v3.client as cinderclient
import neutronclient.v2_0.client as neutronclient
import novaclient.v2.flavors
import novaclient.v2.servers
from unittest.mock import PropertyMock
from cinderclient import exceptions as cinder_exceptions
import cinderclient.v3.client as cinderclient
from cinderclient.v3 import volumes as cinderclient_volumes
import neutronclient.v2_0.client as neutronclient
from novaclient import exceptions as nova_exceptions
import novaclient.v2.flavors
import novaclient.v2.servers
from oslo_config import cfg
from swiftclient.client import ClientException
from testtools.matchers import Equals
from testtools.matchers import Is
import trove.backup.models
import trove.common.context
import trove.common.template as template
import trove.db.models
import trove.guestagent.api
from trove import rpc
from trove.backup import models as backup_models
from trove.backup import state
from trove.common import exception
from trove.common import timeutils
from trove.common import utils
from trove.common.exception import GuestError
from trove.common.exception import PollTimeOut
from trove.common.exception import TroveError
from trove.common import timeutils
from trove.common import utils
from trove.datastore import models as datastore_models
from trove.extensions.common import models as common_models
from trove.extensions.mysql import models as mysql_models
@ -59,6 +55,7 @@ from trove.instance.models import InstanceServiceStatus
from trove.instance.models import InstanceStatus
from trove.instance.service_status import ServiceStatuses
from trove.instance.tasks import InstanceTasks
from trove import rpc
from trove.taskmanager import models as taskmanager_models
from trove.tests.unittests import trove_testtools
from trove.tests.unittests.util import util

View File

@ -16,7 +16,6 @@ import datetime
from unittest.mock import Mock
from unittest.mock import patch
from trove import rpc
from trove.cluster.models import ClusterTasks as ClusterTaskStatus
from trove.cluster.models import DBCluster
import trove.common.context as context
@ -34,6 +33,7 @@ from trove.instance.models import Instance
from trove.instance.models import InstanceServiceStatus
from trove.instance.models import InstanceTasks
from trove.instance.service_status import ServiceStatuses
from trove import rpc
from trove.tests.unittests import trove_testtools

View File

@ -14,6 +14,7 @@
# under the License.
#
from unittest.mock import patch
from trove.extensions.mgmt.upgrade.models import UpgradeMessageSender
from trove import rpc
from trove.tests.unittests import trove_testtools