From 463eab47e4d47cb306333b705247d4bd37f12651 Mon Sep 17 00:00:00 2001 From: ZhijunWei Date: Fri, 28 Dec 2018 23:04:46 +0800 Subject: Update hacking version 1. update hacking version to latest 2. fix pep8 failed Change-Id: I49a6d46466b06bd56bed1f15632c9c80ef539b38 --- test-requirements.txt | 2 +- troveclient/__init__.py | 4 ++-- troveclient/compat/cli.py | 7 +++---- troveclient/compat/mcli.py | 3 +-- troveclient/service_catalog.py | 8 ++++---- troveclient/v1/backups.py | 4 ++-- troveclient/v1/shell.py | 22 +++++++++++----------- 7 files changed, 24 insertions(+), 26 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 0503eb1..a39ef08 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,7 @@ # The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 +hacking>=1.1.0,<1.2.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD oslotest>=3.2.0 # Apache-2.0 diff --git a/troveclient/__init__.py b/troveclient/__init__.py index a470d7b..b78de9d 100644 --- a/troveclient/__init__.py +++ b/troveclient/__init__.py @@ -14,10 +14,10 @@ # License for the specific language governing permissions and limitations # under the License. -__all__ = ['__version__'] - import pbr.version +__all__ = ['__version__'] + version_info = pbr.version.VersionInfo('python-troveclient') # We have a circular import problem when we first run python setup.py sdist # It's harmless, so deflect it. diff --git a/troveclient/compat/cli.py b/troveclient/compat/cli.py index 86b3109..8d82ab7 100644 --- a/troveclient/compat/cli.py +++ b/troveclient/compat/cli.py @@ -21,6 +21,7 @@ Trove Command line tool import os import sys +from troveclient.compat import common # If ../trove/__init__.py exists, add ../ to Python search path, so that # it will override what happens to be installed in /usr/(local/)lib/python... @@ -31,8 +32,6 @@ if os.path.exists(os.path.join(possible_topdir, 'troveclient', '__init__.py')): sys.path.insert(0, possible_topdir) -from troveclient.compat import common - class InstanceCommands(common.AuthedCommandsBase): """Commands to perform various instance operations and actions.""" @@ -454,8 +453,8 @@ def main(): # Parse arguments load_file = True for index, arg in enumerate(sys.argv): - if (arg == "auth" and len(sys.argv) > (index + 1) - and sys.argv[index + 1] == "login"): + if (arg == "auth" and len(sys.argv) > (index + 1) and + sys.argv[index + 1] == "login"): load_file = False oparser = common.CliOptions.create_optparser(load_file) diff --git a/troveclient/compat/mcli.py b/troveclient/compat/mcli.py index 8dda4d0..e3efbae 100644 --- a/troveclient/compat/mcli.py +++ b/troveclient/compat/mcli.py @@ -22,6 +22,7 @@ import json import os import sys +from troveclient.compat import common # If ../trove/__init__.py exists, add ../ to Python search path, so that # it will override what happens to be installed in /usr/(local/)lib/python... @@ -32,8 +33,6 @@ if os.path.exists(os.path.join(possible_topdir, 'troveclient.compat', '__init__.py')): sys.path.insert(0, possible_topdir) -from troveclient.compat import common - oparser = None diff --git a/troveclient/service_catalog.py b/troveclient/service_catalog.py index 19bdda0..a23f286 100644 --- a/troveclient/service_catalog.py +++ b/troveclient/service_catalog.py @@ -62,13 +62,13 @@ class ServiceCatalog(object): if version == 'v2': skip_service_type_check = True - if (not skip_service_type_check - and service.get("type") != service_type): + if (not skip_service_type_check and + service.get("type") != service_type): continue if (database_service_name and service_type in ('database', - 'databasev2') - and service.get('name') != database_service_name): + 'databasev2') and + service.get('name') != database_service_name): continue endpoints = service['endpoints'] diff --git a/troveclient/v1/backups.py b/troveclient/v1/backups.py index f314fdc..40ecbf2 100644 --- a/troveclient/v1/backups.py +++ b/troveclient/v1/backups.py @@ -248,8 +248,8 @@ class Backups(base.ManagerWithFind): def execution_list_generator(): yielded = 0 for sexec in mistral_execution_generator(): - if (sexec.workflow_name == cron_trigger.workflow_name - and ct_input == json.loads(sexec.input)): + if (sexec.workflow_name == cron_trigger.workflow_name and + ct_input == json.loads(sexec.input)): yield ScheduleExecution(self, sexec.to_dict(), loaded=True) yielded += 1 diff --git a/troveclient/v1/shell.py b/troveclient/v1/shell.py index 4f05b87..1dddb35 100644 --- a/troveclient/v1/shell.py +++ b/troveclient/v1/shell.py @@ -22,6 +22,15 @@ import time from troveclient.i18n import _ +try: + import simplejson as json +except ImportError: + import json + +from troveclient import exceptions +from troveclient import utils +from troveclient.v1 import modules + INSTANCE_ARG_NAME = _('instance') INSTANCE_METAVAR = _('"opt=[,opt= ...] "') INSTANCE_ERROR = _("Instance argument(s) must be of the form --instance " @@ -53,15 +62,6 @@ EXT_PROPS_HELP = _("Add extended properties for cluster create. " " mongos_volume_size=, " " mongos_volume_type=.") -try: - import simplejson as json -except ImportError: - import json - -from troveclient import exceptions -from troveclient import utils -from troveclient.v1 import modules - def _poll_for_status(poll_fn, obj_id, action, final_ok_states, poll_period=5, show_progress=True): @@ -811,8 +811,8 @@ def _strip_option(opts_str, opt_name, is_required=True, if is_required and not opt_value: raise exceptions.MissingArgs([opt_name], message=(_("Missing option '%s' for " - "argument --instance ") - + INSTANCE_METAVAR)) + "argument --instance ") + + INSTANCE_METAVAR)) return opt_value, opts_str.strip().strip(",") -- cgit v1.2.1