Enforce flake8 E711

This patch enforces the rules E711 in the Ironic code base.

Change-Id: Ic9395f5f6869212e4076a045ced83b57d0c16324
This commit is contained in:
Lucas Alvares Gomes 2015-08-13 16:26:45 +01:00
parent 47d1b1f4da
commit 7f1aebfc2b
3 changed files with 8 additions and 8 deletions

View File

@ -24,7 +24,7 @@ down_revision = '242cc6a923b3'
from alembic import op
from sqlalchemy import String
from sqlalchemy.sql import table, column
from sqlalchemy.sql import table, column, null
node = table('nodes',
column('uuid', String(36)),
@ -41,7 +41,7 @@ AVAILABLE = 'available'
def upgrade():
op.execute(
node.update().where(
node.c.provision_state == None).values(
node.c.provision_state == null()).values(
{'provision_state': op.inline_literal(AVAILABLE)}))

View File

@ -29,6 +29,7 @@ from oslo_utils import strutils
from oslo_utils import timeutils
from oslo_utils import uuidutils
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy import sql
from ironic.common import exception
from ironic.common.i18n import _
@ -159,14 +160,14 @@ class Connection(api.Connection):
query = query.filter_by(chassis_id=chassis_obj.id)
if 'associated' in filters:
if filters['associated']:
query = query.filter(models.Node.instance_uuid != None)
query = query.filter(models.Node.instance_uuid != sql.null())
else:
query = query.filter(models.Node.instance_uuid == None)
query = query.filter(models.Node.instance_uuid == sql.null())
if 'reserved' in filters:
if filters['reserved']:
query = query.filter(models.Node.reservation != None)
query = query.filter(models.Node.reservation != sql.null())
else:
query = query.filter(models.Node.reservation == None)
query = query.filter(models.Node.reservation == sql.null())
if 'maintenance' in filters:
query = query.filter_by(maintenance=filters['maintenance'])
if 'driver' in filters:

View File

@ -59,8 +59,7 @@ setenv = PYTHONHASHSEED=0
commands = {posargs}
[flake8]
# E711: ignored because it is normal to use "column == None" in sqlalchemy
ignore = E129,E711
ignore = E129
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools
max-complexity=17