Make sure there are no unused import

Remove all currently unused imports
Prevent future unused imports

Change-Id: I6ac26d5c71b79952a7732db300355a00310c712e
This commit is contained in:
Joe Gordon 2013-01-25 20:34:03 +00:00
parent ce09c50c92
commit 8af6c6b885
29 changed files with 14 additions and 54 deletions

View File

@ -17,7 +17,6 @@
from nova import db
from nova.openstack.common import cfg
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
availability_zone_opts = [

View File

@ -57,13 +57,11 @@ from nova import network
from nova.network import model as network_model
from nova.openstack.common import cfg
from nova.openstack.common import excutils
from nova.openstack.common import importutils
from nova.openstack.common import jsonutils
from nova.openstack.common import lockutils
from nova.openstack.common import log as logging
from nova.openstack.common.notifier import api as notifier
from nova.openstack.common import rpc
from nova.openstack.common.rpc import common as rpc_common
from nova.openstack.common import timeutils
from nova import paths
from nova import quota

View File

@ -4,8 +4,7 @@ from sqlalchemy.ext.compiler import compiles
from sqlalchemy import MetaData, Table, Column, Index
from sqlalchemy import select
from sqlalchemy.sql.expression import UpdateBase
from sqlalchemy.sql import literal_column
from sqlalchemy import String, Integer, Boolean
from sqlalchemy import Integer, Boolean
from sqlalchemy.types import NullType, BigInteger

View File

@ -25,7 +25,6 @@ SHOULD include dedicated exception logging.
"""
import functools
import itertools
import webob.exc

View File

@ -47,7 +47,6 @@ import datetime
import itertools
import math
import re
import socket
import uuid
from eventlet import greenpool

View File

@ -21,7 +21,6 @@ the system.
import nova.context
from nova import db
from nova import exception
from nova.image import glance
from nova import network
from nova.network import model as network_model

View File

@ -14,7 +14,6 @@
# under the License.
from nova import availability_zones
from nova import db
from nova.openstack.common import cfg
from nova.scheduler import filters

View File

@ -38,7 +38,6 @@ from nova.openstack.common import eventlet_backdoor
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.openstack.common import rpc
from nova.openstack.common.rpc import common as rpc_common
from nova import servicegroup
from nova import utils
from nova import version

View File

@ -16,7 +16,6 @@
from nova import conductor
from nova import context
from nova import exception
from nova.openstack.common import cfg
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils

View File

@ -20,10 +20,6 @@ import imp
import os
import sys
from nova import context
from nova import test
from nova.virt.baremetal import db as bmdb
from nova.tests.baremetal.db import base as bm_db_base
TOPDIR = os.path.normpath(os.path.join(

View File

@ -21,12 +21,10 @@
import os
import mox
from testtools import matchers
from nova import exception
from nova.openstack.common import cfg
from nova import test
from nova.tests.baremetal.db import base as bm_db_base
from nova.tests.baremetal.db import utils as bm_db_utils
from nova.tests.image import fake as fake_image

View File

@ -18,12 +18,9 @@
"""Tests for baremetal utils."""
import mox
import errno
import os
from nova import exception
from nova import test
from nova.virt.baremetal import utils

View File

@ -14,8 +14,6 @@
"""
Tests For Cells Messaging module
"""
import mox
from nova.cells import messaging
from nova.cells import utils as cells_utils
from nova import context

View File

@ -15,7 +15,6 @@
# 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 shutil
import fixtures
import mox

View File

@ -23,7 +23,6 @@ from nova import availability_zones as az
from nova import context
from nova import db
from nova.openstack.common import cfg
from nova import service
from nova import test
CONF = cfg.CONF

View File

@ -17,7 +17,6 @@
import time
import fixtures
from testtools import matchers
from nova import manager

View File

@ -119,8 +119,6 @@ class _FakeDriverBackendTestCase(object):
def _teardown_fakelibvirt(self):
# Restore libvirt
import nova.virt.libvirt.driver
import nova.virt.libvirt.firewall
if self.saved_libvirt:
sys.modules['libvirt'] = self.saved_libvirt

View File

@ -19,10 +19,8 @@
import contextlib
import fixtures
import mox
import uuid
from nova import test
from nova.tests.xenapi import stubs
from nova import utils
from nova.virt.xenapi import vm_utils

View File

@ -27,11 +27,9 @@ from nova import exception
from nova.openstack.common import cfg
from nova.openstack.common import fileutils
from nova.openstack.common import log as logging
from nova import utils
from nova.virt.baremetal import base
from nova.virt.baremetal import db
from nova.virt.baremetal import utils as bm_utils
from nova.virt.disk import api as disk
pxe_opts = [

View File

@ -28,7 +28,7 @@ from nova import utils
from nova.virt.libvirt import config as vconfig
from nova.virt.libvirt import designer
from nova.virt import netutils
LOG = logging.getLogger(__name__)
libvirt_vif_opts = [

View File

@ -18,16 +18,11 @@ import hashlib
import os
import re
from eventlet import greenthread
from nova import utils
from nova.image import glance
from nova.openstack.common import cfg
from nova.openstack.common import excutils
from nova.openstack.common import log as logging
from nova import utils
from nova.virt import images
from nova.virt.powervm import command
from nova.virt.powervm import common

View File

@ -14,19 +14,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
import time
from nova.compute import task_states
from nova.compute import vm_states
from nova import context as nova_context
from nova.image import glance
from nova.openstack.common import cfg
from nova.openstack.common import log as logging
from nova.virt import driver
from nova.virt.powervm import operator

View File

@ -18,8 +18,6 @@
Management class for host-related functions (start, reboot, etc).
"""
import json
from nova import exception
from nova.openstack.common import log as logging
from nova.virt.vmwareapi import vim_util

View File

@ -35,9 +35,7 @@ from nova import context as nova_context
from nova import exception
from nova.openstack.common import cfg
from nova.openstack.common import excutils
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova.virt import driver
from nova.virt.vmwareapi import network_util
from nova.virt.vmwareapi import vif as vmwarevif

View File

@ -22,7 +22,6 @@ and storage repositories
import re
import string
from nova import exception
from nova.openstack.common import log as logging
from nova.virt.vmwareapi import vim_util

View File

@ -142,6 +142,7 @@ function run_pep8 {
echo "Running pep8"
${wrapper} python tools/hacking.py ${ignore} ${srcfiles}
${wrapper} bash tools/unused_imports.sh
# NOTE(sdague): as of grizzly-2 these are passing however leaving the comment
# in here in case we need to break it out when we get more of our hacking working
# again.

View File

@ -8,7 +8,7 @@ import __builtin__
import os
import sys
from pyflakes.scripts.pyflakes import main
from pyflakes.scripts import pyflakes
if __name__ == "__main__":
names = os.environ.get('PYFLAKES_BUILTINS', '_')
@ -19,4 +19,4 @@ if __name__ == "__main__":
del names, os, __builtin__
sys.exit(main())
sys.exit(pyflakes.main())

4
tools/unused_imports.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
#snakefood sfood-checker detects even more unused imports
! pyflakes nova/ | grep "imported but unused"

View File

@ -15,13 +15,16 @@ sitepackages = True
downloadcache = ~/cache/pip
[testenv:pep8]
deps=pep8==1.3.3
deps=
pep8==1.3.3
pyflakes
commands =
python tools/hacking.py --doctest
python tools/hacking.py --ignore=E12,E711,E721,E712,N403,N404 --show-source \
--exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg .
python tools/hacking.py --ignore=E12,E711,E721,E712,N403,N404 --show-source \
--filename=nova* bin
bash tools/unused_imports.sh
[testenv:pylint]
setenv = VIRTUAL_ENV={envdir}