Fix and enable gating on F401

Do not allow unused imports in modules, and remove those
that are currently unused.

Change-Id: I7600b1cce22eaef87633f98a89db2086a3ec2b55
This commit is contained in:
Dirk Mueller 2013-12-13 13:29:12 +01:00
parent 2c76803a63
commit 2de87b883e
54 changed files with 25 additions and 99 deletions

View File

@ -46,7 +46,8 @@ if os.path.exists(os.path.join(possible_topdir, "cinder", "__init__.py")):
from cinder.openstack.common import gettextutils
gettextutils.install('cinder', lazy=False)
from cinder.common import config # Need to register global_opts
# Need to register global_opts
from cinder.common import config # noqa
from cinder.openstack.common import log as logging
from cinder import service
from cinder import utils

View File

@ -40,7 +40,8 @@ if os.path.exists(os.path.join(possible_topdir, "cinder", "__init__.py")):
from cinder.openstack.common import gettextutils
gettextutils.install('cinder', lazy=False)
from cinder.common import config # Need to register global_opts
# Need to register global_opts
from cinder.common import config # noqa
from cinder.openstack.common import log as logging
from cinder import service
from cinder import utils

View File

@ -38,7 +38,8 @@ if os.path.exists(os.path.join(possible_topdir, 'cinder', '__init__.py')):
from cinder.openstack.common import gettextutils
gettextutils.install('cinder')
from cinder.common import config # Need to register global_opts
# Need to register global_opts
from cinder.common import config # noqa
from cinder.openstack.common import log as logging
from cinder import service
from cinder import utils

View File

@ -23,10 +23,8 @@
"""
import datetime
import os
import sys
import time
from oslo.config import cfg
@ -41,9 +39,8 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'cinder', '__init__.py')):
from cinder.openstack.common import gettextutils
gettextutils.install('cinder')
from cinder.common import config # Need to register global_opts
from cinder import context
from cinder import exception
# Need to register global_opts
from cinder.common import config # noqa
from cinder.openstack.common import log as logging
from cinder.openstack.common import rpc
from cinder import version

View File

@ -74,7 +74,8 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'cinder', '__init__.py')):
from cinder.openstack.common import gettextutils
gettextutils.install('cinder')
from cinder.common import config # Need to register global_opts
# Need to register global_opts
from cinder.common import config # noqa
from cinder import context
from cinder import db
from cinder.db import migration
@ -168,7 +169,7 @@ class ShellCommands(object):
else:
# We don't have to wrap the following import in a 'try',
# because we already know 'readline' was imported successfully.
import rlcompleter
import rlcompleter # noqa
readline.parse_and_bind("tab:complete")
code.interact()

View File

@ -40,7 +40,8 @@ if os.path.exists(os.path.join(possible_topdir, 'cinder', '__init__.py')):
from cinder.openstack.common import gettextutils
gettextutils.install('cinder')
from cinder.common import config # Need to register global_opts
# Need to register global_opts
from cinder.common import config # noqa
from cinder.openstack.common import log as logging
from cinder import service
from cinder import utils

View File

@ -44,7 +44,8 @@ if os.path.exists(os.path.join(possible_topdir, 'cinder', '__init__.py')):
from cinder.openstack.common import gettextutils
gettextutils.install('cinder')
from cinder.common import config # Need to register global_opts
# Need to register global_opts
from cinder.common import config # noqa
from cinder.openstack.common import log as logging
from cinder import service
from cinder import utils

View File

@ -53,11 +53,11 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'cinder', '__init__.py')):
from cinder.openstack.common import gettextutils
gettextutils.install('cinder')
from cinder.common import config # Need to register global_opts
# Need to register global_opts
from cinder.common import config # noqa
from cinder import context
from cinder import db
from cinder.openstack.common import log as logging
from cinder.openstack.common import rpc
from cinder import utils
from cinder import version
import cinder.volume.utils

View File

@ -12,7 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
import webob
from cinder.api import extensions

View File

@ -17,14 +17,10 @@
"""The volume encryption metadata extension."""
import webob
from cinder.api import extensions
from cinder.api.openstack import wsgi
from cinder.api import xmlutil
from cinder import db
from cinder import exception
from cinder.openstack.common.notifier import api as notifier_api
from cinder.volume import volume_types
authorize = extensions.extension_authorizer('volume',

View File

@ -22,7 +22,6 @@ import routes
from cinder.api.openstack import wsgi
from cinder.openstack.common import log as logging
from cinder import utils
from cinder import wsgi as base_wsgi

View File

@ -17,7 +17,6 @@ Handles all requests to Nova.
"""
from novaclient import extension
from novaclient import service_catalog
from novaclient.v1_1 import client as nova_client
from novaclient.v1_1.contrib import assisted_volume_snapshots

View File

@ -23,7 +23,6 @@ from cinder.openstack.common import gettextutils
gettextutils.install('cinder', lazy=False)
from cinder.db.sqlalchemy import migrate_repo
import cinder.openstack.common.db.sqlalchemy.session
from cinder import version
from migrate.versioning.shell import main

View File

@ -19,8 +19,6 @@ from sqlalchemy import Column, ForeignKey, MetaData, Table
from sqlalchemy import Boolean, DateTime, Integer, String
from cinder.openstack.common import log as logging
from cinder.openstack.common import timeutils
from cinder.openstack.common import uuidutils
LOG = logging.getLogger(__name__)

View File

@ -17,7 +17,7 @@
# under the License.
from sqlalchemy import Boolean, Column, DateTime
from sqlalchemy import ForeignKey, MetaData, Integer, String, Table
from sqlalchemy import ForeignKey, MetaData, String, Table
from cinder.openstack.common import log as logging

View File

@ -31,7 +31,6 @@ import webob.exc
from cinder.openstack.common.gettextutils import _
from cinder.openstack.common import log as logging
from cinder.openstack.common import processutils
LOG = logging.getLogger(__name__)

View File

@ -24,7 +24,6 @@ inline callbacks.
"""
import functools
import os
import shutil
import tempfile
@ -37,7 +36,7 @@ import stubout
import testtools
from testtools import matchers
from cinder.common import config # Need to register global_opts
from cinder.common import config # noqa Need to register global_opts
from cinder.db import migration
from cinder.openstack.common.db.sqlalchemy import session
from cinder.openstack.common import log as logging

View File

@ -12,19 +12,13 @@
# License for the specific language governing permissions and limitations
# under the License.
import datetime
import uuid
import webob
from cinder import db
from cinder import exception
from cinder.openstack.common import jsonutils
from cinder.openstack.common.rpc import common as rpc_common
from cinder import test
from cinder.tests.api import fakes
from cinder.tests.api.v2 import stubs
from cinder import volume
from cinder.volume import api as volume_api
class SnapshotActionsTest(test.TestCase):

View File

@ -19,17 +19,13 @@
import json
import webob
from xml.dom import minidom
from cinder.api.contrib import volume_type_encryption
from cinder import context
from cinder import db
from cinder import exception
from cinder.openstack.common.notifier import api as notifier_api
from cinder.openstack.common.notifier import test_notifier
from cinder import test
from cinder.tests.api import fakes
from cinder.volume import volume_types
def return_volume_type_encryption_db(context, volume_type_id, session):

View File

@ -14,7 +14,6 @@
# under the License.
from cinder.backup.driver import BackupDriver
from cinder.db import base
from cinder.openstack.common import log as logging
LOG = logging.getLogger(__name__)

View File

@ -23,9 +23,6 @@ import mox
from cinder.brick import exception
from cinder.brick.initiator import connector
from cinder.brick.initiator import host_driver
from cinder.brick.initiator import linuxfc
from cinder.brick.initiator import linuxscsi
from cinder.brick.remotefs import remotefs
from cinder.openstack.common import log as logging
from cinder.openstack.common import loopingcall
from cinder.openstack.common import processutils as putils

View File

@ -20,7 +20,6 @@ import string
from cinder.brick.initiator import linuxscsi
from cinder.openstack.common import log as logging
from cinder import test
from cinder import utils
LOG = logging.getLogger(__name__)

View File

@ -19,7 +19,6 @@ import mox
from cinder.brick.remotefs import remotefs
from cinder.openstack.common import log as logging
from cinder.openstack.common import processutils as putils
from cinder import test
LOG = logging.getLogger(__name__)

View File

@ -14,7 +14,6 @@
from cinder.compute import nova
from cinder import context
from cinder import exception
from cinder import test

View File

@ -17,7 +17,6 @@
from cinder import context
from cinder import db
from cinder import exception
from cinder import test
from cinder.tests import utils as testutils

View File

@ -20,7 +20,6 @@ import re
from eventlet import greenthread
from cinder import exception
from cinder.openstack.common import log as logging
from cinder.openstack.common import processutils
from cinder import utils

View File

@ -23,7 +23,6 @@ from cinder import service
from cinder.tests import fake_driver
from cinder.tests.integrated.api import client
from cinder.tests.integrated import integrated_helpers
from cinder.volume import driver
LOG = logging.getLogger(__name__)

View File

@ -16,9 +16,6 @@
Fakes For Scheduler tests.
"""
import mock
from cinder import db
from cinder.openstack.common import timeutils
from cinder.scheduler import filter_scheduler
from cinder.scheduler import host_manager

View File

@ -16,7 +16,6 @@ Tests For Chance Weigher.
"""
import mock
import random
from cinder.scheduler import host_manager
from cinder.scheduler.weights.chance import ChanceWeigher

View File

@ -22,13 +22,10 @@ Tests For Scheduler
import mock
from cinder import context
from cinder import db
from cinder import exception
from cinder.openstack.common import timeutils
from cinder.scheduler import driver
from cinder.scheduler import manager
from cinder import test
from cinder import utils
class SchedulerManagerTestCase(test.TestCase):

View File

@ -48,7 +48,7 @@ class ConfigTestCase(test.TestCase):
def test_runtime_and_unknown_conf(self):
self.assertNotIn('runtime_answer', CONF)
import cinder.tests.runtime_conf
import cinder.tests.runtime_conf # noqa
self.assertIn('runtime_answer', CONF)
self.assertEqual(CONF.runtime_answer, 54)

View File

@ -16,8 +16,6 @@
import time
import mock
from cinder import context
from cinder import test
from cinder.volume.flows import create_volume

View File

@ -18,7 +18,6 @@
from cinder import exception
from cinder import test
from cinder import utils
class FakeNotifier(object):

View File

@ -17,7 +17,6 @@
"""Unit tests for the GlusterFS driver module."""
import errno
import json
import os
import tempfile
@ -26,7 +25,6 @@ from mox import IgnoreArg
from mox import IsA
from mox import stubout
from cinder import compute
from cinder import context
from cinder import db
from cinder import exception
@ -34,7 +32,6 @@ from cinder.image import image_utils
from cinder.openstack.common import imageutils
from cinder.openstack.common import processutils as putils
from cinder import test
from cinder.tests.compute import test_nova
from cinder import units
from cinder import utils
from cinder.volume import configuration as conf

View File

@ -22,7 +22,6 @@ import tempfile
from cinder.brick.iscsi import iscsi
from cinder import test
from cinder.volume import driver
from cinder.volume import utils as volume_utils
class TargetAdminTestCase(object):

View File

@ -36,7 +36,6 @@ from cinder.volume.drivers.netapp.options import netapp_connection_opts
from cinder.volume.drivers.netapp.options import netapp_provisioning_opts
from cinder.volume.drivers.netapp.options import netapp_transport_opts
from cinder.volume.drivers.netapp import ssc_utils
from cinder.volume.drivers.netapp import utils
LOG = logging.getLogger("cinder.volume.driver")

View File

@ -31,7 +31,6 @@ from cinder import test
from cinder.volume import configuration as conf
from cinder.volume.drivers.netapp import api
from cinder.volume.drivers.netapp import nfs as netapp_nfs
from cinder.volume.drivers.netapp import ssc_utils
from oslo.config import cfg

View File

@ -20,16 +20,11 @@ import BaseHTTPServer
import copy
import httplib
from lxml import etree
import mox
from mox import IgnoreArg
from mox import IsA
from mox import MockObject
import StringIO
from cinder import context
from cinder import exception
from cinder import test
from cinder.volume import configuration as conf
from cinder.volume.drivers.netapp import api
from cinder.volume.drivers.netapp import ssc_utils

View File

@ -16,7 +16,6 @@
# under the License.
"""Unit tests for the NFS driver module."""
import __builtin__
import errno
import os
@ -29,7 +28,6 @@ from oslo.config import cfg
from cinder import context
from cinder import exception
from cinder.image import image_utils
from cinder.openstack.common import processutils as putils
from cinder import test
from cinder import units
from cinder.volume import configuration as conf

View File

@ -20,7 +20,6 @@ import contextlib
import os
import tempfile
from cinder import exception
from cinder.image import image_utils
from cinder.openstack.common import processutils
from cinder import test

View File

@ -25,7 +25,6 @@ Tests for the IBM Storwize family and SVC volume driver.
import random
import re
import socket
from cinder import context
from cinder import exception

View File

@ -20,7 +20,6 @@
import mock
import os.path
import ssl
import tempfile
import urllib2
@ -32,7 +31,6 @@ import webob.dec
from cinder import exception
from cinder.openstack.common import gettextutils
from cinder import test
from cinder import utils
import cinder.wsgi
CONF = cfg.CONF

View File

@ -21,7 +21,6 @@ Tests for Zadara VPSA volume driver
import copy
import httplib
import mox
from cinder import exception
from cinder.openstack.common import log as logging

View File

@ -16,8 +16,6 @@
#
import os
from cinder import context
from cinder import db

View File

@ -33,7 +33,6 @@ import shutil
import stat
import sys
import tempfile
import time
from eventlet import event
from eventlet import greenthread
@ -48,8 +47,6 @@ from xml.sax import saxutils
from cinder.brick.initiator import connector
from cinder import exception
from cinder.openstack.common import excutils
from cinder.openstack.common import gettextutils
from cinder.openstack.common import importutils
from cinder.openstack.common import lockutils
from cinder.openstack.common import log as logging

View File

@ -20,7 +20,6 @@ Drivers for volumes.
"""
import os
import time
from oslo.config import cfg

View File

@ -27,7 +27,6 @@ from oslo.config import cfg
from cinder import exception
from cinder.image import image_utils
from cinder.openstack.common import fileutils
from cinder.openstack.common import log as logging
from cinder.openstack.common import processutils
from cinder import units

View File

@ -25,8 +25,6 @@ from oslo.config import cfg
from cinder import exception
from cinder.openstack.common import log as logging
from cinder.volume.configuration import Configuration
from cinder.volume import driver
from cinder.volume.drivers.huawei import huawei_dorado
from cinder.volume.drivers.huawei import huawei_hvs
from cinder.volume.drivers.huawei import huawei_t

View File

@ -18,7 +18,6 @@
from xml.etree import ElementTree as ET
from cinder import exception
from cinder.openstack.common import log as logging
LOG = logging.getLogger(__name__)

View File

@ -22,6 +22,6 @@
"""
# Adding imports for backwards compatibility in loading volume_driver.
from hp_lefthand import HpSanISCSIDriver
from san import SanISCSIDriver
from solaris import SolarisISCSIDriver
from hp_lefthand import HpSanISCSIDriver # noqa
from san import SanISCSIDriver # noqa
from solaris import SolarisISCSIDriver # noqa

View File

@ -44,7 +44,6 @@ import json
import pprint
from random import randint
import re
import time
import uuid
from eventlet import greenthread
@ -52,7 +51,6 @@ import hp3parclient
from hp3parclient import client
from hp3parclient import exceptions as hpexceptions
from oslo.config import cfg
import paramiko
from cinder import context
from cinder import exception

View File

@ -32,9 +32,7 @@ volume_driver=cinder.volume.drivers.san.hp.hp_3par_fc.HP3PARFCDriver
"""
from hp3parclient import exceptions as hpexceptions
from oslo.config import cfg
from cinder import exception
from cinder.openstack.common import log as logging
from cinder import utils
import cinder.volume.driver

View File

@ -18,13 +18,10 @@
import math
import os
import stat
from oslo.config import cfg
from cinder.brick.local_dev import lvm as brick_lvm
from cinder import exception
from cinder.openstack.common import log as logging
from cinder.openstack.common.notifier import api as notifier_api
from cinder.openstack.common import processutils

View File

@ -43,6 +43,6 @@ commands =
commands = {posargs}
[flake8]
ignore = E711,E712,F401,F403,F841,H302,H303,H304,H803
ignore = E711,E712,F403,F841,H302,H303,H304,H803
builtins = _
exclude = .git,.venv,.tox,dist,doc,common,*egg,build
exclude = .git,.venv,.tox,dist,tools,doc,common,*egg,build