Enforce flake8 E711
This patch enforces the rules E711 in the Ironic code base. Change-Id: Ic9395f5f6869212e4076a045ced83b57d0c16324
This commit is contained in:
parent
47d1b1f4da
commit
7f1aebfc2b
@ -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)}))
|
||||
|
||||
|
||||
|
@ -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:
|
||||
|
3
tox.ini
3
tox.ini
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user