From 878b25ea2e3cb89b440e773687fc2e4d6f354cb6 Mon Sep 17 00:00:00 2001 From: Zhongyue Luo Date: Sat, 30 Jun 2012 08:41:01 +0800 Subject: [PATCH] Reorder imports by full import path Fixes bug #1019463 Change-Id: I3fb44cbacb09457ea34571222e0a8e8d4b8d7c87 --- glance/api/v1/controller.py | 2 +- glance/api/v1/images.py | 6 +++--- glance/api/v2/schemas.py | 2 +- glance/common/wsgi.py | 2 +- glance/db/sqlalchemy/models.py | 8 ++++---- glance/image_cache/prefetcher.py | 2 +- glance/registry/api/v1/images.py | 2 +- glance/store/s3.py | 2 +- glance/store/scrubber.py | 12 ++++++------ glance/tests/functional/test_bin_glance.py | 2 +- glance/tests/functional/test_respawn.py | 3 +-- glance/tests/functional/v1/test_copy_to_file.py | 2 +- glance/tests/functional/v1/test_rbd.py | 2 +- glance/tests/functional/v1/test_s3.py | 8 ++++---- glance/tests/functional/v1/test_swift.py | 6 +++--- glance/tests/functional/v2/test_images.py | 2 +- glance/tests/unit/base.py | 4 ++-- glance/tests/unit/test_context.py | 2 +- glance/tests/unit/test_filesystem_store.py | 4 ++-- glance/tests/unit/test_image_cache.py | 2 +- glance/tests/unit/test_migrations.py | 2 +- glance/tests/unit/test_misc.py | 2 +- glance/tests/unit/test_s3_store.py | 6 +++--- glance/tests/unit/test_store_location.py | 6 +++--- glance/tests/unit/test_swift_store.py | 4 ++-- glance/tests/unit/test_wsgi.py | 4 ++-- glance/tests/unit/v1/test_api.py | 8 ++++---- glance/tests/unit/v2/test_image_data_resource.py | 2 +- 28 files changed, 54 insertions(+), 55 deletions(-) diff --git a/glance/api/v1/controller.py b/glance/api/v1/controller.py index 662dd715..ddb8b9b1 100644 --- a/glance/api/v1/controller.py +++ b/glance/api/v1/controller.py @@ -19,8 +19,8 @@ import logging import webob.exc -from glance import registry from glance.common import exception +from glance import registry LOG = logging.getLogger(__name__) diff --git a/glance/api/v1/images.py b/glance/api/v1/images.py index 44deb261..bc225e77 100644 --- a/glance/api/v1/images.py +++ b/glance/api/v1/images.py @@ -38,17 +38,17 @@ import glance.api.v1 from glance.api.v1 import controller from glance.api.v1 import filters from glance.common import exception -from glance.common import wsgi from glance.common import utils +from glance.common import wsgi +from glance import notifier from glance.openstack.common import cfg +from glance import registry from glance.store import (create_stores, get_from_backend, get_size_from_backend, schedule_delete_from_backend, get_store_from_location, get_store_from_scheme) -from glance import registry -from glance import notifier LOG = logging.getLogger(__name__) diff --git a/glance/api/v2/schemas.py b/glance/api/v2/schemas.py index c7c8790d..da30e252 100644 --- a/glance/api/v2/schemas.py +++ b/glance/api/v2/schemas.py @@ -13,8 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -from glance.api.v2 import images from glance.api.v2 import image_access +from glance.api.v2 import images from glance.common import wsgi diff --git a/glance/common/wsgi.py b/glance/common/wsgi.py index 215b4d6c..25f86aaf 100644 --- a/glance/common/wsgi.py +++ b/glance/common/wsgi.py @@ -31,8 +31,8 @@ import sys import time import eventlet -import eventlet.greenio from eventlet.green import socket, ssl +import eventlet.greenio import eventlet.wsgi import routes import routes.middleware diff --git a/glance/db/sqlalchemy/models.py b/glance/db/sqlalchemy/models.py index 59d5c863..acb1da3c 100644 --- a/glance/db/sqlalchemy/models.py +++ b/glance/db/sqlalchemy/models.py @@ -20,15 +20,15 @@ SQLAlchemy models for glance data """ -from sqlalchemy.orm import relationship, backref, object_mapper from sqlalchemy import Column, Integer, String, BigInteger -from sqlalchemy import ForeignKey, DateTime, Boolean, Text -from sqlalchemy import UniqueConstraint from sqlalchemy.ext.compiler import compiles from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy import ForeignKey, DateTime, Boolean, Text +from sqlalchemy.orm import relationship, backref, object_mapper +from sqlalchemy import UniqueConstraint -import glance.db.sqlalchemy.api from glance.common import utils +import glance.db.sqlalchemy.api from glance.openstack.common import timeutils BASE = declarative_base() diff --git a/glance/image_cache/prefetcher.py b/glance/image_cache/prefetcher.py index 3098726f..e8626167 100644 --- a/glance/image_cache/prefetcher.py +++ b/glance/image_cache/prefetcher.py @@ -29,11 +29,11 @@ from glance.image_cache import base from glance import registry import glance.store import glance.store.filesystem +from glance.store import get_from_backend import glance.store.http import glance.store.rbd import glance.store.s3 import glance.store.swift -from glance.store import get_from_backend LOG = logging.getLogger(__name__) diff --git a/glance/registry/api/v1/images.py b/glance/registry/api/v1/images.py index b7c150a2..b722c6db 100644 --- a/glance/registry/api/v1/images.py +++ b/glance/registry/api/v1/images.py @@ -26,8 +26,8 @@ from webob import exc from glance.common import exception from glance.common import utils from glance.common import wsgi -from glance.openstack.common import cfg import glance.db +from glance.openstack.common import cfg from glance.openstack.common import timeutils diff --git a/glance/store/s3.py b/glance/store/s3.py index 6fd245b7..062e5225 100644 --- a/glance/store/s3.py +++ b/glance/store/s3.py @@ -17,9 +17,9 @@ """Storage backend for S3 or Storage Servers that follow the S3 Protocol""" -import logging import hashlib import httplib +import logging import re import tempfile import urlparse diff --git a/glance/store/scrubber.py b/glance/store/scrubber.py index d62afbfb..39132a55 100644 --- a/glance/store/scrubber.py +++ b/glance/store/scrubber.py @@ -18,18 +18,18 @@ import calendar import eventlet import logging -import time import os +import time +from glance.common import utils +from glance.openstack.common import cfg +from glance import registry +from glance.registry import client +from glance import store import glance.store.filesystem import glance.store.http import glance.store.s3 import glance.store.swift -from glance import registry -from glance import store -from glance.common import utils -from glance.openstack.common import cfg -from glance.registry import client LOG = logging.getLogger(__name__) diff --git a/glance/tests/functional/test_bin_glance.py b/glance/tests/functional/test_bin_glance.py index 59825f9c..d65abebe 100644 --- a/glance/tests/functional/test_bin_glance.py +++ b/glance/tests/functional/test_bin_glance.py @@ -28,10 +28,10 @@ import time from glance.openstack.common import timeutils from glance.tests import functional -from glance.tests.utils import execute, requires, minimal_add_command from glance.tests.functional.store_utils import (setup_http, teardown_http, get_http_uri) +from glance.tests.utils import execute, requires, minimal_add_command class TestBinGlance(functional.FunctionalTest): diff --git a/glance/tests/functional/test_respawn.py b/glance/tests/functional/test_respawn.py index a24ad930..83502359 100644 --- a/glance/tests/functional/test_respawn.py +++ b/glance/tests/functional/test_respawn.py @@ -18,9 +18,8 @@ import httplib2 import os -import time -import socket import signal +import socket import sys import time diff --git a/glance/tests/functional/v1/test_copy_to_file.py b/glance/tests/functional/v1/test_copy_to_file.py index 093d627a..22f68276 100644 --- a/glance/tests/functional/v1/test_copy_to_file.py +++ b/glance/tests/functional/v1/test_copy_to_file.py @@ -46,7 +46,6 @@ import json import tempfile from glance.tests import functional -from glance.tests.utils import skip_if_disabled, requires from glance.tests.functional.store_utils import (setup_swift, teardown_swift, get_swift_uri, @@ -56,6 +55,7 @@ from glance.tests.functional.store_utils import (setup_swift, setup_http, teardown_http, get_http_uri) +from glance.tests.utils import skip_if_disabled, requires FIVE_KB = 5 * 1024 diff --git a/glance/tests/functional/v1/test_rbd.py b/glance/tests/functional/v1/test_rbd.py index dafc8c68..7c7ab059 100644 --- a/glance/tests/functional/v1/test_rbd.py +++ b/glance/tests/functional/v1/test_rbd.py @@ -38,8 +38,8 @@ found, or creating the pool fails, all the test cases are skipped. import ConfigParser import os -from glance.tests.functional.v1 import test_api from glance.store.rbd import DEFAULT_POOL, DEFAULT_CONFFILE, DEFAULT_USER +from glance.tests.functional.v1 import test_api class TestRBD(test_api.TestApi): diff --git a/glance/tests/functional/v1/test_s3.py b/glance/tests/functional/v1/test_s3.py index acc118b5..823cbdd6 100644 --- a/glance/tests/functional/v1/test_s3.py +++ b/glance/tests/functional/v1/test_s3.py @@ -37,10 +37,6 @@ import httplib2 from glance.common import crypt from glance.common import utils -from glance.tests.functional.v1 import test_api -from glance.tests.utils import (skip_if_disabled, - requires, - minimal_headers) from glance.tests.functional.store_utils import (setup_s3, teardown_s3, get_s3_uri, @@ -50,6 +46,10 @@ from glance.tests.functional.store_utils import (setup_s3, setup_http, teardown_http, get_http_uri) +from glance.tests.functional.v1 import test_api +from glance.tests.utils import (skip_if_disabled, + requires, + minimal_headers) FIVE_KB = 5 * 1024 diff --git a/glance/tests/functional/v1/test_swift.py b/glance/tests/functional/v1/test_swift.py index dbfef844..2db13250 100644 --- a/glance/tests/functional/v1/test_swift.py +++ b/glance/tests/functional/v1/test_swift.py @@ -36,10 +36,8 @@ import httplib2 import json from glance.common import crypt -import glance.store.swift # Needed to register driver for location from glance.store.location import get_location_from_uri -from glance.tests.functional.v1 import test_api -from glance.tests.utils import skip_if_disabled, requires, minimal_headers +import glance.store.swift # Needed to register driver for location from glance.tests.functional.store_utils import (setup_swift, get_swift_uri, setup_s3, @@ -48,6 +46,8 @@ from glance.tests.functional.store_utils import (setup_swift, setup_http, teardown_http, get_http_uri) +from glance.tests.functional.v1 import test_api +from glance.tests.utils import skip_if_disabled, requires, minimal_headers FIVE_KB = 5 * 1024 FIVE_MB = 5 * 1024 * 1024 diff --git a/glance/tests/functional/v2/test_images.py b/glance/tests/functional/v2/test_images.py index 6eeff450..123f7136 100644 --- a/glance/tests/functional/v2/test_images.py +++ b/glance/tests/functional/v2/test_images.py @@ -19,8 +19,8 @@ import json import requests -from glance.tests import functional from glance.common import utils +from glance.tests import functional TENANT1 = utils.generate_uuid() diff --git a/glance/tests/unit/base.py b/glance/tests/unit/base.py index 4f74b0c4..5db08fff 100644 --- a/glance/tests/unit/base.py +++ b/glance/tests/unit/base.py @@ -21,10 +21,10 @@ import shutil import stubout -from glance import store from glance.openstack.common import cfg -from glance.store import location +from glance import store from glance.store import filesystem +from glance.store import location from glance.tests import stubs from glance.tests import utils as test_utils diff --git a/glance/tests/unit/test_context.py b/glance/tests/unit/test_context.py index 7b3d6b39..e79ec8a6 100644 --- a/glance/tests/unit/test_context.py +++ b/glance/tests/unit/test_context.py @@ -16,8 +16,8 @@ # under the License. from glance.common import context -from glance.tests import utils from glance.tests.unit import utils as unit_utils +from glance.tests import utils def _fake_image(owner, is_public): diff --git a/glance/tests/unit/test_filesystem_store.py b/glance/tests/unit/test_filesystem_store.py index 7501a6be..1b6ffa0f 100644 --- a/glance/tests/unit/test_filesystem_store.py +++ b/glance/tests/unit/test_filesystem_store.py @@ -18,13 +18,13 @@ """Tests the filesystem backend store""" import errno -import StringIO import hashlib +import StringIO from glance.common import exception from glance.common import utils -from glance.store.location import get_location_from_uri from glance.store.filesystem import Store, ChunkedFile +from glance.store.location import get_location_from_uri from glance.tests.unit import base diff --git a/glance/tests/unit/test_image_cache.py b/glance/tests/unit/test_image_cache.py index 3e75cd15..57092eb9 100644 --- a/glance/tests/unit/test_image_cache.py +++ b/glance/tests/unit/test_image_cache.py @@ -23,8 +23,8 @@ import StringIO import stubout -from glance import image_cache from glance.common import utils +from glance import image_cache from glance.tests import utils as test_utils from glance.tests.utils import skip_if_disabled, xattr_writes_supported diff --git a/glance/tests/unit/test_migrations.py b/glance/tests/unit/test_migrations.py index b63d7bab..663ac52c 100644 --- a/glance/tests/unit/test_migrations.py +++ b/glance/tests/unit/test_migrations.py @@ -34,9 +34,9 @@ from sqlalchemy import * from sqlalchemy.pool import NullPool from glance.common import exception -from glance.openstack.common import cfg import glance.db.sqlalchemy.migration as migration_api from glance.db.sqlalchemy import models +from glance.openstack.common import cfg from glance.tests import utils diff --git a/glance/tests/unit/test_misc.py b/glance/tests/unit/test_misc.py index d4e151eb..9d1c8ab6 100644 --- a/glance/tests/unit/test_misc.py +++ b/glance/tests/unit/test_misc.py @@ -15,9 +15,9 @@ # License for the specific language governing permissions and limitations # under the License. -import os import commands import datetime +import os import re from glance.common import crypt diff --git a/glance/tests/unit/test_s3_store.py b/glance/tests/unit/test_s3_store.py index 17394b0c..9fd9788c 100644 --- a/glance/tests/unit/test_s3_store.py +++ b/glance/tests/unit/test_s3_store.py @@ -17,18 +17,18 @@ """Tests the S3 backend store""" -import StringIO import hashlib +import StringIO -import stubout import boto.s3.connection +import stubout from glance.common import exception from glance.common import utils from glance.openstack.common import cfg -from glance.store import UnsupportedBackend from glance.store.location import get_location_from_uri from glance.store.s3 import Store, get_s3_location +from glance.store import UnsupportedBackend from glance.tests.unit import base from glance.tests import utils as test_utils diff --git a/glance/tests/unit/test_store_location.py b/glance/tests/unit/test_store_location.py index 18ff98f5..4e789304 100644 --- a/glance/tests/unit/test_store_location.py +++ b/glance/tests/unit/test_store_location.py @@ -17,11 +17,11 @@ from glance.common import exception import glance.store -import glance.store.location as location -import glance.store.http import glance.store.filesystem -import glance.store.swift +import glance.store.http +import glance.store.location as location import glance.store.s3 +import glance.store.swift from glance.tests.unit import base from glance.tests import utils diff --git a/glance/tests/unit/test_swift_store.py b/glance/tests/unit/test_swift_store.py index d509c74f..762ef2f0 100644 --- a/glance/tests/unit/test_swift_store.py +++ b/glance/tests/unit/test_swift_store.py @@ -17,9 +17,9 @@ """Tests the Swift backend store""" -import StringIO import hashlib import httplib +import StringIO import tempfile import urllib @@ -30,8 +30,8 @@ from glance.common import exception from glance.common import utils from glance.openstack.common import cfg from glance.store import BackendException -import glance.store.swift from glance.store.location import get_location_from_uri +import glance.store.swift from glance.tests.unit import base CONF = cfg.CONF diff --git a/glance/tests/unit/test_wsgi.py b/glance/tests/unit/test_wsgi.py index 65891142..7b97eec0 100644 --- a/glance/tests/unit/test_wsgi.py +++ b/glance/tests/unit/test_wsgi.py @@ -17,9 +17,9 @@ import webob -from glance.common import wsgi -from glance.common import utils from glance.common import exception +from glance.common import utils +from glance.common import wsgi from glance.tests import utils as test_utils diff --git a/glance/tests/unit/v1/test_api.py b/glance/tests/unit/v1/test_api.py index d0104d1d..22302f9b 100644 --- a/glance/tests/unit/v1/test_api.py +++ b/glance/tests/unit/v1/test_api.py @@ -21,20 +21,20 @@ import httplib import json import routes +from sqlalchemy import exc import stubout import webob -from sqlalchemy import exc from glance.api.v1 import images from glance.api.v1 import router from glance.common import context from glance.common import utils -from glance.openstack.common import timeutils -from glance.registry.api import v1 as rserver from glance.db.sqlalchemy import api as db_api from glance.db.sqlalchemy import models as db_models -from glance.tests import utils as test_utils +from glance.openstack.common import timeutils +from glance.registry.api import v1 as rserver from glance.tests.unit import base +from glance.tests import utils as test_utils _gen_uuid = utils.generate_uuid diff --git a/glance/tests/unit/v2/test_image_data_resource.py b/glance/tests/unit/v2/test_image_data_resource.py index 3acd1eca..e9479720 100644 --- a/glance/tests/unit/v2/test_image_data_resource.py +++ b/glance/tests/unit/v2/test_image_data_resource.py @@ -19,8 +19,8 @@ import webob import glance.api.v2.image_data from glance.common import utils -import glance.tests.unit.utils as unit_test_utils from glance.tests.unit import base +import glance.tests.unit.utils as unit_test_utils import glance.tests.utils as test_utils