Fix pep8 errors

Pep8 job is broken due to recent pep8 upgrade and corresponding
pycodestyle update.

This commit fixes the following errors:
  - E731 do not assign a lambda expression, use a def
  - W503 line break before binary operator
  - E402 module level import not at top of file

Change-Id: Ib357336eb165cf642f6793ff6cdde7d53075b158
This commit is contained in:
Hunt Xu 2018-04-12 20:44:03 +08:00
parent 8d5433fe8f
commit 9e479b621b
6 changed files with 16 additions and 20 deletions

View File

@ -21,12 +21,12 @@ Create Date: 2015-02-10 17:51:10.752504
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '3ea02b2a773e'
down_revision = 'start_neutron_vpnaas'
from alembic import op
TABLES = ['ipsecpolicies', 'ikepolicies', 'ipsec_site_connections',
'vpnservices']

View File

@ -21,16 +21,14 @@ Create Date: 2015-07-27 16:43:59.123456
"""
# revision identifiers, used by Alembic.
revision = '333dfd6afaa2'
down_revision = '56893333aa52'
depends_on = '24f28869838b'
from alembic import op
import netaddr
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '333dfd6afaa2'
down_revision = '56893333aa52'
depends_on = '24f28869838b'
VPNService = sa.Table('vpnservices', sa.MetaData(),
sa.Column('router_id', sa.String(36), nullable=False),

View File

@ -20,15 +20,15 @@ Create Date: 2015-08-06 18:21:03.241664
"""
# revision identifiers, used by Alembic.
revision = '41b509d10b5e'
down_revision = '24f28869838b'
from alembic import op
import sqlalchemy as sa
from neutron_vpnaas.services.vpn.common import constants
# revision identifiers, used by Alembic.
revision = '41b509d10b5e'
down_revision = '24f28869838b'
def upgrade():
op.create_table(

View File

@ -21,15 +21,14 @@ Create Date: 2017-04-10 10:14:41.724811
"""
# revision identifiers, used by Alembic.
revision = '95601446dbcc'
down_revision = '38893903cbde'
from alembic import op
import sqlalchemy as sa
from neutron.db import migration
# revision identifiers, used by Alembic.
revision = '95601446dbcc'
down_revision = '38893903cbde'
# milestone identifier, used by neutron-db-manage
neutron_milestone = [migration.PIKE]

View File

@ -683,8 +683,8 @@ class VPNPluginRpcDbMixin(object):
vpnservice['id'])
continue
if (not utils.in_pending_status(vpnservice_db.status)
or vpnservice['updated_pending_status']):
if (not utils.in_pending_status(vpnservice_db.status) or
vpnservice['updated_pending_status']):
vpnservice_db.status = vpnservice['status']
for conn_id, conn in vpnservice[
'ipsec_site_connections'].items():

View File

@ -343,8 +343,7 @@ class BaseIPsecDeviceDriver(base.BaseTestCase):
@staticmethod
def generate_diff(a, b):
"""Generates unified diff of a and b."""
by_lines = lambda x: x.splitlines(True)
a, b = list(by_lines(a)), list(by_lines(b))
a, b = list(a.splitlines(True)), list(b.splitlines(True))
diff = difflib.unified_diff(a, b, fromfile="expected",
tofile="actual")
return diff