From 5dbbc102ebbeb4f6a007ac7dfc119cd7c4d436b8 Mon Sep 17 00:00:00 2001 From: shizhihui Date: Thu, 28 Jul 2016 12:25:39 +0800 Subject: [PATCH] Standardize import format According to the rule in http://docs.openstack.org/developer/hacking/#imports I modify some irregular import format in heatclinet. Change-Id: I0200ddad88ee833d7de9d6df2c1519e4f4560db7 --- heatclient/common/deployment_utils.py | 3 ++- heatclient/common/environment_format.py | 4 ++-- heatclient/common/event_utils.py | 1 - heatclient/common/format_utils.py | 3 ++- heatclient/common/hook_utils.py | 1 - heatclient/osc/v1/build_info.py | 2 +- heatclient/osc/v1/resource.py | 4 ++-- heatclient/osc/v1/resource_type.py | 7 +++--- heatclient/osc/v1/snapshot.py | 2 +- heatclient/osc/v1/software_config.py | 7 +++--- heatclient/osc/v1/software_deployment.py | 2 +- heatclient/osc/v1/template.py | 3 +-- heatclient/tests/functional/osc/v1/base.py | 2 +- .../tests/functional/osc/v1/test_stack.py | 2 +- heatclient/tests/unit/osc/v1/test_event.py | 1 + heatclient/tests/unit/osc/v1/test_resource.py | 2 +- .../tests/unit/osc/v1/test_software_config.py | 3 +-- .../unit/osc/v1/test_software_deployment.py | 2 +- heatclient/tests/unit/osc/v1/test_stack.py | 6 ++--- heatclient/tests/unit/test_actions.py | 4 ++-- heatclient/tests/unit/test_build_info.py | 1 + heatclient/tests/unit/test_common_http.py | 2 +- .../tests/unit/test_deployment_utils.py | 2 +- .../tests/unit/test_environment_format.py | 3 +-- heatclient/tests/unit/test_events.py | 6 ++--- .../tests/unit/test_resource_formatter.py | 1 + heatclient/tests/unit/test_resource_types.py | 1 + heatclient/tests/unit/test_resources.py | 8 +++---- heatclient/tests/unit/test_service.py | 3 +-- heatclient/tests/unit/test_shell.py | 23 +++++++++---------- heatclient/tests/unit/test_stacks.py | 3 ++- heatclient/tests/unit/test_template_utils.py | 3 ++- heatclient/tests/unit/test_utils.py | 9 +++++--- heatclient/tests/unit/v1/test_hooks.py | 3 +-- heatclient/v1/resource_types.py | 6 ++--- heatclient/v1/resources.py | 2 +- heatclient/v1/shell.py | 6 ++--- heatclient/v1/stacks.py | 2 +- 38 files changed, 72 insertions(+), 73 deletions(-) diff --git a/heatclient/common/deployment_utils.py b/heatclient/common/deployment_utils.py index e6d68f89..adb17690 100644 --- a/heatclient/common/deployment_utils.py +++ b/heatclient/common/deployment_utils.py @@ -11,11 +11,12 @@ # under the License. import copy +import uuid + import six from six.moves.urllib import parse as urlparse from swiftclient import client as sc from swiftclient import utils as swiftclient_utils -import uuid from heatclient import exc from heatclient.openstack.common._i18n import _ diff --git a/heatclient/common/environment_format.py b/heatclient/common/environment_format.py index 179a2055..6870b79c 100644 --- a/heatclient/common/environment_format.py +++ b/heatclient/common/environment_format.py @@ -10,11 +10,11 @@ # License for the specific language governing permissions and limitations # under the License. +import yaml + from heatclient.common import template_format from heatclient.openstack.common._i18n import _ -import yaml - SECTIONS = ( PARAMETER_DEFAULTS, PARAMETERS, RESOURCE_REGISTRY, EVENT_SINKS diff --git a/heatclient/common/event_utils.py b/heatclient/common/event_utils.py index d490ecf8..18a0b98b 100644 --- a/heatclient/common/event_utils.py +++ b/heatclient/common/event_utils.py @@ -17,7 +17,6 @@ import time from heatclient.common import utils import heatclient.exc as exc - from heatclient.openstack.common._i18n import _ diff --git a/heatclient/common/format_utils.py b/heatclient/common/format_utils.py index 0202b6cc..d1a92065 100644 --- a/heatclient/common/format_utils.py +++ b/heatclient/common/format_utils.py @@ -12,9 +12,10 @@ # # Copyright 2015 IBM Corp. +import sys + from osc_lib.command import command import six -import sys class RawFormat(command.ShowOne): diff --git a/heatclient/common/hook_utils.py b/heatclient/common/hook_utils.py index e8d4850d..39fedb5b 100644 --- a/heatclient/common/hook_utils.py +++ b/heatclient/common/hook_utils.py @@ -15,7 +15,6 @@ import logging from oslo_utils import fnmatch import heatclient.exc as exc - from heatclient.openstack.common._i18n import _ from heatclient.openstack.common._i18n import _LE diff --git a/heatclient/osc/v1/build_info.py b/heatclient/osc/v1/build_info.py index 1bedd87c..9f90dd5b 100644 --- a/heatclient/osc/v1/build_info.py +++ b/heatclient/osc/v1/build_info.py @@ -14,10 +14,10 @@ """Orchestration v1 build info action implementations""" import logging -import six from osc_lib.command import command from osc_lib import utils +import six from heatclient.common import utils as heat_utils diff --git a/heatclient/osc/v1/resource.py b/heatclient/osc/v1/resource.py index a3d998d4..b7feb84c 100644 --- a/heatclient/osc/v1/resource.py +++ b/heatclient/osc/v1/resource.py @@ -14,14 +14,14 @@ """Orchestration v1 Stack action implementations""" import logging -import six -from six.moves.urllib import request from osc_lib.command import command from osc_lib import exceptions as exc from osc_lib.i18n import _ from osc_lib import utils from oslo_serialization import jsonutils +import six +from six.moves.urllib import request from heatclient.common import format_utils from heatclient.common import utils as heat_utils diff --git a/heatclient/osc/v1/resource_type.py b/heatclient/osc/v1/resource_type.py index 525a6ff3..6d55ab5a 100644 --- a/heatclient/osc/v1/resource_type.py +++ b/heatclient/osc/v1/resource_type.py @@ -14,14 +14,15 @@ """Orchestration v1 resource type implementations""" import logging + +from osc_lib.command import command +from osc_lib import exceptions as exc +from osc_lib.i18n import _ import six from heatclient.common import format_utils from heatclient.common import utils as heat_utils from heatclient import exc as heat_exc -from osc_lib.command import command -from osc_lib import exceptions as exc -from osc_lib.i18n import _ class ResourceTypeShow(format_utils.YamlFormat): diff --git a/heatclient/osc/v1/snapshot.py b/heatclient/osc/v1/snapshot.py index 82c88549..b5cc781d 100644 --- a/heatclient/osc/v1/snapshot.py +++ b/heatclient/osc/v1/snapshot.py @@ -14,12 +14,12 @@ """Orchestration v1 Stack Snapshot implementations.""" import logging -import six from osc_lib.command import command from osc_lib import exceptions as exc from osc_lib.i18n import _ from osc_lib import utils +import six from heatclient.common import format_utils from heatclient import exc as heat_exc diff --git a/heatclient/osc/v1/software_config.py b/heatclient/osc/v1/software_config.py index 555da23c..7adccc84 100644 --- a/heatclient/osc/v1/software_config.py +++ b/heatclient/osc/v1/software_config.py @@ -14,14 +14,13 @@ """Orchestration v1 software config action implementations""" import logging -import six - -from six.moves.urllib import request -import yaml from osc_lib.command import command from osc_lib import exceptions as exc from osc_lib import utils +import six +from six.moves.urllib import request +import yaml from heatclient.common import format_utils from heatclient.common import template_format diff --git a/heatclient/osc/v1/software_deployment.py b/heatclient/osc/v1/software_deployment.py index b9e67962..90c0cebe 100644 --- a/heatclient/osc/v1/software_deployment.py +++ b/heatclient/osc/v1/software_deployment.py @@ -14,11 +14,11 @@ """Orchestration v1 Software Deployment action implementations""" import logging -from oslo_serialization import jsonutils from osc_lib.command import command from osc_lib import exceptions as exc from osc_lib import utils +from oslo_serialization import jsonutils from heatclient.common import deployment_utils from heatclient.common import format_utils diff --git a/heatclient/osc/v1/template.py b/heatclient/osc/v1/template.py index 0889a38b..1b089dd7 100644 --- a/heatclient/osc/v1/template.py +++ b/heatclient/osc/v1/template.py @@ -13,11 +13,10 @@ # Copyright 2015 IBM Corp. import logging -import six - from osc_lib.command import command from osc_lib import utils +import six from heatclient.common import format_utils from heatclient.common import http diff --git a/heatclient/tests/functional/osc/v1/base.py b/heatclient/tests/functional/osc/v1/base.py index aadf4199..31a9cd7f 100644 --- a/heatclient/tests/functional/osc/v1/base.py +++ b/heatclient/tests/functional/osc/v1/base.py @@ -11,8 +11,8 @@ # under the License. import os -import six +import six from tempest.lib.cli import base from tempest.lib.cli import output_parser diff --git a/heatclient/tests/functional/osc/v1/test_stack.py b/heatclient/tests/functional/osc/v1/test_stack.py index a502e839..8f7ecc82 100644 --- a/heatclient/tests/functional/osc/v1/test_stack.py +++ b/heatclient/tests/functional/osc/v1/test_stack.py @@ -10,9 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. +from tempest.lib.common.utils import data_utils as utils from heatclient.tests.functional.osc.v1 import base -from tempest.lib.common.utils import data_utils as utils class OpenStackClientStackTest(base.OpenStackClientTestBase): diff --git a/heatclient/tests/unit/osc/v1/test_event.py b/heatclient/tests/unit/osc/v1/test_event.py index 746c5c7e..6c7b4ed9 100644 --- a/heatclient/tests/unit/osc/v1/test_event.py +++ b/heatclient/tests/unit/osc/v1/test_event.py @@ -13,6 +13,7 @@ # Copyright 2015 IBM Corp. import copy + import mock import testscenarios diff --git a/heatclient/tests/unit/osc/v1/test_resource.py b/heatclient/tests/unit/osc/v1/test_resource.py index 4fc29abf..817638c8 100644 --- a/heatclient/tests/unit/osc/v1/test_resource.py +++ b/heatclient/tests/unit/osc/v1/test_resource.py @@ -12,8 +12,8 @@ # import copy -import mock +import mock from osc_lib import exceptions as exc from heatclient import exc as heat_exc diff --git a/heatclient/tests/unit/osc/v1/test_software_config.py b/heatclient/tests/unit/osc/v1/test_software_config.py index 4bdf0bd2..685a0a98 100644 --- a/heatclient/tests/unit/osc/v1/test_software_config.py +++ b/heatclient/tests/unit/osc/v1/test_software_config.py @@ -12,9 +12,8 @@ # import mock -import yaml - from osc_lib import exceptions as exc +import yaml from heatclient import exc as heat_exc from heatclient.osc.v1 import software_config diff --git a/heatclient/tests/unit/osc/v1/test_software_deployment.py b/heatclient/tests/unit/osc/v1/test_software_deployment.py index 76bc3cfb..96ec84cd 100644 --- a/heatclient/tests/unit/osc/v1/test_software_deployment.py +++ b/heatclient/tests/unit/osc/v1/test_software_deployment.py @@ -12,8 +12,8 @@ # import copy -import mock +import mock from osc_lib import exceptions as exc from heatclient import exc as heat_exc diff --git a/heatclient/tests/unit/osc/v1/test_stack.py b/heatclient/tests/unit/osc/v1/test_stack.py index c357d585..d2ee28c0 100644 --- a/heatclient/tests/unit/osc/v1/test_stack.py +++ b/heatclient/tests/unit/osc/v1/test_stack.py @@ -13,14 +13,14 @@ import copy import io + import mock +from osc_lib import exceptions as exc +from osc_lib import utils import six import testscenarios import yaml -from osc_lib import exceptions as exc -from osc_lib import utils - from heatclient.common import template_format from heatclient import exc as heat_exc from heatclient.osc.v1 import stack diff --git a/heatclient/tests/unit/test_actions.py b/heatclient/tests/unit/test_actions.py index 1fcfe8a7..93b6e491 100644 --- a/heatclient/tests/unit/test_actions.py +++ b/heatclient/tests/unit/test_actions.py @@ -11,11 +11,11 @@ # See the License for the specific language governing permissions and # limitations under the License. +import testtools + from heatclient.tests.unit import fakes from heatclient.v1 import actions -import testtools - class ActionManagerTest(testtools.TestCase): diff --git a/heatclient/tests/unit/test_build_info.py b/heatclient/tests/unit/test_build_info.py index 9ee93da1..bc08f3bb 100644 --- a/heatclient/tests/unit/test_build_info.py +++ b/heatclient/tests/unit/test_build_info.py @@ -12,6 +12,7 @@ # 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 mock from oslo_serialization import jsonutils import testtools diff --git a/heatclient/tests/unit/test_common_http.py b/heatclient/tests/unit/test_common_http.py index 49a918dd..36365857 100644 --- a/heatclient/tests/unit/test_common_http.py +++ b/heatclient/tests/unit/test_common_http.py @@ -13,11 +13,11 @@ # limitations under the License. import logging -import mock import os import socket from keystoneauth1 import adapter +import mock from mox3 import mox from oslo_serialization import jsonutils import requests diff --git a/heatclient/tests/unit/test_deployment_utils.py b/heatclient/tests/unit/test_deployment_utils.py index 5754b170..2f9c6379 100644 --- a/heatclient/tests/unit/test_deployment_utils.py +++ b/heatclient/tests/unit/test_deployment_utils.py @@ -16,11 +16,11 @@ import six import swiftclient.client import testscenarios import testtools +from testtools import matchers from heatclient.common import deployment_utils from heatclient import exc from heatclient.v1 import software_configs -from testtools import matchers load_tests = testscenarios.load_tests_apply_scenarios diff --git a/heatclient/tests/unit/test_environment_format.py b/heatclient/tests/unit/test_environment_format.py index e4145b95..d0614b2b 100644 --- a/heatclient/tests/unit/test_environment_format.py +++ b/heatclient/tests/unit/test_environment_format.py @@ -10,14 +10,13 @@ # License for the specific language governing permissions and limitations # under the License. -from heatclient.common import environment_format - import mock import six import testscenarios import testtools import yaml +from heatclient.common import environment_format load_tests = testscenarios.load_tests_apply_scenarios diff --git a/heatclient/tests/unit/test_events.py b/heatclient/tests/unit/test_events.py index 82e0bb8f..584f713c 100644 --- a/heatclient/tests/unit/test_events.py +++ b/heatclient/tests/unit/test_events.py @@ -12,13 +12,13 @@ # License for the specific language governing permissions and limitations # under the License. -from heatclient.common import utils -from heatclient.v1 import events - import mock from mox3 import mox import testtools +from heatclient.common import utils +from heatclient.v1 import events + class EventManagerTest(testtools.TestCase): diff --git a/heatclient/tests/unit/test_resource_formatter.py b/heatclient/tests/unit/test_resource_formatter.py index e3a053d9..073e12f5 100644 --- a/heatclient/tests/unit/test_resource_formatter.py +++ b/heatclient/tests/unit/test_resource_formatter.py @@ -13,6 +13,7 @@ import json import os + import six from heatclient.common import resource_formatter diff --git a/heatclient/tests/unit/test_resource_types.py b/heatclient/tests/unit/test_resource_types.py index 7bbb591d..e31af8e7 100644 --- a/heatclient/tests/unit/test_resource_types.py +++ b/heatclient/tests/unit/test_resource_types.py @@ -10,6 +10,7 @@ # 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 mock import testtools diff --git a/heatclient/tests/unit/test_resources.py b/heatclient/tests/unit/test_resources.py index 7b9b3204..d5200e35 100644 --- a/heatclient/tests/unit/test_resources.py +++ b/heatclient/tests/unit/test_resources.py @@ -11,14 +11,14 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from heatclient.common import utils - -from heatclient.v1 import resources -from six.moves.urllib import parse from mox3 import mox +from six.moves.urllib import parse import testtools +from heatclient.common import utils +from heatclient.v1 import resources + class ResourceManagerTest(testtools.TestCase): diff --git a/heatclient/tests/unit/test_service.py b/heatclient/tests/unit/test_service.py index 4213cab2..18c59c88 100644 --- a/heatclient/tests/unit/test_service.py +++ b/heatclient/tests/unit/test_service.py @@ -13,10 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. -from heatclient import exc import testtools - +from heatclient import exc from heatclient.v1 import services diff --git a/heatclient/tests/unit/test_shell.py b/heatclient/tests/unit/test_shell.py index 7587a126..7071363d 100644 --- a/heatclient/tests/unit/test_shell.py +++ b/heatclient/tests/unit/test_shell.py @@ -11,28 +11,27 @@ # See the License for the specific language governing permissions and # limitations under the License. -import fixtures -import mock import os +import sys +import tempfile +import uuid + +import fixtures +from keystoneauth1 import fixture as keystone_fixture +import mock +from mox3 import mox +from oslo_serialization import jsonutils +from oslo_utils import encodeutils from oslotest import mockpatch import requests +from requests_mock.contrib import fixture as rm_fixture import six from six.moves.urllib import parse from six.moves.urllib import request -import sys -import tempfile import testscenarios import testtools -import uuid import yaml -from keystoneauth1 import fixture as keystone_fixture -from oslo_serialization import jsonutils -from oslo_utils import encodeutils -from requests_mock.contrib import fixture as rm_fixture - -from mox3 import mox - from heatclient.common import http from heatclient.common import utils from heatclient import exc diff --git a/heatclient/tests/unit/test_stacks.py b/heatclient/tests/unit/test_stacks.py index 34c7e71e..443015a6 100644 --- a/heatclient/tests/unit/test_stacks.py +++ b/heatclient/tests/unit/test_stacks.py @@ -9,13 +9,14 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from heatclient.v1 import stacks import mock import testscenarios from testscenarios import scenarios as scnrs import testtools +from heatclient.v1 import stacks + load_tests = testscenarios.load_tests_apply_scenarios diff --git a/heatclient/tests/unit/test_template_utils.py b/heatclient/tests/unit/test_template_utils.py index 2fc6cd2b..6440af24 100644 --- a/heatclient/tests/unit/test_template_utils.py +++ b/heatclient/tests/unit/test_template_utils.py @@ -13,11 +13,12 @@ import base64 import json +import tempfile + from mox3 import mox import six from six.moves.urllib import error from six.moves.urllib import request -import tempfile import testtools from testtools import matchers import yaml diff --git a/heatclient/tests/unit/test_utils.py b/heatclient/tests/unit/test_utils.py index 8237b4fc..a58dc225 100644 --- a/heatclient/tests/unit/test_utils.py +++ b/heatclient/tests/unit/test_utils.py @@ -12,12 +12,15 @@ # 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 os + +import mock +import testtools + from heatclient.common import utils from heatclient import exc from heatclient.v1 import resources as hc_res -import mock -import os -import testtools class ShellTest(testtools.TestCase): diff --git a/heatclient/tests/unit/v1/test_hooks.py b/heatclient/tests/unit/v1/test_hooks.py index 70a190b7..65abc033 100644 --- a/heatclient/tests/unit/v1/test_hooks.py +++ b/heatclient/tests/unit/v1/test_hooks.py @@ -14,9 +14,8 @@ import mock import testtools -import heatclient.v1.shell as shell - from heatclient.common import hook_utils +import heatclient.v1.shell as shell class TestHooks(testtools.TestCase): diff --git a/heatclient/v1/resource_types.py b/heatclient/v1/resource_types.py index b4039d14..ef29cdc7 100644 --- a/heatclient/v1/resource_types.py +++ b/heatclient/v1/resource_types.py @@ -11,13 +11,11 @@ # License for the specific language governing permissions and limitations # under the License. -import six - -from heatclient.common import utils - from oslo_utils import encodeutils +import six from six.moves.urllib import parse +from heatclient.common import utils from heatclient.openstack.common.apiclient import base diff --git a/heatclient/v1/resources.py b/heatclient/v1/resources.py index b55017df..0d805962 100644 --- a/heatclient/v1/resources.py +++ b/heatclient/v1/resources.py @@ -12,12 +12,12 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from heatclient.common import utils from oslo_utils import encodeutils import six from six.moves.urllib import parse +from heatclient.common import utils from heatclient.openstack.common.apiclient import base from heatclient.v1 import stacks diff --git a/heatclient/v1/shell.py b/heatclient/v1/shell.py index cfc942a9..76d40a46 100644 --- a/heatclient/v1/shell.py +++ b/heatclient/v1/shell.py @@ -14,12 +14,12 @@ # under the License. import logging +import sys from oslo_serialization import jsonutils from oslo_utils import strutils import six from six.moves.urllib import request -import sys import yaml from heatclient.common import deployment_utils @@ -29,13 +29,11 @@ from heatclient.common import http from heatclient.common import template_format from heatclient.common import template_utils from heatclient.common import utils - +import heatclient.exc as exc from heatclient.openstack.common._i18n import _ from heatclient.openstack.common._i18n import _LI from heatclient.openstack.common._i18n import _LW -import heatclient.exc as exc - logger = logging.getLogger(__name__) diff --git a/heatclient/v1/stacks.py b/heatclient/v1/stacks.py index 40ac1804..864772f1 100644 --- a/heatclient/v1/stacks.py +++ b/heatclient/v1/stacks.py @@ -12,11 +12,11 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from heatclient.common import utils import six from six.moves.urllib import parse +from heatclient.common import utils from heatclient import exc from heatclient.openstack.common._i18n import _ from heatclient.openstack.common.apiclient import base