From d17344aede6ef3ba955af0ae1d3380de387004d2 Mon Sep 17 00:00:00 2001 From: vinkesh banka Date: Tue, 2 Aug 2011 10:19:32 +0530 Subject: [PATCH] Vinkesh | Changed import orders according to pep8 recommendations --- quantum/common/extensions.py | 7 +++---- quantum/common/flags.py | 4 +--- quantum/common/utils.py | 8 ++++---- quantum/common/wsgi.py | 8 ++++---- quantum/db/api.py | 2 ++ quantum/db/models.py | 2 ++ tests/unit/test_api.py | 2 +- tests/unit/test_extensions.py | 8 +++++--- 8 files changed, 22 insertions(+), 19 deletions(-) diff --git a/quantum/common/extensions.py b/quantum/common/extensions.py index 430c0c94de..10795f8053 100644 --- a/quantum/common/extensions.py +++ b/quantum/common/extensions.py @@ -16,18 +16,17 @@ # 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 imp +import logging import os import routes -import logging import webob.dec import webob.exc + from gettext import gettext as _ from abc import ABCMeta - -from quantum.manager import QuantumManager from quantum.common import exceptions +from quantum.manager import QuantumManager from quantum.common import wsgi LOG = logging.getLogger('quantum.common.extensions') diff --git a/quantum/common/flags.py b/quantum/common/flags.py index 5adf4c3854..16badd3329 100644 --- a/quantum/common/flags.py +++ b/quantum/common/flags.py @@ -21,14 +21,12 @@ Wraps gflags. Global flags should be defined here, the rest are defined where they're used. """ - import getopt +import gflags import os import string import sys -import gflags - class FlagValues(gflags.FlagValues): """Extension of gflags.FlagValues that allows undefined and runtime flags. diff --git a/quantum/common/utils.py b/quantum/common/utils.py index ea6241e21b..5662e7465a 100644 --- a/quantum/common/utils.py +++ b/quantum/common/utils.py @@ -18,8 +18,10 @@ """ System-level utilities and helper functions. """ - +import ConfigParser import datetime +import exceptions as exception +import flags import inspect import logging import os @@ -27,10 +29,8 @@ import random import subprocess import socket import sys -import ConfigParser -import exceptions as exception -import flags + from exceptions import ProcessExecutionError diff --git a/quantum/common/wsgi.py b/quantum/common/wsgi.py index ca9734e878..94df7913c6 100644 --- a/quantum/common/wsgi.py +++ b/quantum/common/wsgi.py @@ -22,17 +22,17 @@ Utility methods for working with WSGI servers import logging import sys - -from xml.dom import minidom - import eventlet.wsgi eventlet.patcher.monkey_patch(all=False, socket=True) import routes.middleware import webob.dec import webob.exc +from xml.dom import minidom + -from quantum import utils from quantum.common import exceptions as exception +from quantum import utils + LOG = logging.getLogger('quantum.common.wsgi') diff --git a/quantum/db/api.py b/quantum/db/api.py index 6813d2096c..2b7167ba8d 100644 --- a/quantum/db/api.py +++ b/quantum/db/api.py @@ -20,8 +20,10 @@ from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker, exc + from quantum.db import models + _ENGINE = None _MAKER = None BASE = models.BASE diff --git a/quantum/db/models.py b/quantum/db/models.py index 1a18e7e518..240b28349e 100644 --- a/quantum/db/models.py +++ b/quantum/db/models.py @@ -19,10 +19,12 @@ import uuid + from sqlalchemy import Column, String, ForeignKey from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relation, object_mapper + BASE = declarative_base() diff --git a/tests/unit/test_api.py b/tests/unit/test_api.py index d17e6ed87f..4eca189cfc 100644 --- a/tests/unit/test_api.py +++ b/tests/unit/test_api.py @@ -20,8 +20,8 @@ import logging import unittest -import tests.unit.testlib_api as testlib +import tests.unit.testlib_api as testlib from quantum import api as server from quantum.db import api as db from quantum.common.wsgi import Serializer diff --git a/tests/unit/test_extensions.py b/tests/unit/test_extensions.py index 22079df677..b22a8a3c55 100644 --- a/tests/unit/test_extensions.py +++ b/tests/unit/test_extensions.py @@ -14,12 +14,13 @@ # License for the specific language governing permissions and limitations # under the License. import json -import unittest -import routes import os.path +import routes +import unittest from tests.unit import BaseTest - from webtest import TestApp + + from quantum.common import wsgi from quantum.common import config from quantum.common import extensions @@ -32,6 +33,7 @@ from quantum.common.extensions import (ExtensionManager, PluginAwareExtensionManager, ExtensionMiddleware) + test_conf_file = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, 'etc', 'quantum.conf.test') extensions_path = os.path.join(os.path.dirname(__file__), "extensions")