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
This commit is contained in:
Akihiro Motoki 2019-01-31 10:42:21 +09:00
parent d74b871f7f
commit f99c63f98a
6 changed files with 50 additions and 52 deletions

View File

@ -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

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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:

View File

@ -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