Fix H904: wrapping using paratheses

Enabled H904 in tox.ini and made changes in relevant files
in order to follow the standard.
Modified the test-requirements file in order to use the newer
version of the hacking library.

Change-Id: I47dd0308eba41dee5f59928499539386731d786b
This commit is contained in:
Bogdan Carpusor 2016-07-27 19:59:56 +03:00
parent be6fb21e19
commit b28dd60726
5 changed files with 13 additions and 15 deletions

View File

@ -111,4 +111,4 @@ class MysqlRepo(BaseRepo):
except pymysql.Error as e:
self._mysql = None
log.exception("Couldn't insert notification types %s", e)
raise exc.DatabaseException(e)
raise exc.DatabaseException(e)

View File

@ -32,11 +32,10 @@ class OrmRepo(object):
nm = models.create_notification_method_model(metadata).alias('nm')
nmt = models.create_notification_method_type_model(metadata).alias('nmt')
self._orm_query = select([nm.c.name, nm.c.type, nm.c.address, nm.c.periodic_interval])\
.select_from(aa.join(nm, aa.c.action_id == nm.c.id))\
.where(
and_(aa.c.alarm_definition_id == bindparam('alarm_definition_id'),
aa.c.alarm_state == bindparam('alarm_state')))
self._orm_query = (select([nm.c.name, nm.c.type, nm.c.address, nm.c.periodic_interval])
.select_from(aa.join(nm, aa.c.action_id == nm.c.id))
.where(and_(aa.c.alarm_definition_id == bindparam('alarm_definition_id'),
aa.c.alarm_state == bindparam('alarm_state'))))
self._orm_nmt_query = select([nmt.c.name])

View File

@ -167,12 +167,12 @@ class EmailNotifier(AbstractNotifier):
msg = email.mime.text.MIMEText(text)
msg['Subject'] = u'{} {} "{}" for Host: {} Target: {}'\
.format(notification.state,
notification.severity,
notification.alarm_name,
hostname[0],
targethost[0]).encode("utf-8")
msg['Subject'] = (u'{} {} "{}" for Host: {} Target: {}'
.format(notification.state,
notification.severity,
notification.alarm_name,
hostname[0],
targethost[0]).encode("utf-8"))
else:
text = EMAIL_MULTIPLE_HOST_BASE.format(

View File

@ -1,4 +1,4 @@
hacking>=0.9.2,<0.10
hacking>=0.11.0,<0.12 # Apache-2.0
pyflakes==0.8.1
nose
nosexcover

View File

@ -42,6 +42,5 @@ max-line-length = 120
# H305 imports not grouped correctly
# H307 like imports should be grouped together
# H405 multi line docstring summary not separated with an empty line
# H904 Wrap long lines in parentheses instead of a backslash
ignore = F821,H201,H302,H305,H307,H405,H904
ignore = F821,H201,H302,H305,H307,H405
exclude=.venv,.git,.tox,dist,*openstack/common*,*egg,build