Update hacking version

Use latest release 1.1.0 and compatible changes w.r.t pep8

Change-Id: Ib3a7568750ca5bf14b445e3de3aa3b020c6dbb2a
This commit is contained in:
zhulingjie 2019-01-05 00:53:22 +08:00
parent c1c09eef75
commit de9d98cfc6
4 changed files with 11 additions and 11 deletions

View File

@ -1,4 +1,4 @@
heat-translator Style Commandments
===============================================
==================================
Read the OpenStack Style Commandments https://docs.openstack.org/hacking/latest/

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

View File

@ -61,10 +61,10 @@ class MemoryUnit(object):
result = regex.match(str(size)).groups()
if result[1]:
unit_size = MemoryUnit.validate_unit(result[1])
converted = int(str_to_num(result[0])
* MemoryUnit.UNIT_SIZE_DICT[unit_size]
* math.pow(MemoryUnit.UNIT_SIZE_DICT
[unit], -1))
converted = int(str_to_num(result[0]) *
MemoryUnit.UNIT_SIZE_DICT[unit_size] *
math.pow(MemoryUnit.UNIT_SIZE_DICT
[unit], -1))
log.info(_('Given size %(size)s is converted to %(num)s '
'%(unit)s.') % {'size': size,
'num': converted, 'unit': unit})
@ -81,8 +81,8 @@ class MemoryUnit(object):
if key.upper() == unit.upper():
return key
msg = _('Provided unit "{0}" is not valid. The valid units are'
' {1}').format(unit, MemoryUnit.UNIT_SIZE_DICT.keys())
msg = _('Provided unit "{0}" is not valid. The valid units are '
'{1}').format(unit, MemoryUnit.UNIT_SIZE_DICT.keys())
log.error(msg)
raise ValueError(msg)

View File

@ -79,9 +79,9 @@ def _load_classes(locations, classes):
abs_path = abs_path.replace('translator/hot', cls_path)
# Grab all the tosca type module files in the given path
mod_files = [f for f in os.listdir(abs_path) if f.endswith('.py')
and not f.startswith('__init__')
and f.startswith('tosca_')]
mod_files = [f for f in os.listdir(abs_path) if f.endswith('.py') and
not f.startswith('__init__') and
f.startswith('tosca_')]
# For each module, pick out the target translation class
for f in mod_files: