Follow hacking rules about import

This patch follows the rules about import in HACKING.rst
https://github.com/openstack/marconi/blob/master/HACKING.rst#imports

* reorder imports
* Add missing blank lines before code

Change-Id: I4abcfb3a2640499c5df34cbf75b5eaecb3d19823
This commit is contained in:
Chang Bo Guo 2013-10-08 05:00:53 -07:00
parent 2881edcf1c
commit 683206d237
68 changed files with 98 additions and 13 deletions

View File

@ -19,6 +19,7 @@ from oslo.config import cfg
from marconi.common.cache import backends
_memcache_opts = [
cfg.ListOpt('memcached_servers',
default=['127.0.0.1:11211'],

View File

@ -22,6 +22,7 @@ Supported configuration options:
from oslo.config import cfg
from stevedore import driver
_cache_options = [
cfg.StrOpt('cache_backend',
default='memory',

View File

@ -22,6 +22,7 @@ import termios
from marconi.openstack.common import log as logging
LOG = logging.getLogger(__name__)

View File

@ -12,13 +12,16 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""wsgi transport helpers."""
import falcon
import six
import marconi.openstack.common.log as logging
from marconi.queues.transport import validation as validate
LOG = logging.getLogger(__name__)

View File

@ -12,7 +12,9 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Defines an interface for working with proxy partitions and the catalogue."""
import abc
import six

View File

@ -12,6 +12,7 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""These are the exceptions that the proxy storage layer can raise."""

View File

@ -12,6 +12,7 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from marconi.proxy.storage.memory import catalogue
from marconi.proxy.storage.memory import partitions

View File

@ -12,6 +12,7 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from marconi.proxy.storage import base
from marconi.proxy.storage.memory import controllers

View File

@ -12,6 +12,7 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""MongoDB Proxy Storage Driver for Marconi"""
from marconi.proxy.storage.mongodb import driver

View File

@ -32,6 +32,7 @@ from marconi.proxy.storage import base
from marconi.proxy.storage import exceptions
from marconi.queues.storage.mongodb import utils
LOG = logging.getLogger(__name__)
CATALOGUE_INDEX = [

View File

@ -18,5 +18,6 @@
from marconi.proxy.storage.mongodb import catalogue
from marconi.proxy.storage.mongodb import partitions
CatalogueController = catalogue.CatalogueController
PartitionsController = partitions.PartitionsController

View File

@ -23,6 +23,7 @@ from marconi.proxy import storage
from marconi.proxy.storage.mongodb import controllers
from marconi.proxy.storage.mongodb import options
LOG = logging.getLogger(__name__)

View File

@ -28,6 +28,7 @@ from marconi.proxy.storage import base
from marconi.proxy.storage import exceptions
from marconi.queues.storage.mongodb import utils
PARTITIONS_INDEX = [
('n', 1)
]

View File

@ -12,6 +12,7 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""schema: JSON Schemas for marconi proxy transports."""
partition_patch_hosts = {

View File

@ -12,6 +12,7 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""utils: utilities for transport handling."""
import jsonschema

View File

@ -12,6 +12,7 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""marconi-proxy (admin): interface for managing partitions."""
from marconi.proxy.transport.wsgi import (

View File

@ -12,8 +12,10 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""catalogue: maintains a directory of all queues proxied through the system.
"""
import json
import falcon
@ -22,6 +24,7 @@ from marconi.openstack.common import log
from marconi.proxy.storage import exceptions
from marconi.proxy.utils import helpers
LOG = log.getLogger(__name__)

View File

@ -12,7 +12,9 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""marconi-proxy (base): Interface for driver implementations."""
import abc
from wsgiref import simple_server

View File

@ -12,9 +12,11 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""forward: a resource for each marconi route where the desired result
is to just pass along a request to marconi.
"""
from marconi.proxy.utils import forward

View File

@ -12,7 +12,9 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""health: returns the health information for this proxy."""
import falcon

View File

@ -12,9 +12,11 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""metadata: adds queue metadata to the catalogue and forwards to
marconi queue metadata requests.
"""
import io
import json

View File

@ -12,6 +12,7 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""partitions: a registry of all marconi partitions this proxy can route to
A partition is added by an operator by interacting with the
@ -24,6 +25,7 @@ following fields are required:
"hosts": [HTTP_EndPoints(:Port), ...]
}
"""
import json
import falcon
@ -36,6 +38,7 @@ from marconi.proxy.transport import schema, utils
from marconi.queues.transport import utils as json_utils
from marconi.queues.transport.wsgi import exceptions as wsgi_errors
LOG = log.getLogger(__name__)

View File

@ -12,6 +12,7 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""queues: routing and cataloguing queue operations on marconi
The queues resource performs routing to a marconi partition for
@ -27,6 +28,7 @@ based on the operation. A DELETE removes entries from the catalogue. A
PUT adds an entry to the catalogue. A GET asks marconi for an
authoritative response.
"""
import collections
import json

View File

@ -12,13 +12,16 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""v1: queries the first node in the first partition for a homedoc."""
import falcon
from marconi.openstack.common import log
from marconi.proxy.utils import helpers
from marconi.proxy.utils import http
LOG = log.getLogger(__name__)

View File

@ -12,6 +12,7 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""version: version information for the proxy transport API."""

View File

@ -12,7 +12,9 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""forward: exposes a mixin class appropriate for forwarding requests."""
import falcon
from marconi.openstack.common import log
@ -20,6 +22,7 @@ from marconi.proxy.utils import helpers
from marconi.proxy.utils import http
from marconi.proxy.utils import lookup
LOG = log.getLogger(__name__)

View File

@ -12,7 +12,9 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""helpers: utilities for performing common operations for resources."""
import requests

View File

@ -12,7 +12,9 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""http: utilities for handling HTTP details."""
import falcon

View File

@ -12,14 +12,18 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""lookup: functions to handle caching/lookup of proxy details."""
import msgpack
from marconi.openstack.common import log
from marconi.proxy.storage import exceptions
LOG = log.getLogger(__name__)
def _entry_key(project, queue):
assert project is not None, 'Project must not be None'
assert queue is not None, 'Queue must not be None'

View File

@ -12,7 +12,9 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""partition: utilities for implementing partition selections."""
import random

View File

@ -12,7 +12,9 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""round_robin: Implements round-robin selection for partition hosts."""
import itertools

View File

@ -32,6 +32,7 @@ from marconi.queues import storage
from marconi.queues.storage import exceptions
from marconi.queues.storage.mongodb import utils
LOG = logging.getLogger(__name__)
STORAGE_LIMITS = cfg.CONF['queues:limits:storage']

View File

@ -26,6 +26,7 @@ from marconi.queues.storage.mongodb import claims
from marconi.queues.storage.mongodb import messages
from marconi.queues.storage.mongodb import queues
ClaimController = claims.ClaimController
MessageController = messages.MessageController
QueueController = queues.QueueController

View File

@ -24,6 +24,7 @@ from marconi.queues import storage
from marconi.queues.storage.mongodb import controllers
from marconi.queues.storage.mongodb import options
LOG = logging.getLogger(__name__)

View File

@ -35,6 +35,7 @@ from marconi.queues.storage import exceptions
from marconi.queues.storage.mongodb import options
from marconi.queues.storage.mongodb import utils
LOG = logging.getLogger(__name__)
STORAGE_LIMITS = cfg.CONF['queues:limits:storage']

View File

@ -30,6 +30,7 @@ from marconi.queues import storage
from marconi.queues.storage import exceptions
from marconi.queues.storage.mongodb import utils
LOG = logging.getLogger(__name__)
STORAGE_LIMITS = cfg.CONF['queues:limits:storage']

View File

@ -29,6 +29,7 @@ from marconi.openstack.common import timeutils
from marconi.queues.storage import exceptions as storage_exceptions
from marconi.queues.storage.mongodb import options
# BSON ObjectId gives TZ-aware datetime, so we generate a
# TZ-aware UNIX epoch for convenience.
EPOCH = datetime.datetime.utcfromtimestamp(0).replace(tzinfo=tz_util.utc)

View File

@ -19,6 +19,7 @@ from marconi.queues.storage import base
from marconi.queues.storage import exceptions
from marconi.queues.storage.sqlite import utils
STORAGE_LIMITS = cfg.CONF['queues:limits:storage']

View File

@ -20,6 +20,7 @@ from marconi.queues.storage.sqlite import claims
from marconi.queues.storage.sqlite import messages
from marconi.queues.storage.sqlite import queues
ClaimController = claims.ClaimController
MessageController = messages.MessageController
QueueController = queues.QueueController

View File

@ -24,6 +24,7 @@ from marconi.queues import storage
from marconi.queues.storage.sqlite import controllers
from marconi.queues.storage.sqlite import utils
_SQLITE_OPTIONS = [
cfg.StrOpt('database', default=':memory:',
help='Sqlite database to use.')

View File

@ -20,6 +20,7 @@ from marconi.queues.storage import base
from marconi.queues.storage import exceptions
from marconi.queues.storage.sqlite import utils
STORAGE_LIMITS = cfg.CONF['queues:limits:storage']

View File

@ -20,6 +20,7 @@ from marconi.queues.storage import base
from marconi.queues.storage import exceptions
from marconi.queues.storage.sqlite import utils
STORAGE_LIMITS = cfg.CONF['queues:limits:storage']

View File

@ -16,6 +16,7 @@
from marconi.queues.storage import exceptions
UNIX_EPOCH_AS_JULIAN_SEC = 2440587.5 * 86400.0

View File

@ -1,9 +1,11 @@
"""Marconi Transport Drivers"""
from oslo.config import cfg
from marconi.queues.transport import base
_TRANSPORT_OPTIONS = [
cfg.StrOpt('auth_strategy', default='')
]

View File

@ -19,6 +19,7 @@ from keystoneclient.middleware import auth_token
from marconi.openstack.common import log
STRATEGIES = {}
LOG = log.getLogger(__name__)

View File

@ -13,9 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from wsgiref import simple_server
import falcon
from oslo.config import cfg
from wsgiref import simple_server
from marconi.common.transport.wsgi import helpers
import marconi.openstack.common.log as logging

View File

@ -24,6 +24,7 @@ from marconi.queues.transport import validation as validate
from marconi.queues.transport.wsgi import exceptions as wsgi_exceptions
from marconi.queues.transport.wsgi import utils as wsgi_utils
LOG = logging.getLogger(__name__)
CFG = cfg.CONF['queues:drivers:transport:wsgi']

View File

@ -21,6 +21,7 @@ from marconi.queues.transport import utils
from marconi.queues.transport import validation as validate
from marconi.queues.transport.wsgi import exceptions as wsgi_exceptions
LOG = logging.getLogger(__name__)

View File

@ -20,6 +20,7 @@ from marconi.queues.storage import exceptions as storage_exceptions
from marconi.queues.transport import utils
from marconi.queues.transport.wsgi import exceptions as wsgi_exceptions
LOG = logging.getLogger(__name__)

View File

@ -17,7 +17,6 @@
import uuid
import marconi.openstack.common.log as logging
from marconi.queues.transport import utils
from marconi.queues.transport.wsgi import exceptions

View File

@ -16,6 +16,7 @@
import json
# NOTE(kgriffs): http://tools.ietf.org/html/draft-nottingham-json-home-03
JSON_HOME = {
'resources': {

View File

@ -18,6 +18,7 @@
from marconi.tests import base
from marconi.tests import helpers
SKIP_SLOW_TESTS = helpers.SKIP_SLOW_TESTS
RUN_SLOW_TESTS = not SKIP_SLOW_TESTS

View File

@ -13,11 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import fixtures
import os
import testtools
import fixtures
from oslo.config import cfg
import testtools
class TestBase(testtools.TestCase):

View File

@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from marconi.queues import storage

View File

@ -17,6 +17,7 @@ import os
from oslo.config import cfg
_DEFAULT = [
cfg.BoolOpt("run_tests", default=True),
]

View File

@ -13,14 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import testtools
import contextlib
import functools
import os
import uuid
import six
import testtools
SKIP_SLOW_TESTS = os.environ.get('MARCONI_TEST_SLOW') is None
SKIP_MONGODB_TESTS = os.environ.get('MARCONI_TEST_MONGODB') is None

View File

@ -16,6 +16,7 @@
import pbr.packaging
import pbr.version
version_info = pbr.version.VersionInfo('marconi')

View File

@ -15,6 +15,7 @@
import os
tests_dir = os.path.abspath(os.path.dirname(__file__))
os.environ.setdefault("MARCONI_TESTS_DIR", tests_dir)

View File

@ -13,9 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import ddt
import uuid
import ddt
from marconi.tests.functional import base
from marconi.tests.functional import helpers

View File

@ -12,9 +12,11 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import ddt
import uuid
import ddt
from marconi.tests.functional import base # noqa
from marconi.tests.functional import helpers

View File

@ -12,10 +12,12 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import copy
import uuid
import ddt
import six
import uuid
from marconi.tests.functional import base # noqa
from marconi.tests.functional import helpers

View File

@ -12,6 +12,7 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import uuid
import six

View File

@ -12,10 +12,10 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from marconi.proxy.storage import memory
from marconi.proxy.storage.memory import controllers
from marconi import tests as testing
from tests.unit.proxy.storage import base

View File

@ -12,11 +12,11 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from marconi.proxy.storage import mongodb
from marconi.proxy.storage.mongodb import controllers
from marconi.proxy.storage.mongodb import options
from marconi import tests as testing
from tests.unit.proxy.storage import base

View File

@ -13,6 +13,7 @@
#
# See the License for the specific language governing permissions and
# limitations under the License.
import json
import uuid

View File

@ -13,6 +13,7 @@
#
# See the License for the specific language governing permissions and
# limitations under the License.
import json
import uuid

View File

@ -12,6 +12,7 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Test Auth."""
from oslo.config import cfg

View File

@ -15,9 +15,9 @@
# limitations under the License.
import io
import json
import falcon
import json
import testtools
from marconi.queues.transport.wsgi import utils