From 5be43b045ac601f449e7c8030a9d707613971282 Mon Sep 17 00:00:00 2001 From: Pavlo Shchelokovskyy Date: Thu, 6 Feb 2014 14:09:11 +0200 Subject: [PATCH] Order imports in alphabetical order (4/9) This patch is one in a series to re-enable H306 style check rule (imports are in alphabetical order). It touches db files. Implements: blueprint reduce-flake8-ignored-rules (partial) Change-Id: I66842c6a5d112f948e625e18ef6d01afcad61e57 --- heat/db/sqlalchemy/api.py | 8 +++----- .../migrate_repo/versions/029_event_id_to_uuid.py | 2 +- .../migrate_repo/versions/030_remove_uuidutils.py | 3 ++- .../migrate_repo/versions/034_raw_template_files.py | 1 + .../migrate_repo/versions/035_event_uuid_to_id.py | 5 +++-- .../migrate_repo/versions/037_migrate_hot_template.py | 3 ++- .../versions/038_software_config_json_config.py | 6 +++--- .../versions/041_migrate_hot_template_resources.py | 3 ++- heat/db/sqlalchemy/models.py | 11 ++++++----- heat/db/sqlalchemy/types.py | 3 ++- heat/db/sync.py | 8 ++++---- 11 files changed, 29 insertions(+), 24 deletions(-) diff --git a/heat/db/sqlalchemy/api.py b/heat/db/sqlalchemy/api.py index 5604e5cb9..2688ddac5 100644 --- a/heat/db/sqlalchemy/api.py +++ b/heat/db/sqlalchemy/api.py @@ -13,18 +13,14 @@ # under the License. '''Implementation of SQLAlchemy backend.''' -import sys from datetime import datetime from datetime import timedelta +import sys from oslo.config import cfg import sqlalchemy from sqlalchemy.orm.session import Session -cfg.CONF.import_opt('max_events_per_stack', 'heat.common.config') - -from heat.openstack.common.gettextutils import _ - from heat.common import crypt from heat.common import exception from heat.db.sqlalchemy import filters as db_filters @@ -32,7 +28,9 @@ from heat.db.sqlalchemy import migration from heat.db.sqlalchemy import models from heat.openstack.common.db.sqlalchemy import session as db_session from heat.openstack.common.db.sqlalchemy import utils +from heat.openstack.common.gettextutils import _ +cfg.CONF.import_opt('max_events_per_stack', 'heat.common.config') get_engine = db_session.get_engine get_session = db_session.get_session diff --git a/heat/db/sqlalchemy/migrate_repo/versions/029_event_id_to_uuid.py b/heat/db/sqlalchemy/migrate_repo/versions/029_event_id_to_uuid.py index 7f070e199..eb8a0ce18 100644 --- a/heat/db/sqlalchemy/migrate_repo/versions/029_event_id_to_uuid.py +++ b/heat/db/sqlalchemy/migrate_repo/versions/029_event_id_to_uuid.py @@ -13,9 +13,9 @@ import uuid +from migrate.versioning import util as migrate_util import sqlalchemy -from migrate.versioning import util as migrate_util from heat.openstack.common.gettextutils import _ diff --git a/heat/db/sqlalchemy/migrate_repo/versions/030_remove_uuidutils.py b/heat/db/sqlalchemy/migrate_repo/versions/030_remove_uuidutils.py index 76edd68f6..33c2ac2b1 100644 --- a/heat/db/sqlalchemy/migrate_repo/versions/030_remove_uuidutils.py +++ b/heat/db/sqlalchemy/migrate_repo/versions/030_remove_uuidutils.py @@ -10,9 +10,10 @@ # License for the specific language governing permissions and limitations # under the License. -import sqlalchemy import uuid +import sqlalchemy + def upgrade(migrate_engine): meta = sqlalchemy.MetaData(bind=migrate_engine) diff --git a/heat/db/sqlalchemy/migrate_repo/versions/034_raw_template_files.py b/heat/db/sqlalchemy/migrate_repo/versions/034_raw_template_files.py index 27901921a..6a0ca60d7 100644 --- a/heat/db/sqlalchemy/migrate_repo/versions/034_raw_template_files.py +++ b/heat/db/sqlalchemy/migrate_repo/versions/034_raw_template_files.py @@ -12,6 +12,7 @@ # under the License. import sqlalchemy + from heat.db.sqlalchemy.types import Json diff --git a/heat/db/sqlalchemy/migrate_repo/versions/035_event_uuid_to_id.py b/heat/db/sqlalchemy/migrate_repo/versions/035_event_uuid_to_id.py index e468f767c..24a1613f1 100644 --- a/heat/db/sqlalchemy/migrate_repo/versions/035_event_uuid_to_id.py +++ b/heat/db/sqlalchemy/migrate_repo/versions/035_event_uuid_to_id.py @@ -11,11 +11,12 @@ # License for the specific language governing permissions and limitations # under the License. -import uuid import itertools -import sqlalchemy +import uuid import migrate.changeset.constraint as constraint +import sqlalchemy + from heat.openstack.common import timeutils diff --git a/heat/db/sqlalchemy/migrate_repo/versions/037_migrate_hot_template.py b/heat/db/sqlalchemy/migrate_repo/versions/037_migrate_hot_template.py index d84805062..c233139e1 100644 --- a/heat/db/sqlalchemy/migrate_repo/versions/037_migrate_hot_template.py +++ b/heat/db/sqlalchemy/migrate_repo/versions/037_migrate_hot_template.py @@ -11,12 +11,13 @@ # under the License. import copy + 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.engine.hot.parameters import HOTParamSchema +from heat.openstack.common.gettextutils import _ def upgrade(migrate_engine): diff --git a/heat/db/sqlalchemy/migrate_repo/versions/038_software_config_json_config.py b/heat/db/sqlalchemy/migrate_repo/versions/038_software_config_json_config.py index e0c376156..0fc532e4d 100644 --- a/heat/db/sqlalchemy/migrate_repo/versions/038_software_config_json_config.py +++ b/heat/db/sqlalchemy/migrate_repo/versions/038_software_config_json_config.py @@ -11,11 +11,11 @@ # License for the specific language governing permissions and limitations # under the License. -from heat.db.sqlalchemy.types import LongText -from heat.db.sqlalchemy.types import Json - import sqlalchemy +from heat.db.sqlalchemy.types import Json +from heat.db.sqlalchemy.types import LongText + def upgrade(migrate_engine): meta = sqlalchemy.MetaData(bind=migrate_engine) diff --git a/heat/db/sqlalchemy/migrate_repo/versions/041_migrate_hot_template_resources.py b/heat/db/sqlalchemy/migrate_repo/versions/041_migrate_hot_template_resources.py index 0bc31e882..50f3d65e9 100644 --- a/heat/db/sqlalchemy/migrate_repo/versions/041_migrate_hot_template_resources.py +++ b/heat/db/sqlalchemy/migrate_repo/versions/041_migrate_hot_template_resources.py @@ -11,11 +11,12 @@ # under the License. import copy + 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): diff --git a/heat/db/sqlalchemy/models.py b/heat/db/sqlalchemy/models.py index 091923fc9..ce34191de 100644 --- a/heat/db/sqlalchemy/models.py +++ b/heat/db/sqlalchemy/models.py @@ -17,14 +17,15 @@ SQLAlchemy models for heat data. import uuid import sqlalchemy - -from sqlalchemy.orm import relationship, backref from sqlalchemy.ext.declarative import declarative_base -from heat.openstack.common import timeutils +from sqlalchemy.orm import backref +from sqlalchemy.orm import relationship +from sqlalchemy.orm.session import Session + +from heat.db.sqlalchemy.types import Json from heat.openstack.common.db.sqlalchemy import models from heat.openstack.common.db.sqlalchemy import session -from sqlalchemy.orm.session import Session -from heat.db.sqlalchemy.types import Json +from heat.openstack.common import timeutils BASE = declarative_base() get_session = session.get_session diff --git a/heat/db/sqlalchemy/types.py b/heat/db/sqlalchemy/types.py index 86a8cebc7..62d9da40a 100644 --- a/heat/db/sqlalchemy/types.py +++ b/heat/db/sqlalchemy/types.py @@ -13,8 +13,9 @@ from json import dumps from json import loads -from sqlalchemy import types + from sqlalchemy.dialects import mysql +from sqlalchemy import types class LongText(types.TypeDecorator): diff --git a/heat/db/sync.py b/heat/db/sync.py index 6d4013b6e..3b19a63ed 100755 --- a/heat/db/sync.py +++ b/heat/db/sync.py @@ -17,14 +17,14 @@ from __future__ import print_function import sys +from oslo.config import cfg + +from heat.db import migration from heat.openstack.common import gettextutils +from heat.openstack.common import log as logging gettextutils.install('heat') -from oslo.config import cfg -from heat.openstack.common import log as logging -from heat.db import migration - LOG = logging.getLogger(__name__)