Order imports in alphabetical order (9/9)

This patch fixes all the missed and newly introduced violations of the H306
style checking rule and enables it in tox.

Change-Id: I5566e66421d5397c0103958f02ea38e6e3c68892
Implements: blueprint reduce-flake8-ignored-rules (partial)
This commit is contained in:
Pavlo Shchelokovskyy 2014-04-04 16:44:30 +03:00
parent 61290febf7
commit 50ff4ec2fe
57 changed files with 104 additions and 140 deletions

View File

@ -30,18 +30,16 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')):
sys.path.insert(0, possible_topdir)
from heat.openstack.common import gettextutils
gettextutils.install('heat', lazy=False)
from oslo.config import cfg
from heat.common import config
from heat.common import wsgi
from heat.common import notify
from heat.common import wsgi
from heat.openstack.common import gettextutils
from heat.openstack.common import log as logging
gettextutils.install('heat', lazy=False)
LOG = logging.getLogger('heat.api')
if __name__ == '__main__':

View File

@ -32,18 +32,16 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')):
sys.path.insert(0, possible_topdir)
from heat.openstack.common import gettextutils
gettextutils.install('heat', lazy=False)
from oslo.config import cfg
from heat.common import config
from heat.common import wsgi
from heat.common import notify
from heat.common import wsgi
from heat.openstack.common import gettextutils
from heat.openstack.common import log as logging
gettextutils.install('heat', lazy=False)
LOG = logging.getLogger('heat.api.cfn')
if __name__ == '__main__':

View File

@ -32,18 +32,16 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')):
sys.path.insert(0, possible_topdir)
from heat.openstack.common import gettextutils
gettextutils.install('heat', lazy=False)
from oslo.config import cfg
from heat.common import config
from heat.common import wsgi
from heat.common import notify
from heat.common import wsgi
from heat.openstack.common import gettextutils
from heat.openstack.common import log as logging
gettextutils.install('heat', lazy=False)
LOG = logging.getLogger('heat.api.cloudwatch')
if __name__ == '__main__':

View File

@ -32,19 +32,16 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'heat', '__init__.py')):
sys.path.insert(0, POSSIBLE_TOPDIR)
from heat.openstack.common import gettextutils
gettextutils.install('heat', lazy=False)
from oslo.config import cfg
from heat.common import notify
from heat.openstack.common import gettextutils
from heat.openstack.common import log as logging
from heat.openstack.common import service
from heat.rpc import api as rpc_api
gettextutils.install('heat', lazy=False)
LOG = logging.getLogger('heat.engine')

View File

@ -24,10 +24,9 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'heat', '__init__.py')):
sys.path.insert(0, POSSIBLE_TOPDIR)
from heat.cmd import manage
from heat.openstack.common import gettextutils
gettextutils.install('heat')
from heat.cmd import manage
manage.main()

View File

@ -12,16 +12,16 @@
# under the License.
import mock
from heat.engine import parser
from heat.engine import template
from heat.engine import resource
from heat.tests.common import HeatTestCase
from heat.tests import utils
from novaclient.exceptions import NotFound
from ..resources.nova_flavor import resource_mapping # noqa
from heat.engine import parser
from heat.engine import resource
from heat.engine import template
from heat.tests.common import HeatTestCase
from heat.tests import utils
from ..resources.nova_flavor import NovaFlavor # noqa
from ..resources.nova_flavor import resource_mapping # noqa
flavor_template = {
'heat_template_version': '2013-05-23',

View File

@ -11,7 +11,19 @@
# License for the specific language governing permissions and limitations
# under the License.
"""Resources for Rackspace Cloud Loadbalancers."""
import copy
import itertools
from heat.common import exception
from heat.engine import attributes
from heat.engine import constraints
from heat.engine import function
from heat.engine import properties
from heat.engine.properties import Properties
from heat.engine import resource
from heat.engine import scheduler
from heat.openstack.common.gettextutils import _
from heat.openstack.common import log as logging
try:
from pyrax.exceptions import NotFound
@ -23,20 +35,6 @@ except ImportError:
PYRAX_INSTALLED = False
import copy
import itertools
from heat.openstack.common import log as logging
from heat.openstack.common.gettextutils import _
from heat.engine import attributes
from heat.engine import function
from heat.engine import scheduler
from heat.engine import constraints
from heat.engine import properties
from heat.engine import resource
from heat.engine.properties import Properties
from heat.common import exception
logger = logging.getLogger(__name__)

View File

@ -14,17 +14,18 @@
import itertools
from docutils import nodes
import pydoc
from sphinx.util.compat import Directive
from heat.engine import attributes
from heat.engine import environment
from heat.engine import plugin_manager
from heat.engine import resources
from heat.engine import properties
from heat.engine import attributes
from heat.engine import resources
from heat.engine import support
from heat.openstack.common.gettextutils import _
from docutils import nodes
from sphinx.util.compat import Directive
import pydoc
global_env = environment.Environment({}, user_env=False)

View File

@ -25,13 +25,14 @@ import traceback
from oslo.config import cfg
import webob
cfg.CONF.import_opt('debug', 'heat.openstack.common.log')
from heat.common import serializers
from heat.common import exception
import heat.openstack.common.rpc.common as rpc_common
from heat.common import serializers
from heat.common import wsgi
from heat.openstack.common.rpc import common as rpc_common
cfg.CONF.import_opt('debug', 'heat.openstack.common.log')
class Fault(object):

View File

@ -22,7 +22,6 @@ from eventlet.green import socket
from oslo.config import cfg
from heat.common import wsgi
from heat.openstack.common import log as logging
from heat.openstack.common import rpc

View File

@ -12,6 +12,7 @@
# under the License.
import base64
from Crypto.Cipher import AES
from oslo.config import cfg

View File

@ -20,11 +20,11 @@ Middleware for authenticating against custom backends.
import logging
import webob.exc
from heat.openstack.common.gettextutils import _
from heat.openstack.common import local
from heat.rpc import client as rpc_client
import webob.exc
LOG = logging.getLogger(__name__)

View File

@ -20,7 +20,6 @@
from oslo.config import cfg
from heat.common import exception
from heat.openstack.common import policy

View File

@ -12,11 +12,12 @@
import copy
import time
from migrate.versioning import util as migrate_util
from sqlalchemy.orm import sessionmaker
from heat.openstack.common.gettextutils import _
from heat.db.sqlalchemy import models
from heat.openstack.common.gettextutils import _
def upgrade(migrate_engine):

View File

@ -17,11 +17,10 @@ import re
import six
from heat.common import exception
from heat.engine import clients
from heat.engine import resources
from heat.common import exception
class InvalidSchemaError(exception.Error):
pass

View File

@ -12,8 +12,8 @@
# under the License.
from heat.common import exception
from heat.engine.resources import nova_utils
from heat.engine import constraints
from heat.engine.resources import nova_utils
class ImageConstraint(constraints.BaseCustomConstraint):

View File

@ -16,8 +16,6 @@ import copy
from oslo.config import cfg
import six
cfg.CONF.import_opt('instance_user', 'heat.common.config')
from heat.common import exception
from heat.engine import attributes
from heat.engine import clients
@ -33,6 +31,8 @@ from heat.engine import signal_responder
from heat.openstack.common.gettextutils import _
from heat.openstack.common import log as logging
cfg.CONF.import_opt('instance_user', 'heat.common.config')
logger = logging.getLogger(__name__)

View File

@ -12,9 +12,9 @@
# under the License.
import copy
import uuid
from oslo.config import cfg
import uuid
from heat.common import exception
from heat.engine import attributes

View File

@ -14,8 +14,8 @@
import functools
import json
import six
from oslo.config import cfg
import six
import webob
from heat.common import context

View File

@ -17,9 +17,8 @@
Client side of the heat engine RPC API.
"""
from heat.rpc import api
import heat.openstack.common.rpc.proxy
from heat.rpc import api
class EngineClient(heat.openstack.common.rpc.proxy.RpcProxy):

View File

@ -28,9 +28,8 @@ import tempfile
import uuid
from migrate.versioning import repository
import sqlalchemy
from six.moves.urllib import parse as urlparse
import sqlalchemy
from heat.db.sqlalchemy import migrate_repo
from heat.db.sqlalchemy import migration

View File

@ -11,8 +11,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from heat.common import context
"""
A fake server that "responds" to API methods with pre-canned responses.
@ -21,6 +19,8 @@ wrong the tests might raise AssertionError. I've indicated in comments the
places where actual behavior differs from the spec.
"""
from heat.common import context
class FakeClient(object):

View File

@ -12,7 +12,6 @@
# under the License.
import mock
from webob import exc
from heat.api.openstack.v1 import util

View File

@ -12,7 +12,6 @@
# under the License.
import mock
from six.moves.urllib import parse as urlparse
from heat.api.openstack.v1.views import views_common

View File

@ -13,11 +13,12 @@
import mock
from heat.engine import clients
from heat.tests.common import HeatTestCase
from heatclient import client as heatclient
from keystoneclient import exceptions as keystone_exceptions
from heat.engine import clients
from heat.tests.common import HeatTestCase
class ClientsTest(HeatTestCase):

View File

@ -14,10 +14,8 @@
import mock
from heat.engine import parser
from heat.engine.resources.software_config import cloud_config as cc
from heat.engine import template
import heat.engine.resources.software_config.cloud_config as cc
from heat.tests.common import HeatTestCase
from heat.tests import utils

View File

@ -15,6 +15,7 @@
# under the License.
import datetime
import webob
from heat.common import serializers

View File

@ -27,7 +27,7 @@ from heat.common import exception
from heat.common import identifier
from heat.common import template_format
from heat.common import urlfetch
import heat.db.api as db_api
from heat.db import api as db_api
from heat.engine import clients
from heat.engine import dependencies
from heat.engine import environment
@ -42,7 +42,7 @@ from heat.engine import watchrule
from heat.openstack.common.rpc import common as rpc_common
from heat.openstack.common.rpc import proxy
from heat.openstack.common import threadgroup
import heat.rpc.api as engine_api
from heat.rpc import api as engine_api
from heat.tests.common import HeatTestCase
from heat.tests import fakes as test_fakes
from heat.tests import generic_resource as generic_rsrc

View File

@ -11,14 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
import six
import heat.api.middleware.fault as fault
from heat.common import exception as heat_exc
from heat.openstack.common.rpc import common as rpc_common
from heat.tests.common import HeatTestCase
from oslo.config import cfg
import heat.api.middleware.fault as fault
class StackNotFoundChild(heat_exc.StackNotFound):

View File

@ -13,9 +13,8 @@
import copy
from heat.tests.common import HeatTestCase
from heat.engine import function
from heat.tests.common import HeatTestCase
class TestFunction(function.Function):

View File

@ -14,20 +14,19 @@
import json
import uuid
from oslo.config import cfg
cfg.CONF.import_opt('region_name_for_services', 'heat.common.config')
cfg.CONF.import_group('keystone_authtoken',
'keystoneclient.middleware.auth_token')
import keystoneclient.exceptions as kc_exception
from keystoneclient.v3 import client as kc_v3
from oslo.config import cfg
from heat.common import exception
from heat.common import heat_keystoneclient
from heat.tests.common import HeatTestCase
from heat.tests import utils
cfg.CONF.import_opt('region_name_for_services', 'heat.common.config')
cfg.CONF.import_group('keystone_authtoken',
'keystoneclient.middleware.auth_token')
class KeystoneClientTest(HeatTestCase):
"""Test cases for heat.common.heat_keystoneclient."""

View File

@ -16,7 +16,6 @@ from heat.common import exception
from heat.engine import clients
from heat.engine.resources import image
from heat.engine.resources import nova_utils
from heat.tests.common import HeatTestCase

View File

@ -12,16 +12,15 @@
# under the License.
import email
import heatclient.exc as exc
import mock
from heat.engine import parser
from heat.engine.resources.software_config import multi_part as mp
from heat.engine import template
import heat.engine.resources.software_config.multi_part as mp
from heat.tests.common import HeatTestCase
from heat.tests import utils
import heatclient.exc as exc
class MultipartMimeTest(HeatTestCase):

View File

@ -14,12 +14,10 @@
import copy
import json
import mock
from requests import exceptions
from oslo.config import cfg
cfg.CONF.import_opt('max_resources_per_stack', 'heat.common.config')
from requests import exceptions
from heat.common import exception
from heat.common import template_format
@ -32,6 +30,8 @@ from heat.tests.common import HeatTestCase
from heat.tests import generic_resource as generic_rsrc
from heat.tests import utils
cfg.CONF.import_opt('max_resources_per_stack', 'heat.common.config')
class NestedStackTest(HeatTestCase):
test_template = '''

View File

@ -14,8 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from mox import IgnoreArg
import mox
from mox import IgnoreArg
from testtools import skipIf
from heat.common import exception

View File

@ -19,8 +19,8 @@ from testtools import skipIf
from heat.common import exception
from heat.common import template_format
from heat.engine import clients
from heat.engine.resources.neutron import vpnservice
from heat.engine.resources.neutron import neutron_utils
from heat.engine.resources.neutron import vpnservice
from heat.engine import scheduler
from heat.openstack.common.importutils import try_import
from heat.tests.common import HeatTestCase

View File

@ -14,7 +14,6 @@
import mock
from oslo.config import cfg
from heat.common import exception
from heat.common import template_format
from heat.engine import environment

View File

@ -12,9 +12,9 @@
# under the License.
"""Tests for :module:'heat.engine.resources.nova_utls'."""
import mock
import uuid
import mock
from novaclient import exceptions as nova_exceptions
from heat.common import exception

View File

@ -15,9 +15,8 @@
import sys
import types
from heat.tests.common import HeatTestCase
from heat.engine import plugin_manager
from heat.tests.common import HeatTestCase
def legacy_test_mapping():

View File

@ -19,14 +19,12 @@ import yaml
from heat.common import exception
from heat.common import template_format
from heat.common import urlfetch
from heat.engine import environment
from heat.engine import parser
from heat.engine import properties
from heat.engine import resource
from heat.engine import resources
from heat.engine.resources import template_resource
from heat.tests.common import HeatTestCase
from heat.tests import generic_resource as generic_rsrc
from heat.tests import utils

View File

@ -18,7 +18,6 @@ from heat.common import exception
from heat.common import template_format
from heat.engine import parser
from heat.engine.resources.random_string import RandomString
from heat.tests.common import HeatTestCase
from heat.tests import utils

View File

@ -18,7 +18,7 @@ import uuid
import mock
from heat.common import exception
import heat.db.api as db_api
from heat.db import api as db_api
from heat.engine import dependencies
from heat.engine import environment
from heat.engine import parser
@ -26,7 +26,6 @@ from heat.engine import resource
from heat.engine import scheduler
from heat.engine import template
from heat.openstack.common.gettextutils import _
from heat.tests.common import HeatTestCase
from heat.tests import generic_resource as generic_rsrc
from heat.tests import utils

View File

@ -16,7 +16,6 @@ import mock
from heat.common import template_format
from heat.engine.resources import instance
from heat.engine import scheduler
from heat.tests import common
from heat.tests import utils

View File

@ -11,14 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
import mox
import contextlib
import eventlet
import mox
from heat.engine import dependencies
from heat.engine import scheduler
from heat.tests.common import HeatTestCase

View File

@ -11,11 +11,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import uuid
import testtools
from heat.common import short_id
import uuid
class ShortIdTest(testtools.TestCase):

View File

@ -18,15 +18,12 @@ from oslo.config import cfg
from heat.common import exception
from heat.common import template_format
from heat.db import api as db_api
from heat.engine import clients
from heat.engine import parser
from heat.engine import resource
from heat.engine import scheduler
from heat.engine import stack_user
from heat.tests.common import HeatTestCase
from heat.tests import fakes
from heat.tests import generic_resource

View File

@ -11,15 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from heatclient.exc import HTTPNotFound
import mock
from heat.common import exception
from heat.engine import parser
from heat.engine.resources.software_config import software_config as sc
from heat.engine import template
import heat.engine.resources.software_config.software_config as sc
from heatclient.exc import HTTPNotFound
from heat.tests.common import HeatTestCase
from heat.tests import utils

View File

@ -13,11 +13,11 @@
from datetime import datetime
from datetime import timedelta
from json import dumps
from json import loads
import uuid
import fixtures
from json import dumps
from json import loads
import mock
import mox

View File

@ -11,11 +11,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo.config import cfg
import webob
from heat.api.middleware import ssl
from oslo.config import cfg
from heat.tests.common import HeatTestCase

View File

@ -12,7 +12,6 @@
# under the License.
from heat.engine import support
from heat.tests.common import HeatTestCase

View File

@ -14,9 +14,9 @@
import os
import mock
import six
import testtools
import yaml
import six
from heat.common import config
from heat.common import exception

View File

@ -13,9 +13,8 @@
import webob
from heat.tests.common import HeatTestCase
from heat.api.middleware.version_negotiation import VersionNegotiationFilter
from heat.tests.common import HeatTestCase
class VersionController(object):

View File

@ -21,7 +21,7 @@ from oslo.config import cfg
from heat.common import identifier
from heat.common import template_format
import heat.db.api as db_api
from heat.db import api as db_api
from heat.engine import environment
from heat.engine import parser
from heat.engine import resource

View File

@ -17,7 +17,7 @@ import datetime
import mox
from heat.common import exception
import heat.db.api as db_api
from heat.db import api as db_api
from heat.engine import parser
from heat.engine import watchrule
from heat.openstack.common import timeutils

View File

@ -16,6 +16,7 @@
import json
from oslo.config import cfg
import stubout
import webob

View File

@ -16,11 +16,10 @@
import httplib2
from six.moves.urllib import parse as urlparse
from novaclient import client as base_client
from novaclient import exceptions as nova_exceptions
from novaclient.v1_1 import client
from six.moves.urllib import parse as urlparse
from heat.tests import fakes

View File

@ -40,9 +40,9 @@ commands = python setup.py build_sphinx
[flake8]
# H201 no 'except:' at least use 'except Exception:'
# H302 import only modules.'bla..' does not import a module
# H306 imports not in alphabetical order
# H404 multi line docstring should start with a summary
ignore = H201,H302,H306,H404,H803
# H803 no full stop at the end of the commit message
ignore = H201,H302,H404,H803
show-source = true
builtins = _
exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,tools,build