From f99c63f98ae8f4c43a152774dab8c9f9741de360 Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Thu, 31 Jan 2019 10:42:21 +0900 Subject: [PATCH] Update hacking version to 1.1 Older hacking depends on pep8, but pep8 module is replaced by pycodestyle. This can be resolved by updating hackinng version. This commit also fixes E117 (over-indented) and W605 (invalid escape sequence) warnings. pep8 is dropped from lower-constraints.txt as it is no longer used. Change-Id: I3a8e3b0dedf9422e4db02b525b333d12ce012a95 --- lower-constraints.txt | 3 +- neutronclient/neutron/v2_0/lb/v2/l7rule.py | 52 +++++++++---------- neutronclient/neutron/v2_0/lb/v2/member.py | 15 +++--- .../osc/v2/sfc/sfc_flow_classifier.py | 28 +++++----- .../functional/core/test_readonly_neutron.py | 2 +- test-requirements.txt | 2 +- 6 files changed, 50 insertions(+), 52 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index 117d04b2e..b37c137a0 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -25,7 +25,7 @@ flake8==2.5.5 future==0.16.0 futurist==1.2.0 greenlet==0.4.10 -hacking==0.12.0 +hacking==1.1.0 idna==2.6 imagesize==0.7.1 iso8601==0.1.11 @@ -68,7 +68,6 @@ paramiko==2.0.0 Paste==2.0.2 PasteDeploy==1.5.0 pbr==2.0.0 -pep8==1.5.7 pika-pool==0.1.3 pika==0.10.0 positional==1.2.1 diff --git a/neutronclient/neutron/v2_0/lb/v2/l7rule.py b/neutronclient/neutron/v2_0/lb/v2/l7rule.py index 1286559f2..3c468cabf 100644 --- a/neutronclient/neutron/v2_0/lb/v2/l7rule.py +++ b/neutronclient/neutron/v2_0/lb/v2/l7rule.py @@ -39,32 +39,32 @@ class LbaasL7RuleMixin(object): def _add_common_args(parser, is_create=True): - parser.add_argument( - '--type', - required=is_create, - type=utils.convert_to_uppercase, - choices=['HOST_NAME', 'PATH', 'FILE_TYPE', 'HEADER', 'COOKIE'], - help=_('Rule type.')) - parser.add_argument( - '--compare-type', - required=is_create, - type=utils.convert_to_uppercase, - choices=['REGEX', 'STARTS_WITH', 'ENDS_WITH', - 'CONTAINS', 'EQUAL_TO'], - help=_('Rule compare type.')) - parser.add_argument( - '--invert-compare', - dest='invert', - action='store_true', - help=_('Invert the compare type.')) - parser.add_argument( - '--key', - help=_('Key to compare.' - ' Relevant for HEADER and COOKIE types only.')) - parser.add_argument( - '--value', - required=is_create, - help=_('Value to compare.')) + parser.add_argument( + '--type', + required=is_create, + type=utils.convert_to_uppercase, + choices=['HOST_NAME', 'PATH', 'FILE_TYPE', 'HEADER', 'COOKIE'], + help=_('Rule type.')) + parser.add_argument( + '--compare-type', + required=is_create, + type=utils.convert_to_uppercase, + choices=['REGEX', 'STARTS_WITH', 'ENDS_WITH', + 'CONTAINS', 'EQUAL_TO'], + help=_('Rule compare type.')) + parser.add_argument( + '--invert-compare', + dest='invert', + action='store_true', + help=_('Invert the compare type.')) + parser.add_argument( + '--key', + help=_('Key to compare.' + ' Relevant for HEADER and COOKIE types only.')) + parser.add_argument( + '--value', + required=is_create, + help=_('Value to compare.')) def _common_args2body(client, parsed_args, is_create=True): diff --git a/neutronclient/neutron/v2_0/lb/v2/member.py b/neutronclient/neutron/v2_0/lb/v2/member.py index 3fec7760d..ee3c090a9 100644 --- a/neutronclient/neutron/v2_0/lb/v2/member.py +++ b/neutronclient/neutron/v2_0/lb/v2/member.py @@ -38,17 +38,16 @@ class LbaasMemberMixin(object): def _add_common_args(parser): - parser.add_argument( - '--name', - help=_('Name of the member.')) - parser.add_argument( - '--weight', - help=_('Weight of the member in the pool (default:1, [0..256]).')) + parser.add_argument( + '--name', + help=_('Name of the member.')) + parser.add_argument( + '--weight', + help=_('Weight of the member in the pool (default:1, [0..256]).')) def _parse_common_args(body, parsed_args): - neutronV20.update_dict(parsed_args, body, - ['weight', 'name']) + neutronV20.update_dict(parsed_args, body, ['weight', 'name']) class ListMember(LbaasMemberMixin, neutronV20.ListCommand): diff --git a/neutronclient/osc/v2/sfc/sfc_flow_classifier.py b/neutronclient/osc/v2/sfc/sfc_flow_classifier.py index ad35aa6bd..d223674c4 100755 --- a/neutronclient/osc/v2/sfc/sfc_flow_classifier.py +++ b/neutronclient/osc/v2/sfc/sfc_flow_classifier.py @@ -300,20 +300,20 @@ def _get_attrs(client_manager, attrs, parsed_args): def _fill_protocol_port_info(attrs, port_type, port_val): - min_port, sep, max_port = port_val.partition(":") - if not min_port: - msg = ("Invalid port value '%s', expected format is " - "min-port:max-port or min-port.") - raise argparse.ArgumentTypeError(msg % port_val) - if not max_port: - max_port = min_port - try: - attrs[port_type + '_port_range_min'] = int(min_port) - attrs[port_type + '_port_range_max'] = int(max_port) - except ValueError: - message = (_("Protocol port value %s must be an integer " - "or integer:integer.") % port_val) - raise nc_exc.CommandError(message=message) + min_port, sep, max_port = port_val.partition(":") + if not min_port: + msg = ("Invalid port value '%s', expected format is " + "min-port:max-port or min-port.") + raise argparse.ArgumentTypeError(msg % port_val) + if not max_port: + max_port = min_port + try: + attrs[port_type + '_port_range_min'] = int(min_port) + attrs[port_type + '_port_range_max'] = int(max_port) + except ValueError: + message = (_("Protocol port value %s must be an integer " + "or integer:integer.") % port_val) + raise nc_exc.CommandError(message=message) def _get_id(client, id_or_name, resource): diff --git a/neutronclient/tests/functional/core/test_readonly_neutron.py b/neutronclient/tests/functional/core/test_readonly_neutron.py index 9429c9a4c..20e1484e5 100644 --- a/neutronclient/tests/functional/core/test_readonly_neutron.py +++ b/neutronclient/tests/functional/core/test_readonly_neutron.py @@ -110,7 +110,7 @@ class SimpleReadOnlyNeutronClientTest(base.ClientTestBase): commands = [] cmds_start = lines.index('Commands for API v2.0:') - command_pattern = re.compile('^ {2}([a-z0-9\-\_]+)') + command_pattern = re.compile(r'^ {2}([a-z0-9\-\_]+)') for line in lines[cmds_start:]: match = command_pattern.match(line) if match: diff --git a/test-requirements.txt b/test-requirements.txt index 11865b828..dabdb0e02 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 # Apache-2.0 bandit>=1.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0