From: Zhiteng Huang Date: Fri, 27 Jun 2014 10:32:01 +0000 (+0800) Subject: Enable import group hacking rule X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=e0dae50dc8a10f85240d8a2e749e6437c36a695d;p=openstack-build%2Fcinder-build.git Enable import group hacking rule This change enables H305, H307 included in newly updated hacking 0.9 all violations are fixed. H305, H307 will check if imports are grouped in stdlib, 3rd libs and OpenStack components. Change-Id: I612cae64982450a9be5207dbe26a2b52da49dac6 --- diff --git a/bin/cinder-backup b/bin/cinder-backup index 1b474d3ba..1c502fa47 100755 --- a/bin/cinder-backup +++ b/bin/cinder-backup @@ -25,11 +25,10 @@ import warnings warnings.simplefilter('once', DeprecationWarning) import eventlet +from oslo.config import cfg eventlet.monkey_patch() -from oslo.config import cfg - # If ../cinder/__init__.py exists, add ../ to Python search path, so that # it will override what happens to be installed in /usr/(local/)lib/python... possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), diff --git a/bin/cinder-volume b/bin/cinder-volume index 8a51231cf..e2396c7ec 100755 --- a/bin/cinder-volume +++ b/bin/cinder-volume @@ -17,9 +17,10 @@ """Starter script for Cinder Volume.""" -import eventlet import os +import eventlet + if os.name == 'nt': # eventlet monkey patching the os module causes subprocess.Popen to fail # on Windows when using pipes due to missing non-blocking IO support. diff --git a/bin/cinder-volume-usage-audit b/bin/cinder-volume-usage-audit index caa1dee9f..09c8c428f 100755 --- a/bin/cinder-volume-usage-audit +++ b/bin/cinder-volume-usage-audit @@ -54,7 +54,6 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'cinder', '__init__.py')): from cinder import i18n i18n.enable_lazy() - from cinder import context from cinder import db from cinder.i18n import _ diff --git a/cinder/api/contrib/hosts.py b/cinder/api/contrib/hosts.py index 0d6dc4ea1..024d8f3bc 100644 --- a/cinder/api/contrib/hosts.py +++ b/cinder/api/contrib/hosts.py @@ -15,10 +15,10 @@ """The hosts admin extension.""" +from xml.parsers import expat from oslo.config import cfg import webob.exc -from xml.parsers import expat from cinder.api import extensions from cinder.api.openstack import wsgi diff --git a/cinder/api/contrib/volume_actions.py b/cinder/api/contrib/volume_actions.py index 88048d426..24dcb9cf4 100644 --- a/cinder/api/contrib/volume_actions.py +++ b/cinder/api/contrib/volume_actions.py @@ -12,9 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. -import webob from oslo import messaging +import webob from cinder.api import extensions from cinder.api.openstack import wsgi diff --git a/cinder/api/contrib/volume_transfer.py b/cinder/api/contrib/volume_transfer.py index f510aa694..05daea215 100644 --- a/cinder/api/contrib/volume_transfer.py +++ b/cinder/api/contrib/volume_transfer.py @@ -21,7 +21,6 @@ from cinder.api import extensions from cinder.api.openstack import wsgi from cinder.api.views import transfers as transfer_view from cinder.api import xmlutil - from cinder import exception from cinder.i18n import _ from cinder.openstack.common import log as logging diff --git a/cinder/api/openstack/wsgi.py b/cinder/api/openstack/wsgi.py index 657291dae..9e0c2102f 100644 --- a/cinder/api/openstack/wsgi.py +++ b/cinder/api/openstack/wsgi.py @@ -17,12 +17,12 @@ import inspect import math import time +from xml.dom import minidom +from xml.parsers import expat from lxml import etree import six import webob -from xml.dom import minidom -from xml.parsers import expat from cinder import exception from cinder import i18n diff --git a/cinder/api/urlmap.py b/cinder/api/urlmap.py index e3a9ee5fb..d1f2147e4 100644 --- a/cinder/api/urlmap.py +++ b/cinder/api/urlmap.py @@ -13,10 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. -import paste.urlmap import re import urllib2 +import paste.urlmap + from cinder.api.openstack import wsgi from cinder.openstack.common import log as logging diff --git a/cinder/api/v1/snapshot_metadata.py b/cinder/api/v1/snapshot_metadata.py index d1913f493..18c2dd4a0 100644 --- a/cinder/api/v1/snapshot_metadata.py +++ b/cinder/api/v1/snapshot_metadata.py @@ -14,13 +14,13 @@ # under the License. import webob +from webob import exc from cinder.api import common from cinder.api.openstack import wsgi from cinder import exception from cinder.i18n import _ from cinder import volume -from webob import exc class Controller(wsgi.Controller): diff --git a/cinder/api/v1/volume_metadata.py b/cinder/api/v1/volume_metadata.py index 8130f627c..b4f0bb3d5 100644 --- a/cinder/api/v1/volume_metadata.py +++ b/cinder/api/v1/volume_metadata.py @@ -14,13 +14,13 @@ # under the License. import webob +from webob import exc from cinder.api import common from cinder.api.openstack import wsgi from cinder import exception from cinder.i18n import _ from cinder import volume -from webob import exc class Controller(wsgi.Controller): diff --git a/cinder/api/v1/volumes.py b/cinder/api/v1/volumes.py index ebf195a89..5e6968f7b 100644 --- a/cinder/api/v1/volumes.py +++ b/cinder/api/v1/volumes.py @@ -16,6 +16,7 @@ """The volumes api.""" import ast + import webob from webob import exc diff --git a/cinder/api/v2/snapshot_metadata.py b/cinder/api/v2/snapshot_metadata.py index d1913f493..18c2dd4a0 100644 --- a/cinder/api/v2/snapshot_metadata.py +++ b/cinder/api/v2/snapshot_metadata.py @@ -14,13 +14,13 @@ # under the License. import webob +from webob import exc from cinder.api import common from cinder.api.openstack import wsgi from cinder import exception from cinder.i18n import _ from cinder import volume -from webob import exc class Controller(wsgi.Controller): diff --git a/cinder/api/v2/volumes.py b/cinder/api/v2/volumes.py index e218e1b5b..9c6f17da9 100644 --- a/cinder/api/v2/volumes.py +++ b/cinder/api/v2/volumes.py @@ -17,6 +17,7 @@ import ast + import webob from webob import exc diff --git a/cinder/backup/api.py b/cinder/backup/api.py index 090db2769..d3c195afe 100644 --- a/cinder/backup/api.py +++ b/cinder/backup/api.py @@ -19,7 +19,6 @@ Handles all requests relating to the volume backups service. from eventlet import greenthread - from oslo.config import cfg from cinder.backup import rpcapi as backup_rpcapi @@ -28,9 +27,8 @@ from cinder.db import base from cinder import exception from cinder.i18n import _ from cinder.openstack.common import log as logging -from cinder import utils - import cinder.policy +from cinder import utils import cinder.volume CONF = cfg.CONF diff --git a/cinder/backup/driver.py b/cinder/backup/driver.py index 04c84fb28..c831d1df7 100644 --- a/cinder/backup/driver.py +++ b/cinder/backup/driver.py @@ -15,12 +15,13 @@ """Base class for all backup drivers.""" +from oslo.config import cfg + from cinder.db import base from cinder import exception from cinder.i18n import _ from cinder.openstack.common import jsonutils from cinder.openstack.common import log as logging -from oslo.config import cfg service_opts = [ cfg.IntOpt('backup_metadata_version', default=1, diff --git a/cinder/backup/drivers/ceph.py b/cinder/backup/drivers/ceph.py index 2a57978b2..68c7e94e7 100644 --- a/cinder/backup/drivers/ceph.py +++ b/cinder/backup/drivers/ceph.py @@ -42,13 +42,13 @@ was deemed the safest action to take. It is therefore recommended to always restore to a new volume (default). """ -import eventlet import fcntl import os import re import subprocess import time +import eventlet from oslo.config import cfg from cinder.backup.driver import BackupDriver diff --git a/cinder/backup/drivers/swift.py b/cinder/backup/drivers/swift.py index eedc72361..21c35b96a 100644 --- a/cinder/backup/drivers/swift.py +++ b/cinder/backup/drivers/swift.py @@ -33,11 +33,12 @@ import hashlib import json import os -import six import socket import eventlet from oslo.config import cfg +import six +from swiftclient import client as swift from cinder.backup.driver import BackupDriver from cinder import exception @@ -46,7 +47,6 @@ from cinder.openstack.common import excutils from cinder.openstack.common import log as logging from cinder.openstack.common import timeutils from cinder.openstack.common import units -from swiftclient import client as swift LOG = logging.getLogger(__name__) diff --git a/cinder/brick/local_dev/lvm.py b/cinder/brick/local_dev/lvm.py index 798075f7c..4e2be1a10 100644 --- a/cinder/brick/local_dev/lvm.py +++ b/cinder/brick/local_dev/lvm.py @@ -17,11 +17,10 @@ LVM class for performing LVM operations. """ +import itertools import math import re -import itertools - from cinder.brick import exception from cinder.brick import executor from cinder.i18n import _ diff --git a/cinder/brick/remotefs/remotefs.py b/cinder/brick/remotefs/remotefs.py index 4b67d1e45..81bf90fe5 100755 --- a/cinder/brick/remotefs/remotefs.py +++ b/cinder/brick/remotefs/remotefs.py @@ -18,6 +18,7 @@ import hashlib import os import re + import six from cinder.brick import exception diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/004_volume_type_to_uuid.py b/cinder/db/sqlalchemy/migrate_repo/versions/004_volume_type_to_uuid.py index 3cd0afb9c..c5d1ba0c3 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/004_volume_type_to_uuid.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/004_volume_type_to_uuid.py @@ -12,10 +12,11 @@ import uuid -from cinder.openstack.common import log as logging from migrate import ForeignKeyConstraint from sqlalchemy import Integer, MetaData, String, Table +from cinder.openstack.common import log as logging + LOG = logging.getLogger(__name__) diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/005_add_source_volume_column.py b/cinder/db/sqlalchemy/migrate_repo/versions/005_add_source_volume_column.py index 352d640a9..9291bb2ee 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/005_add_source_volume_column.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/005_add_source_volume_column.py @@ -11,10 +11,11 @@ # under the License. -from cinder.openstack.common import log as logging from sqlalchemy import Column from sqlalchemy import MetaData, String, Table +from cinder.openstack.common import log as logging + LOG = logging.getLogger(__name__) diff --git a/cinder/db/sqlalchemy/migrate_repo/versions/021_add_default_quota_class.py b/cinder/db/sqlalchemy/migrate_repo/versions/021_add_default_quota_class.py index f09bf3951..075eaf9c2 100644 --- a/cinder/db/sqlalchemy/migrate_repo/versions/021_add_default_quota_class.py +++ b/cinder/db/sqlalchemy/migrate_repo/versions/021_add_default_quota_class.py @@ -14,11 +14,12 @@ import datetime -from cinder.i18n import _ -from cinder.openstack.common import log as logging from oslo.config import cfg from sqlalchemy import MetaData, Table +from cinder.i18n import _ +from cinder.openstack.common import log as logging + # Get default values via config. The defaults will either # come from the default values set in the quota option # configuration or via cinder.conf if the user has configured diff --git a/cinder/db/sqlalchemy/models.py b/cinder/db/sqlalchemy/models.py index 89ec464e6..e2860cc1d 100644 --- a/cinder/db/sqlalchemy/models.py +++ b/cinder/db/sqlalchemy/models.py @@ -19,13 +19,12 @@ SQLAlchemy models for cinder data. """ - +from oslo.config import cfg +from oslo.db.sqlalchemy import models from sqlalchemy import Column, Integer, String, Text, schema from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import ForeignKey, DateTime, Boolean from sqlalchemy.orm import relationship, backref -from oslo.config import cfg -from oslo.db.sqlalchemy import models from cinder.openstack.common import timeutils diff --git a/cinder/exception.py b/cinder/exception.py index c383d52d6..0a123a7c3 100644 --- a/cinder/exception.py +++ b/cinder/exception.py @@ -22,10 +22,10 @@ SHOULD include dedicated exception logging. """ -import six import sys from oslo.config import cfg +import six import webob.exc from cinder.i18n import _ diff --git a/cinder/test.py b/cinder/test.py index 17819af3e..c38d47d4d 100644 --- a/cinder/test.py +++ b/cinder/test.py @@ -21,13 +21,13 @@ inline callbacks. """ +import logging import os import shutil import tempfile import uuid import fixtures -import logging import mox from oslo.config import cfg from oslo.messaging import conffixture as messaging_conffixture diff --git a/cinder/tests/api/contrib/test_admin_actions.py b/cinder/tests/api/contrib/test_admin_actions.py index e14cfd58a..df8ae7c25 100644 --- a/cinder/tests/api/contrib/test_admin_actions.py +++ b/cinder/tests/api/contrib/test_admin_actions.py @@ -12,9 +12,9 @@ import ast import tempfile -import webob from oslo.config import cfg +import webob from cinder.api.contrib import admin_actions from cinder.brick.local_dev import lvm as brick_lvm diff --git a/cinder/tests/api/contrib/test_backups.py b/cinder/tests/api/contrib/test_backups.py index 0cfd9ea2c..4304813bf 100644 --- a/cinder/tests/api/contrib/test_backups.py +++ b/cinder/tests/api/contrib/test_backups.py @@ -18,9 +18,9 @@ Tests for Backup code. """ import json -import mock from xml.dom import minidom +import mock import webob # needed for stubs to work diff --git a/cinder/tests/api/contrib/test_qos_specs_manage.py b/cinder/tests/api/contrib/test_qos_specs_manage.py index 84ce76fa6..377d4224b 100644 --- a/cinder/tests/api/contrib/test_qos_specs_manage.py +++ b/cinder/tests/api/contrib/test_qos_specs_manage.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. -from lxml import etree from xml.dom import minidom +from lxml import etree import webob from cinder.api.contrib import qos_specs_manage diff --git a/cinder/tests/api/contrib/test_services.py b/cinder/tests/api/contrib/test_services.py index 92806d4e3..8741f22f0 100644 --- a/cinder/tests/api/contrib/test_services.py +++ b/cinder/tests/api/contrib/test_services.py @@ -14,6 +14,8 @@ # under the License. +from datetime import datetime + import webob.exc from cinder.api.contrib import services @@ -25,7 +27,6 @@ from cinder.openstack.common import timeutils from cinder import policy from cinder import test from cinder.tests.api import fakes -from datetime import datetime fake_services_list = [{'binary': 'cinder-scheduler', diff --git a/cinder/tests/api/contrib/test_types_extra_specs.py b/cinder/tests/api/contrib/test_types_extra_specs.py index 18a60dc2a..f1a7cae7e 100644 --- a/cinder/tests/api/contrib/test_types_extra_specs.py +++ b/cinder/tests/api/contrib/test_types_extra_specs.py @@ -16,9 +16,8 @@ # under the License. from lxml import etree -import webob - import mock +import webob from cinder.api.contrib import types_extra_specs from cinder import exception diff --git a/cinder/tests/api/contrib/test_volume_encryption_metadata.py b/cinder/tests/api/contrib/test_volume_encryption_metadata.py index ff8a6c58c..29c5dec27 100644 --- a/cinder/tests/api/contrib/test_volume_encryption_metadata.py +++ b/cinder/tests/api/contrib/test_volume_encryption_metadata.py @@ -14,6 +14,7 @@ # under the License. import json + import webob from cinder.api.contrib import volume_encryption_metadata diff --git a/cinder/tests/api/contrib/test_volume_manage.py b/cinder/tests/api/contrib/test_volume_manage.py index 3ccf99acb..82bad3c10 100755 --- a/cinder/tests/api/contrib/test_volume_manage.py +++ b/cinder/tests/api/contrib/test_volume_manage.py @@ -13,7 +13,6 @@ # under the License. import mock - import webob from cinder import context diff --git a/cinder/tests/api/contrib/test_volume_type_encryption.py b/cinder/tests/api/contrib/test_volume_type_encryption.py index 3ab8a326d..9bf1f9852 100644 --- a/cinder/tests/api/contrib/test_volume_type_encryption.py +++ b/cinder/tests/api/contrib/test_volume_type_encryption.py @@ -14,6 +14,7 @@ # under the License. import json + import webob from cinder import context diff --git a/cinder/tests/api/contrib/test_volume_unmanage.py b/cinder/tests/api/contrib/test_volume_unmanage.py index cde279175..6538cbb15 100755 --- a/cinder/tests/api/contrib/test_volume_unmanage.py +++ b/cinder/tests/api/contrib/test_volume_unmanage.py @@ -13,7 +13,6 @@ # under the License. import mock - import webob from cinder import context diff --git a/cinder/tests/api/middleware/test_faults.py b/cinder/tests/api/middleware/test_faults.py index 5f9eb75e2..60297cf17 100644 --- a/cinder/tests/api/middleware/test_faults.py +++ b/cinder/tests/api/middleware/test_faults.py @@ -13,9 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +import gettext from xml.dom import minidom -import gettext import mock from oslo.i18n import _lazy import webob.dec diff --git a/cinder/tests/api/openstack/test_wsgi.py b/cinder/tests/api/openstack/test_wsgi.py index af8658c31..0a39d8d96 100644 --- a/cinder/tests/api/openstack/test_wsgi.py +++ b/cinder/tests/api/openstack/test_wsgi.py @@ -11,6 +11,7 @@ # under the License. import inspect + import webob from cinder.api.openstack import wsgi diff --git a/cinder/tests/api/v1/test_limits.py b/cinder/tests/api/v1/test_limits.py index ee36fe22e..711d57320 100644 --- a/cinder/tests/api/v1/test_limits.py +++ b/cinder/tests/api/v1/test_limits.py @@ -18,10 +18,10 @@ Tests dealing with HTTP rate-limiting. """ import httplib -import six from xml.dom import minidom from lxml import etree +import six import webob from cinder.api.v1 import limits diff --git a/cinder/tests/api/v2/test_limits.py b/cinder/tests/api/v2/test_limits.py index 6c3baa70f..5d3777280 100644 --- a/cinder/tests/api/v2/test_limits.py +++ b/cinder/tests/api/v2/test_limits.py @@ -18,11 +18,11 @@ Tests dealing with HTTP rate-limiting. """ import httplib +from xml.dom import minidom from lxml import etree import six import webob -from xml.dom import minidom from cinder.api.v2 import limits from cinder.api import views diff --git a/cinder/tests/backup/fake_swift_client.py b/cinder/tests/backup/fake_swift_client.py index dc35ea7f2..70ac14361 100644 --- a/cinder/tests/backup/fake_swift_client.py +++ b/cinder/tests/backup/fake_swift_client.py @@ -19,9 +19,10 @@ import os import socket import zlib -from cinder.openstack.common import log as logging from swiftclient import client as swift +from cinder.openstack.common import log as logging + LOG = logging.getLogger(__name__) diff --git a/cinder/tests/fake_hp_3par_client.py b/cinder/tests/fake_hp_3par_client.py index 073eb2f00..85905448c 100644 --- a/cinder/tests/fake_hp_3par_client.py +++ b/cinder/tests/fake_hp_3par_client.py @@ -15,9 +15,10 @@ # """Fake HP client for testing 3PAR without installing the client.""" -import mock import sys +import mock + from cinder.tests import fake_hp_client_exceptions as hpexceptions hp3par = mock.Mock() diff --git a/cinder/tests/fake_hp_lefthand_client.py b/cinder/tests/fake_hp_lefthand_client.py index 9af0607cd..604cc888b 100644 --- a/cinder/tests/fake_hp_lefthand_client.py +++ b/cinder/tests/fake_hp_lefthand_client.py @@ -15,9 +15,10 @@ # """Fake HP client for testing LeftHand without installing the client.""" -import mock import sys +import mock + from cinder.tests import fake_hp_client_exceptions as hpexceptions hplefthand = mock.Mock() diff --git a/cinder/tests/integrated/api/client.py b/cinder/tests/integrated/api/client.py index eeb599ef5..b8d597018 100644 --- a/cinder/tests/integrated/api/client.py +++ b/cinder/tests/integrated/api/client.py @@ -14,7 +14,6 @@ import netaddr import requests - import six.moves.urllib.parse as urlparse from cinder.i18n import _ diff --git a/cinder/tests/integrated/test_volumes.py b/cinder/tests/integrated/test_volumes.py index 9bdc872db..4ab011882 100644 --- a/cinder/tests/integrated/test_volumes.py +++ b/cinder/tests/integrated/test_volumes.py @@ -13,9 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. -import testtools import time +import testtools + from cinder.openstack.common import log as logging from cinder import service from cinder.tests import fake_driver diff --git a/cinder/tests/scheduler/test_capacity_weigher.py b/cinder/tests/scheduler/test_capacity_weigher.py index 28e266ef8..b1fe53bc5 100644 --- a/cinder/tests/scheduler/test_capacity_weigher.py +++ b/cinder/tests/scheduler/test_capacity_weigher.py @@ -17,7 +17,6 @@ Tests For Capacity Weigher. """ import mock - from oslo.config import cfg from cinder import context diff --git a/cinder/tests/scheduler/test_host_manager.py b/cinder/tests/scheduler/test_host_manager.py index 7140fa1a7..c8c7f5747 100644 --- a/cinder/tests/scheduler/test_host_manager.py +++ b/cinder/tests/scheduler/test_host_manager.py @@ -17,7 +17,6 @@ Tests For HostManager """ import mock - from oslo.config import cfg from cinder import exception diff --git a/cinder/tests/scheduler/test_rpcapi.py b/cinder/tests/scheduler/test_rpcapi.py index 2622a2296..b48c64751 100644 --- a/cinder/tests/scheduler/test_rpcapi.py +++ b/cinder/tests/scheduler/test_rpcapi.py @@ -18,8 +18,8 @@ Unit Tests for cinder.scheduler.rpcapi """ import copy -import mock +import mock from oslo.config import cfg from cinder import context diff --git a/cinder/tests/scheduler/test_volume_number_weigher.py b/cinder/tests/scheduler/test_volume_number_weigher.py index ca596cf04..14832b31e 100644 --- a/cinder/tests/scheduler/test_volume_number_weigher.py +++ b/cinder/tests/scheduler/test_volume_number_weigher.py @@ -17,7 +17,6 @@ Tests For Volume Number Weigher. """ import mock - from oslo.config import cfg from cinder import context diff --git a/cinder/tests/test_backup.py b/cinder/tests/test_backup.py index dd0b604a6..ade2463cc 100644 --- a/cinder/tests/test_backup.py +++ b/cinder/tests/test_backup.py @@ -17,9 +17,9 @@ Tests for Backup code. """ -import mock import tempfile +import mock from oslo.config import cfg from cinder import context diff --git a/cinder/tests/test_backup_ceph.py b/cinder/tests/test_backup_ceph.py index fb905ebee..75fc6cc11 100644 --- a/cinder/tests/test_backup_ceph.py +++ b/cinder/tests/test_backup_ceph.py @@ -16,12 +16,13 @@ import contextlib import hashlib -import mock import os -import six import tempfile import uuid +import mock +import six + from cinder.backup import driver from cinder.backup.drivers import ceph from cinder import context diff --git a/cinder/tests/test_backup_driver_base.py b/cinder/tests/test_backup_driver_base.py index 7a05590a6..3ad234889 100644 --- a/cinder/tests/test_backup_driver_base.py +++ b/cinder/tests/test_backup_driver_base.py @@ -14,9 +14,10 @@ # under the License. """ Tests for the backup service base driver. """ -import mock import uuid +import mock + from cinder.backup import driver from cinder import context from cinder import db diff --git a/cinder/tests/test_emc_vnxdirect.py b/cinder/tests/test_emc_vnxdirect.py index 217e0c69f..5910ff441 100644 --- a/cinder/tests/test_emc_vnxdirect.py +++ b/cinder/tests/test_emc_vnxdirect.py @@ -12,10 +12,12 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -import mock + import os import re +import mock + from cinder import exception from cinder.openstack.common import processutils from cinder import test diff --git a/cinder/tests/test_glusterfs.py b/cinder/tests/test_glusterfs.py index 608493882..093cb4f62 100644 --- a/cinder/tests/test_glusterfs.py +++ b/cinder/tests/test_glusterfs.py @@ -16,12 +16,12 @@ import contextlib import errno -import mock import os import tempfile import time import traceback +import mock import mox as mox_lib from mox import IgnoreArg from mox import IsA diff --git a/cinder/tests/test_gpfs.py b/cinder/tests/test_gpfs.py index bc71600f2..f3a3c71fc 100644 --- a/cinder/tests/test_gpfs.py +++ b/cinder/tests/test_gpfs.py @@ -13,10 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. -import mock import os import tempfile +import mock from oslo.config import cfg from cinder import context diff --git a/cinder/tests/test_hds.py b/cinder/tests/test_hds.py index e2cd2d640..65a2bf788 100644 --- a/cinder/tests/test_hds.py +++ b/cinder/tests/test_hds.py @@ -19,10 +19,11 @@ Self test for Hitachi Unified Storage (HUS) platform. """ -import mox import os import tempfile +import mox + from cinder import test from cinder.volume import configuration as conf from cinder.volume.drivers.hds import hds diff --git a/cinder/tests/test_hds_iscsi.py b/cinder/tests/test_hds_iscsi.py index 48bcaffac..3b8e1cf01 100644 --- a/cinder/tests/test_hds_iscsi.py +++ b/cinder/tests/test_hds_iscsi.py @@ -23,11 +23,10 @@ import tempfile import mock +from cinder.openstack.common import log as logging from cinder import test from cinder.volume import configuration as conf from cinder.volume.drivers.hds import iscsi - -from cinder.openstack.common import log as logging LOG = logging.getLogger(__name__) HNASCONF = """ diff --git a/cinder/tests/test_hp3par.py b/cinder/tests/test_hp3par.py index 2533b60c4..86f7374f5 100644 --- a/cinder/tests/test_hp3par.py +++ b/cinder/tests/test_hp3par.py @@ -22,7 +22,6 @@ from cinder import exception from cinder.openstack.common import log as logging from cinder.openstack.common import units from cinder import test - from cinder.tests import fake_hp_3par_client as hp3parclient from cinder.volume.drivers.san.hp import hp_3par_fc as hpfcdriver from cinder.volume.drivers.san.hp import hp_3par_iscsi as hpdriver diff --git a/cinder/tests/test_hp_msa.py b/cinder/tests/test_hp_msa.py index 0418b6f32..205689bdb 100644 --- a/cinder/tests/test_hp_msa.py +++ b/cinder/tests/test_hp_msa.py @@ -14,9 +14,10 @@ """Unit tests for OpenStack Cinder HP MSA driver.""" +import urllib2 + import lxml.etree as etree import mock -import urllib2 from cinder import exception from cinder import test diff --git a/cinder/tests/test_hplefthand.py b/cinder/tests/test_hplefthand.py index 5528730e1..e0ec9e89d 100644 --- a/cinder/tests/test_hplefthand.py +++ b/cinder/tests/test_hplefthand.py @@ -21,7 +21,6 @@ from cinder import exception from cinder.openstack.common import log as logging from cinder.openstack.common import units from cinder import test - from cinder.tests import fake_hp_lefthand_client as hplefthandclient from cinder.volume.drivers.san.hp import hp_lefthand_iscsi from cinder.volume.drivers.san.hp import hp_lefthand_rest_proxy diff --git a/cinder/tests/test_huawei_hvs.py b/cinder/tests/test_huawei_hvs.py index 5af035444..7ea5f76a9 100644 --- a/cinder/tests/test_huawei_hvs.py +++ b/cinder/tests/test_huawei_hvs.py @@ -19,14 +19,14 @@ Unit Tests for Huawei HVS volume drivers. """ import json -import mox import os import shutil import tempfile import time - from xml.dom.minidom import Document +import mox + from cinder import exception from cinder import test from cinder.volume import configuration as conf diff --git a/cinder/tests/test_huawei_t_dorado.py b/cinder/tests/test_huawei_t_dorado.py index 6f25f006e..36d84648b 100644 --- a/cinder/tests/test_huawei_t_dorado.py +++ b/cinder/tests/test_huawei_t_dorado.py @@ -18,16 +18,16 @@ Unit Tests for Huawei T and Dorado volume drivers. """ -import mox import os import shutil import socket import tempfile import time - from xml.dom.minidom import Document from xml.etree import ElementTree as ET +import mox + from cinder import context from cinder import exception from cinder import ssh_utils diff --git a/cinder/tests/test_ibmnas.py b/cinder/tests/test_ibmnas.py index bff55d3d0..d6b4892fa 100644 --- a/cinder/tests/test_ibmnas.py +++ b/cinder/tests/test_ibmnas.py @@ -21,7 +21,6 @@ Tests for the IBM NAS family (SONAS, Storwize V7000 Unified). """ import mock - from oslo.config import cfg from cinder import context diff --git a/cinder/tests/test_image_utils.py b/cinder/tests/test_image_utils.py index 048b88f56..c26f1707e 100644 --- a/cinder/tests/test_image_utils.py +++ b/cinder/tests/test_image_utils.py @@ -16,10 +16,10 @@ """Unit tests for image utils.""" import contextlib -import mock -import mox import tempfile +import mock +import mox from oslo.config import cfg from cinder import context diff --git a/cinder/tests/test_netapp.py b/cinder/tests/test_netapp.py index f8c7d4eb7..74ff95047 100644 --- a/cinder/tests/test_netapp.py +++ b/cinder/tests/test_netapp.py @@ -20,8 +20,8 @@ Tests for NetApp volume driver import BaseHTTPServer import httplib -from lxml import etree +from lxml import etree import six from cinder import exception diff --git a/cinder/tests/test_netapp_eseries_iscsi.py b/cinder/tests/test_netapp_eseries_iscsi.py index 00d793f2b..ab03c6d78 100644 --- a/cinder/tests/test_netapp_eseries_iscsi.py +++ b/cinder/tests/test_netapp_eseries_iscsi.py @@ -17,8 +17,9 @@ Tests for NetApp e-series iscsi volume driver. """ import json -import mock import re + +import mock import requests from cinder import exception diff --git a/cinder/tests/test_netapp_nfs.py b/cinder/tests/test_netapp_nfs.py index 15a4067e6..9915a2331 100644 --- a/cinder/tests/test_netapp_nfs.py +++ b/cinder/tests/test_netapp_nfs.py @@ -15,12 +15,13 @@ # under the License. """Unit tests for the NetApp-specific NFS driver module.""" +import os + from lxml import etree import mock import mox from mox import IgnoreArg from mox import IsA -import os from cinder import context from cinder import exception diff --git a/cinder/tests/test_netapp_ssc.py b/cinder/tests/test_netapp_ssc.py index 8fd26c3d0..11ea22892 100644 --- a/cinder/tests/test_netapp_ssc.py +++ b/cinder/tests/test_netapp_ssc.py @@ -18,9 +18,9 @@ import BaseHTTPServer import copy import httplib + from lxml import etree from mox import IgnoreArg - import six from cinder import exception diff --git a/cinder/tests/test_nimble.py b/cinder/tests/test_nimble.py index bef14aa77..9096c9ac3 100644 --- a/cinder/tests/test_nimble.py +++ b/cinder/tests/test_nimble.py @@ -14,7 +14,6 @@ # under the License. import mock - from oslo.config import cfg from cinder import exception diff --git a/cinder/tests/test_pure.py b/cinder/tests/test_pure.py index cf9183720..612e49d20 100644 --- a/cinder/tests/test_pure.py +++ b/cinder/tests/test_pure.py @@ -14,9 +14,10 @@ # under the License. import json -import mock import urllib2 +import mock + from cinder import exception from cinder.openstack.common import processutils from cinder.openstack.common import units diff --git a/cinder/tests/test_rbd.py b/cinder/tests/test_rbd.py index 10f447c92..8ba6a519f 100644 --- a/cinder/tests/test_rbd.py +++ b/cinder/tests/test_rbd.py @@ -17,10 +17,11 @@ import math -import mock import os import tempfile +import mock + from cinder import db from cinder import exception from cinder.i18n import _ diff --git a/cinder/tests/test_storwize_svc.py b/cinder/tests/test_storwize_svc.py index 4b26d515a..972739c9d 100644 --- a/cinder/tests/test_storwize_svc.py +++ b/cinder/tests/test_storwize_svc.py @@ -18,11 +18,12 @@ Tests for the IBM Storwize family and SVC volume driver. """ -import mock import random import re import time +import mock + from cinder import context from cinder import exception from cinder.i18n import _ diff --git a/cinder/tests/test_volume.py b/cinder/tests/test_volume.py index 4cc95b0d5..538f1e8c1 100644 --- a/cinder/tests/test_volume.py +++ b/cinder/tests/test_volume.py @@ -20,7 +20,6 @@ Tests for Volume Code. import contextlib import datetime -import mock import os import shutil import socket @@ -28,6 +27,7 @@ from sys import platform import tempfile import eventlet +import mock import mox from oslo.config import cfg from stevedore import extension diff --git a/cinder/tests/test_volume_utils.py b/cinder/tests/test_volume_utils.py index 5a6bffc70..61ab07951 100644 --- a/cinder/tests/test_volume_utils.py +++ b/cinder/tests/test_volume_utils.py @@ -15,10 +15,10 @@ """Tests For miscellaneous util methods used with volume.""" -import mock import os import re +import mock from oslo.config import cfg from cinder import context diff --git a/cinder/tests/test_wsgi.py b/cinder/tests/test_wsgi.py index 214e5c556..77bc0827b 100644 --- a/cinder/tests/test_wsgi.py +++ b/cinder/tests/test_wsgi.py @@ -16,11 +16,11 @@ """Unit tests for `cinder.wsgi`.""" -import mock import os.path import tempfile import urllib2 +import mock from oslo.config import cfg from oslo.i18n import _lazy import testtools diff --git a/cinder/tests/volume/drivers/netapp/test_iscsi.py b/cinder/tests/volume/drivers/netapp/test_iscsi.py index dd9e83f2a..04ded7fc1 100644 --- a/cinder/tests/volume/drivers/netapp/test_iscsi.py +++ b/cinder/tests/volume/drivers/netapp/test_iscsi.py @@ -16,9 +16,10 @@ Mock unit tests for the NetApp iSCSI driver """ -import mock import uuid +import mock + from cinder import test import cinder.volume.drivers.netapp.api as ntapi import cinder.volume.drivers.netapp.iscsi as ntap_iscsi diff --git a/cinder/tests/windows/test_windows.py b/cinder/tests/windows/test_windows.py index c92e77cbb..11e45bd64 100644 --- a/cinder/tests/windows/test_windows.py +++ b/cinder/tests/windows/test_windows.py @@ -22,15 +22,12 @@ import os import shutil import tempfile -from oslo.config import cfg - import mox - -from cinder import test +from oslo.config import cfg from cinder.image import image_utils - from cinder.openstack.common import fileutils +from cinder import test from cinder.tests.windows import db_fakes from cinder.volume import configuration as conf from cinder.volume.drivers.windows import constants diff --git a/cinder/tests/zonemanager/test_brcd_fc_san_lookup_service.py b/cinder/tests/zonemanager/test_brcd_fc_san_lookup_service.py index 524c3f3eb..e138d452a 100644 --- a/cinder/tests/zonemanager/test_brcd_fc_san_lookup_service.py +++ b/cinder/tests/zonemanager/test_brcd_fc_san_lookup_service.py @@ -20,9 +20,8 @@ """Unit tests for brcd fc san lookup service.""" import mock -import paramiko - from oslo.config import cfg +import paramiko from cinder import exception from cinder.openstack.common import log as logging diff --git a/cinder/tests/zonemanager/test_brcd_fc_zone_client_cli.py b/cinder/tests/zonemanager/test_brcd_fc_zone_client_cli.py index 4f0bc7c83..09f20f2e8 100644 --- a/cinder/tests/zonemanager/test_brcd_fc_zone_client_cli.py +++ b/cinder/tests/zonemanager/test_brcd_fc_zone_client_cli.py @@ -20,6 +20,7 @@ """Unit tests for brcd fc zone client cli.""" import mock +from mock import patch from cinder import exception from cinder.openstack.common import log as logging @@ -28,7 +29,6 @@ from cinder import test from cinder.zonemanager.drivers.brocade.brcd_fc_zone_client_cli \ import BrcdFCZoneClientCLI import cinder.zonemanager.drivers.brocade.fc_zone_constants as ZoneConstant -from mock import patch LOG = logging.getLogger(__name__) diff --git a/cinder/tests/zonemanager/test_brcd_fc_zone_driver.py b/cinder/tests/zonemanager/test_brcd_fc_zone_driver.py index 810ca76ce..f3cec3a4d 100644 --- a/cinder/tests/zonemanager/test_brcd_fc_zone_driver.py +++ b/cinder/tests/zonemanager/test_brcd_fc_zone_driver.py @@ -20,9 +20,8 @@ """Unit tests for Brocade fc zone driver.""" import mock -import paramiko - from oslo.config import cfg +import paramiko from cinder import exception from cinder.i18n import _ diff --git a/cinder/tests/zonemanager/test_fc_zone_manager.py b/cinder/tests/zonemanager/test_fc_zone_manager.py index 7d04ab23d..11cf92e7f 100644 --- a/cinder/tests/zonemanager/test_fc_zone_manager.py +++ b/cinder/tests/zonemanager/test_fc_zone_manager.py @@ -20,13 +20,13 @@ """Unit tests for FC Zone Manager.""" import mock +from mock import Mock from cinder import exception from cinder import test from cinder.volume import configuration as conf from cinder.zonemanager.drivers.fc_zone_driver import FCZoneDriver from cinder.zonemanager import fc_zone_manager -from mock import Mock fabric_name = 'BRCD_FAB_3' init_target_map = {'10008c7cff523b01': ['20240002ac000a50']} diff --git a/cinder/utils.py b/cinder/utils.py index 9fe1924d9..c0b24532b 100644 --- a/cinder/utils.py +++ b/cinder/utils.py @@ -29,15 +29,15 @@ import shutil import stat import sys import tempfile - -from oslo.config import cfg -import six from xml.dom import minidom from xml.parsers import expat from xml import sax from xml.sax import expatreader from xml.sax import saxutils +from oslo.config import cfg +import six + from cinder.brick.initiator import connector from cinder import exception from cinder.i18n import _ diff --git a/cinder/volume/drivers/emc/emc_smis_common.py b/cinder/volume/drivers/emc/emc_smis_common.py index 77262d720..dc16cf6c7 100644 --- a/cinder/volume/drivers/emc/emc_smis_common.py +++ b/cinder/volume/drivers/emc/emc_smis_common.py @@ -21,9 +21,9 @@ It supports VNX and VMAX arrays. """ import time +from xml.dom.minidom import parseString from oslo.config import cfg -from xml.dom.minidom import parseString from cinder import exception from cinder.i18n import _ diff --git a/cinder/volume/drivers/hds/hds.py b/cinder/volume/drivers/hds/hds.py index 57f7b618b..f08498f54 100644 --- a/cinder/volume/drivers/hds/hds.py +++ b/cinder/volume/drivers/hds/hds.py @@ -19,9 +19,10 @@ iSCSI Cinder Volume driver for Hitachi Unified Storage (HUS) platform. """ -from oslo.config import cfg from xml.etree import ElementTree as ETree +from oslo.config import cfg + from cinder import exception from cinder.i18n import _ from cinder.openstack.common import excutils diff --git a/cinder/volume/drivers/hds/hnas_backend.py b/cinder/volume/drivers/hds/hnas_backend.py index 58075d72a..10b9a1034 100644 --- a/cinder/volume/drivers/hds/hnas_backend.py +++ b/cinder/volume/drivers/hds/hnas_backend.py @@ -18,10 +18,11 @@ Hitachi Unified Storage (HUS-HNAS) platform. Backend operations. """ +import re + from cinder.openstack.common import log as logging from cinder.openstack.common import units from cinder import utils -import re LOG = logging.getLogger("cinder.volume.driver") diff --git a/cinder/volume/drivers/hds/iscsi.py b/cinder/volume/drivers/hds/iscsi.py index 2a604d245..f4350a56d 100644 --- a/cinder/volume/drivers/hds/iscsi.py +++ b/cinder/volume/drivers/hds/iscsi.py @@ -18,9 +18,10 @@ iSCSI Cinder Volume driver for Hitachi Unified Storage (HUS-HNAS) platform. """ -from oslo.config import cfg from xml.etree import ElementTree as ETree +from oslo.config import cfg + from cinder import exception from cinder.i18n import _ from cinder.openstack.common import excutils diff --git a/cinder/volume/drivers/hds/nfs.py b/cinder/volume/drivers/hds/nfs.py index 2cca52355..c68a6f976 100644 --- a/cinder/volume/drivers/hds/nfs.py +++ b/cinder/volume/drivers/hds/nfs.py @@ -19,9 +19,9 @@ Volume driver for HDS HNAS NFS storage. import os import time +from xml.etree import ElementTree as ETree from oslo.config import cfg -from xml.etree import ElementTree as ETree from cinder import exception from cinder.i18n import _ diff --git a/cinder/volume/drivers/huawei/rest_common.py b/cinder/volume/drivers/huawei/rest_common.py index 262a9321c..fca545d50 100644 --- a/cinder/volume/drivers/huawei/rest_common.py +++ b/cinder/volume/drivers/huawei/rest_common.py @@ -21,7 +21,6 @@ import json import time import urllib2 import uuid - from xml.etree import ElementTree as ET from cinder import context diff --git a/cinder/volume/drivers/huawei/ssh_common.py b/cinder/volume/drivers/huawei/ssh_common.py index a40ac3f84..8706811c5 100644 --- a/cinder/volume/drivers/huawei/ssh_common.py +++ b/cinder/volume/drivers/huawei/ssh_common.py @@ -24,7 +24,6 @@ import re import socket import threading import time - from xml.etree import ElementTree as ET from cinder import context diff --git a/cinder/volume/drivers/ibm/storwize_svc/helpers.py b/cinder/volume/drivers/ibm/storwize_svc/helpers.py index 127dfcfb7..99694c988 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/helpers.py +++ b/cinder/volume/drivers/ibm/storwize_svc/helpers.py @@ -16,10 +16,10 @@ import random import re -import six import unicodedata from eventlet import greenthread +import six from cinder import context from cinder import exception diff --git a/cinder/volume/drivers/netapp/api.py b/cinder/volume/drivers/netapp/api.py index 35ac582e5..9f5f74472 100644 --- a/cinder/volume/drivers/netapp/api.py +++ b/cinder/volume/drivers/netapp/api.py @@ -19,9 +19,10 @@ NetApp api for ONTAP and OnCommand DFM. Contains classes required to issue api calls to ONTAP and OnCommand DFM. """ -from lxml import etree import urllib2 +from lxml import etree + from cinder.i18n import _ from cinder.openstack.common import log as logging diff --git a/cinder/volume/drivers/netapp/eseries/client.py b/cinder/volume/drivers/netapp/eseries/client.py index 09ac9986c..52b376a2f 100644 --- a/cinder/volume/drivers/netapp/eseries/client.py +++ b/cinder/volume/drivers/netapp/eseries/client.py @@ -17,8 +17,8 @@ Client classes for web services. """ import json -import requests +import requests import six.moves.urllib.parse as urlparse from cinder import exception diff --git a/cinder/volume/drivers/prophetstor/dpl_fc.py b/cinder/volume/drivers/prophetstor/dpl_fc.py index a03ef126a..8b040be3f 100644 --- a/cinder/volume/drivers/prophetstor/dpl_fc.py +++ b/cinder/volume/drivers/prophetstor/dpl_fc.py @@ -14,6 +14,7 @@ # under the License. import errno + import six from cinder import exception diff --git a/cinder/volume/drivers/rbd.py b/cinder/volume/drivers/rbd.py index 9b67b8768..a55c1f666 100644 --- a/cinder/volume/drivers/rbd.py +++ b/cinder/volume/drivers/rbd.py @@ -18,11 +18,11 @@ import io import json import math import os -import six import tempfile import urllib from oslo.config import cfg +import six from cinder import exception from cinder.i18n import _ diff --git a/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py b/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py index 409c54cb1..fb39aec99 100644 --- a/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py +++ b/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py @@ -15,6 +15,8 @@ # """HP LeftHand SAN ISCSI REST Proxy.""" +from oslo.config import cfg + from cinder import context from cinder import exception from cinder.i18n import _ @@ -23,7 +25,6 @@ from cinder.openstack.common import units from cinder.volume.driver import ISCSIDriver from cinder.volume import utils from cinder.volume import volume_types -from oslo.config import cfg LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/vmware/read_write_util.py b/cinder/volume/drivers/vmware/read_write_util.py index db969aa4b..f7dc5c870 100644 --- a/cinder/volume/drivers/vmware/read_write_util.py +++ b/cinder/volume/drivers/vmware/read_write_util.py @@ -20,10 +20,10 @@ Collection of classes to handle image upload/download to/from Image service """ import httplib -import netaddr import urllib import urllib2 +import netaddr import six.moves.urllib.parse as urlparse from cinder.i18n import _ diff --git a/tox.ini b/tox.ini index a9674a4f7..6bc2e9ac8 100644 --- a/tox.ini +++ b/tox.ini @@ -72,7 +72,7 @@ commands = {posargs} # F841,H302,H305,H307,H405 -ignore = E251,E265,H302,H305,H307,H402,H405,H803,H904 +ignore = E251,E265,H302,H402,H405,H803,H904 builtins = _ exclude = .git,.venv,.tox,dist,tools,doc,common,*egg,build