Fix W503 warnings

W503 line break before binary operator

Looking at the code base, it sounds okay to follow this check.

Change-Id: Id511e0104dc6de5b204021661d4a8776ca6d3658
This commit is contained in:
Akihiro Motoki 2018-04-11 18:13:47 +09:00
parent f545272f12
commit 11eb4e9d3e
33 changed files with 141 additions and 140 deletions

View File

@ -143,8 +143,8 @@ def process_message_notification(request, messages_path):
# NOTE (lhcheng): Cache the processed messages to avoid parsing
# the files every time. Check directory modification time if
# reload is necessary.
if (_MESSAGES_CACHE is None
or _MESSAGES_MTIME != os.path.getmtime(messages_path)):
if (_MESSAGES_CACHE is None or
_MESSAGES_MTIME != os.path.getmtime(messages_path)):
_MESSAGES_CACHE = _get_processed_messages(messages_path)
_MESSAGES_MTIME = os.path.getmtime(messages_path)

View File

@ -1072,8 +1072,8 @@ class DataTableOptions(object):
"""
def __init__(self, options):
self.name = getattr(options, 'name', self.__class__.__name__)
verbose_name = (getattr(options, 'verbose_name', None)
or self.name.title())
verbose_name = (getattr(options, 'verbose_name', None) or
self.name.title())
self.verbose_name = verbose_name
self.columns = getattr(options, 'columns', None)
self.status_columns = getattr(options, 'status_columns', [])
@ -1330,12 +1330,12 @@ class DataTable(object):
filter_string = self.get_filter_string()
filter_field = self.get_filter_field()
request_method = self.request.method
needs_preloading = (not filter_string
and request_method == 'GET'
and action.needs_preloading)
needs_preloading = (not filter_string and
request_method == 'GET' and
action.needs_preloading)
valid_method = (request_method == action.method)
not_api_filter = (filter_string
and not action.is_api_filter(filter_field))
not_api_filter = (filter_string and
not action.is_api_filter(filter_field))
if valid_method or needs_preloading or not_api_filter:
if self._meta.mixed_data_type:

View File

@ -138,8 +138,8 @@ class MultiTableMixin(object):
param_name = filter_action.get_param_name()
filter_string = request.POST.get(param_name)
filter_string_session = request.session.get(param_name, "")
changed = (filter_string is not None
and filter_string != filter_string_session)
changed = (filter_string is not None and
filter_string != filter_string_session)
if filter_string is None:
filter_string = filter_string_session
filter_field_param = param_name + '_field'

View File

@ -91,8 +91,8 @@ class WebDriver(firefox.webdriver.WebDriver):
'connection refused.' % i)
break
except socket.error as socket_error:
if (socket_error.errno == errno.ECONNREFUSED
and i < self.CONNREFUSED_RETRY_COUNT):
if (socket_error.errno == errno.ECONNREFUSED and
i < self.CONNREFUSED_RETRY_COUNT):
time.sleep(self.CONNREFUSED_RETRY_INTERVAL)
continue
raise

View File

@ -63,10 +63,10 @@ def sort_js_files(js_files):
mocks = [f for f in js_files if f.endswith(MOCK_EXT)]
specs = [f for f in js_files if f.endswith(SPEC_EXT)]
other_sources = [f for f in js_files if
not f.endswith(MODULE_EXT)
and not f.endswith(MOCK_EXT)
and not f.endswith(SPEC_EXT)]
other_sources = [f for f in js_files
if (not f.endswith(MODULE_EXT) and
not f.endswith(MOCK_EXT) and
not f.endswith(SPEC_EXT))]
sources = modules + other_sources
return sources, mocks, specs

View File

@ -128,8 +128,8 @@ class Token(object):
"""Determines if this is a pki-based token (pki or pkiz)"""
if token is None:
return False
return (keystone_cms.is_ans1_token(token)
or keystone_cms.is_pkiz(token))
return (keystone_cms.is_ans1_token(token) or
keystone_cms.is_pkiz(token))
class User(models.AbstractBaseUser, models.AnonymousUser):
@ -229,8 +229,8 @@ class User(models.AbstractBaseUser, models.AnonymousUser):
self.project_name = project_name or tenant_name
self.service_catalog = service_catalog
self._services_region = (
services_region
or utils.default_services_region(service_catalog)
services_region or
utils.default_services_region(service_catalog)
)
self.roles = roles or []
self.endpoint = endpoint

View File

@ -352,8 +352,8 @@ def default_services_region(service_catalog, request=None,
available_regions = [get_endpoint_region(endpoint) for service
in service_catalog for endpoint
in service.get('endpoints', [])
if (service.get('type') is not None
and service.get('type') != 'identity')]
if (service.get('type') is not None and
service.get('type') != 'identity')]
if not available_regions:
# this is very likely an incomplete keystone setup
LOG.warning('No regions could be found excluding identity.')

View File

@ -98,8 +98,8 @@ class EvacuateHostViewTest(test.BaseAdminViewTests):
class MigrateHostViewTest(test.BaseAdminViewTests):
def test_index(self):
disabled_services = [service for service in self.services.list()
if service.binary == 'nova-compute'
and service.status == 'disabled']
if (service.binary == 'nova-compute' and
service.status == 'disabled')]
disabled_service = disabled_services[0]
url = reverse('horizon:admin:hypervisors:compute:migrate_host',
@ -112,8 +112,8 @@ class MigrateHostViewTest(test.BaseAdminViewTests):
@test.create_mocks({api.nova: ['migrate_host']})
def test_maintenance_host_cold_migration_succeed(self):
disabled_services = [service for service in self.services.list()
if service.binary == 'nova-compute'
and service.status == 'disabled']
if (service.binary == 'nova-compute' and
service.status == 'disabled')]
disabled_service = disabled_services[0]
self.mock_migrate_host.return_value = True
@ -139,8 +139,8 @@ class MigrateHostViewTest(test.BaseAdminViewTests):
@test.create_mocks({api.nova: ['migrate_host']})
def test_maintenance_host_live_migration_succeed(self):
disabled_services = [service for service in self.services.list()
if service.binary == 'nova-compute'
and service.status == 'disabled']
if (service.binary == 'nova-compute' and
service.status == 'disabled')]
disabled_service = disabled_services[0]
self.mock_migrate_host.return_value = True
url = reverse('horizon:admin:hypervisors:compute:migrate_host',
@ -165,8 +165,8 @@ class MigrateHostViewTest(test.BaseAdminViewTests):
@test.create_mocks({api.nova: ['migrate_host']})
def test_maintenance_host_migration_fails(self):
disabled_services = [service for service in self.services.list()
if service.binary == 'nova-compute'
and service.status == 'disabled']
if (service.binary == 'nova-compute' and
service.status == 'disabled')]
disabled_service = disabled_services[0]
self.mock_migrate_host.side_effect = self.exceptions.nova

View File

@ -124,8 +124,8 @@ class IndexView(tables.DataTableView):
invalid_msg = ('API query is not valid and is ignored: '
'%(field)s=%(string)s')
try:
filter_string = builtins.int(float(filter_string)
* (units.Mi))
filter_string = builtins.int(float(filter_string) *
(units.Mi))
if filter_string >= 0:
filters[filter_field] = filter_string
else:

View File

@ -66,9 +66,9 @@ class MigrateInstance(policy.PolicyTargetMixin, tables.BatchAction):
)
def allowed(self, request, instance):
return ((instance.status in project_tables.ACTIVE_STATES
or instance.status == 'SHUTOFF')
and not project_tables.is_deleting(instance))
return ((instance.status in project_tables.ACTIVE_STATES or
instance.status == 'SHUTOFF') and
not project_tables.is_deleting(instance))
def action(self, request, obj_id):
api.nova.server_migrate(request, obj_id)
@ -84,8 +84,8 @@ class LiveMigrateInstance(policy.PolicyTargetMixin,
("compute", "os_compute_api:os-migrate-server:migrate_live"),)
def allowed(self, request, instance):
return ((instance.status in project_tables.ACTIVE_STATES)
and not project_tables.is_deleting(instance))
return (instance.status in project_tables.ACTIVE_STATES and
not project_tables.is_deleting(instance))
class AdminUpdateRow(project_tables.UpdateRow):

View File

@ -44,8 +44,8 @@ class CreatePortInfoAction(project_workflow.CreatePortInfoAction):
class CreatePortInfo(project_workflow.CreatePortInfo):
action_class = CreatePortInfoAction
depends_on = ("network_id", "target_tenant_id")
contributes = (project_workflow.CreatePortInfo.contributes
+ ['binding__host_id'])
contributes = (project_workflow.CreatePortInfo.contributes +
['binding__host_id'])
class CreatePort(project_workflow.CreatePort):

View File

@ -33,10 +33,10 @@ class Trunks(horizon.Panel):
request = context['request']
try:
return (
super(Trunks, self).allowed(context)
and request.user.has_perms(self.permissions)
and neutron.is_extension_supported(request,
extension_alias='trunk')
super(Trunks, self).allowed(context) and
request.user.has_perms(self.permissions) and
neutron.is_extension_supported(request,
extension_alias='trunk')
)
except Exception:
LOG.error("Call to list enabled services failed. This is likely "

View File

@ -123,8 +123,8 @@ class UserFilterAction(tables.FilterAction):
"""Naive case-insensitive search."""
q = filter_string.lower()
return [user for user in users
if q in user.name.lower()
or q in (getattr(user, 'email', None) or '').lower()]
if (q in user.name.lower() or
q in (getattr(user, 'email', None) or '').lower())]
class RemoveMembers(tables.DeleteAction):

View File

@ -157,8 +157,9 @@ class CreateVolumeFromImage(tables.LinkAction):
return "?".join([base_url, params])
def allowed(self, request, image=None):
if (image and image.container_format not in NOT_LAUNCHABLE_FORMATS
and api.cinder.is_volume_service_enabled(request)):
if (image and
image.container_format not in NOT_LAUNCHABLE_FORMATS and
api.cinder.is_volume_service_enabled(request)):
return image.status == "active"
return False

View File

@ -137,9 +137,9 @@ class RebootInstance(policy.PolicyTargetMixin, tables.BatchAction):
def allowed(self, request, instance=None):
if instance is not None:
return ((instance.status in ACTIVE_STATES
or instance.status == 'SHUTOFF')
and not is_deleting(instance))
return ((instance.status in ACTIVE_STATES or
instance.status == 'SHUTOFF') and
not is_deleting(instance))
else:
return True
@ -230,9 +230,9 @@ class TogglePause(tables.BatchAction):
policy_rules, request,
target={'project_id': getattr(instance, 'tenant_id', None)})
return (has_permission
and (instance.status in ACTIVE_STATES or self.paused)
and not is_deleting(instance))
return (has_permission and
(instance.status in ACTIVE_STATES or self.paused) and
not is_deleting(instance))
def action(self, request, obj_id):
if self.paused:
@ -297,9 +297,9 @@ class ToggleSuspend(tables.BatchAction):
policy_rules, request,
target={'project_id': getattr(instance, 'tenant_id', None)})
return (has_permission
and (instance.status in ACTIVE_STATES or self.suspended)
and not is_deleting(instance))
return (has_permission and
(instance.status in ACTIVE_STATES or self.suspended) and
not is_deleting(instance))
def action(self, request, obj_id):
if self.suspended:
@ -365,9 +365,9 @@ class ToggleShelve(tables.BatchAction):
policy_rules, request,
target={'project_id': getattr(instance, 'tenant_id', None)})
return (has_permission
and (instance.status in SHELVE_READY_STATES or self.shelved)
and not is_deleting(instance))
return (has_permission and
(instance.status in SHELVE_READY_STATES or self.shelved) and
not is_deleting(instance))
def action(self, request, obj_id):
if self.shelved:
@ -550,9 +550,9 @@ class ResizeLink(policy.PolicyTargetMixin, tables.LinkAction):
return "?".join([base_url, param])
def allowed(self, request, instance):
return ((instance.status in ACTIVE_STATES
or instance.status == 'SHUTOFF')
and not is_deleting(instance))
return ((instance.status in ACTIVE_STATES or
instance.status == 'SHUTOFF') and
not is_deleting(instance))
class ConfirmResize(policy.PolicyTargetMixin, tables.Action):
@ -590,9 +590,9 @@ class RebuildInstance(policy.PolicyTargetMixin, tables.LinkAction):
action_type = "danger"
def allowed(self, request, instance):
return ((instance.status in ACTIVE_STATES
or instance.status == 'SHUTOFF')
and not is_deleting(instance))
return ((instance.status in ACTIVE_STATES or
instance.status == 'SHUTOFF') and
not is_deleting(instance))
def get_link_url(self, datum):
instance_id = self.table.get_object_id(datum)
@ -609,11 +609,11 @@ class DecryptInstancePassword(tables.LinkAction):
enable = getattr(settings,
'OPENSTACK_ENABLE_PASSWORD_RETRIEVE',
False)
return (enable
and (instance.status in ACTIVE_STATES
or instance.status == 'SHUTOFF')
and not is_deleting(instance)
and get_keyname(instance) is not None)
return (enable and
(instance.status in ACTIVE_STATES or
instance.status == 'SHUTOFF') and
not is_deleting(instance) and
get_keyname(instance) is not None)
def get_link_url(self, datum):
instance_id = self.table.get_object_id(datum)
@ -831,9 +831,9 @@ class StopInstance(policy.PolicyTargetMixin, tables.BatchAction):
)
def allowed(self, request, instance):
return ((instance is None)
or ((get_power_state(instance) in ("RUNNING", "SUSPENDED"))
and not is_deleting(instance)))
return (instance is None or
(get_power_state(instance) in ("RUNNING", "SUSPENDED") and
not is_deleting(instance)))
def action(self, request, obj_id):
api.nova.server_stop(request, obj_id)
@ -918,9 +918,9 @@ class AttachVolume(tables.LinkAction):
# is not active, or the instance is being deleted
# or cinder is not enabled
def allowed(self, request, instance=None):
return instance.status in ("ACTIVE") \
and not is_deleting(instance) \
and api.cinder.is_volume_service_enabled(request)
return (instance.status in ("ACTIVE") and
not is_deleting(instance) and
api.cinder.is_volume_service_enabled(request))
class DetachVolume(AttachVolume):
@ -933,9 +933,9 @@ class DetachVolume(AttachVolume):
# is not active, or the instance is being deleted
# or cinder is not enabled
def allowed(self, request, instance=None):
return instance.status in ("ACTIVE") \
and not is_deleting(instance) \
and api.cinder.is_volume_service_enabled(request)
return (instance.status in ("ACTIVE") and
not is_deleting(instance) and
api.cinder.is_volume_service_enabled(request))
class AttachInterface(policy.PolicyTargetMixin, tables.LinkAction):
@ -946,10 +946,10 @@ class AttachInterface(policy.PolicyTargetMixin, tables.LinkAction):
policy_rules = (("compute", "os_compute_api:os-attach-interfaces"),)
def allowed(self, request, instance):
return ((instance.status in ACTIVE_STATES
or instance.status == 'SHUTOFF')
and not is_deleting(instance)
and api.base.is_service_enabled(request, 'network'))
return ((instance.status in ACTIVE_STATES or
instance.status == 'SHUTOFF') and
not is_deleting(instance) and
api.base.is_service_enabled(request, 'network'))
def get_link_url(self, datum):
instance_id = self.table.get_object_id(datum)

View File

@ -519,8 +519,9 @@ class SetInstanceDetails(workflows.Step):
def contribute(self, data, context):
context = super(SetInstanceDetails, self).contribute(data, context)
# Allow setting the source dynamically.
if ("source_type" in context and "source_id" in context
and context["source_type"] not in context):
if ("source_type" in context and
"source_id" in context and
context["source_type"] not in context):
context[context["source_type"]] = context["source_id"]
# Translate form input to context for source values.

View File

@ -30,10 +30,9 @@ class NetworkQoS(horizon.Panel):
request = context['request']
try:
return (
super(NetworkQoS, self).allowed(context)
and request.user.has_perms(self.permissions)
and neutron.is_extension_supported(request,
extension_alias='qos')
super(NetworkQoS, self).allowed(context) and
request.user.has_perms(self.permissions) and
neutron.is_extension_supported(request, extension_alias='qos')
)
except Exception:
LOG.error("Call to list enabled services failed. This is likely "

View File

@ -220,15 +220,15 @@ class JSONView(View):
def add_resource_url(self, view, resources):
tenant_id = self.request.user.tenant_id
for resource in resources:
if (resource.get('tenant_id')
and tenant_id != resource.get('tenant_id')):
if (resource.get('tenant_id') and
tenant_id != resource.get('tenant_id')):
continue
resource['url'] = reverse(view, None, [str(resource['id'])])
def _check_router_external_port(self, ports, router_id, network_id):
for port in ports:
if (port['network_id'] == network_id
and port['device_id'] == router_id):
if (port['network_id'] == network_id and
port['device_id'] == router_id):
return True
return False
@ -361,8 +361,8 @@ class JSONView(View):
'status': self.trans.port[port.status],
'original_status': port.status}
for port in neutron_ports
if port.device_owner != 'network:router_ha_interface'
and port.network_id in tenant_network_ids]
if (port.device_owner != 'network:router_ha_interface' and
port.network_id in tenant_network_ids)]
self.add_resource_url('horizon:project:networks:ports:detail',
ports)
return ports

View File

@ -82,8 +82,9 @@ class DetailView(tabs.TabbedTableView):
msg = _('Unable to retrieve port details.')
exceptions.handle(self.request, msg, redirect=redirect)
if (api.neutron.is_extension_supported(self.request, 'mac-learning')
and not hasattr(port, 'mac_state')):
if (api.neutron.is_extension_supported(self.request,
'mac-learning') and
not hasattr(port, 'mac_state')):
port.mac_state = api.neutron.OFF_STATE
return port

View File

@ -272,8 +272,8 @@ class CreatePort(workflows.Workflow):
# If port_security_enabled is set to False, security groups on the port
# must be cleared. We will clear the current security groups
# in this case.
if ('port_security_enabled' in params
and not params['port_security_enabled']):
if ('port_security_enabled' in params and
not params['port_security_enabled']):
params['security_groups'] = []
# In case of CreatePortSecurityGroup registered, 'wanted_groups'
# exists in context.
@ -421,8 +421,8 @@ class UpdatePort(workflows.Workflow):
# If port_security_enabled is set to False, security groups on the port
# must be cleared. We will clear the current security groups
# in this case.
if ('port_security_enabled' in params
and not params['port_security_enabled']):
if ('port_security_enabled' in params and
not params['port_security_enabled']):
params['security_groups'] = []
# In case of UpdatePortSecurityGroup registered, 'wanted_groups'
# exists in data.

View File

@ -67,8 +67,8 @@ class ExtraRoutesTable(tables.DataTable):
def get_object_display(self, datum):
"""Display ExtraRoutes when deleted."""
return (super(ExtraRoutesTable, self).get_object_display(datum)
or datum.destination + " -> " + datum.nexthop)
return (super(ExtraRoutesTable, self).get_object_display(datum) or
datum.destination + " -> " + datum.nexthop)
class Meta(object):
name = "extra_routes"

View File

@ -69,8 +69,8 @@ class AddInterface(forms.SelfHandlingForm):
'%s%s (%s)' % (net_name, subnet.cidr,
subnet.name or subnet.id))
for subnet in n['subnets']
if subnet.id not in router_subnet_ids
and subnet.gateway_ip]
if (subnet.id not in router_subnet_ids and
subnet.gateway_ip)]
if choices:
choices.insert(0, ("", _("Select Subnet")))
else:

View File

@ -204,9 +204,9 @@ def check_rule_template(port, ip_proto):
if not rules_dict:
return port
templ_rule = [rule for rule in rules_dict.values()
if (str(port) == rule['from_port']
and str(port) == rule['to_port']
and ip_proto == rule['ip_protocol'])]
if (str(port) == rule['from_port'] and
str(port) == rule['to_port'] and
ip_proto == rule['ip_protocol'])]
if templ_rule:
return u"%(from_port)s (%(name)s)" % templ_rule[0]
return port

View File

@ -30,8 +30,8 @@ class ServerGroups(horizon.Panel):
request = context['request']
try:
return (
super(ServerGroups, self).allowed(context)
and request.user.has_perms(self.permissions)
super(ServerGroups, self).allowed(context) and
request.user.has_perms(self.permissions)
)
except Exception:
LOG.exception("Call to list enabled services failed. This is "

View File

@ -32,10 +32,10 @@ class Trunks(horizon.Panel):
request = context['request']
try:
return (
super(Trunks, self).allowed(context)
and request.user.has_perms(self.permissions)
and neutron.is_extension_supported(request,
extension_alias='trunk')
super(Trunks, self).allowed(context) and
request.user.has_perms(self.permissions) and
neutron.is_extension_supported(request,
extension_alias='trunk')
)
except Exception:
LOG.error("Call to list enabled services failed. This is likely "

View File

@ -141,10 +141,10 @@ class CreateVolume(tables.LinkAction):
def allowed(self, request, volume=None):
limits = api.cinder.tenant_absolute_limits(request)
gb_available = (limits.get('maxTotalVolumeGigabytes', float("inf"))
- limits.get('totalGigabytesUsed', 0))
volumes_available = (limits.get('maxTotalVolumes', float("inf"))
- limits.get('totalVolumesUsed', 0))
gb_available = (limits.get('maxTotalVolumeGigabytes', float("inf")) -
limits.get('totalGigabytesUsed', 0))
volumes_available = (limits.get('maxTotalVolumes', float("inf")) -
limits.get('totalVolumesUsed', 0))
if gb_available <= 0 or volumes_available <= 0:
if "disabled" not in self.classes:
@ -217,8 +217,8 @@ class CreateSnapshot(VolumePolicyTargetMixin, tables.LinkAction):
exceptions.handle(request, _('Unable to retrieve tenant limits.'))
limits = {}
snapshots_available = (limits.get('maxTotalSnapshots', float("inf"))
- limits.get('totalSnapshotsUsed', 0))
snapshots_available = (limits.get('maxTotalSnapshots', float("inf")) -
limits.get('totalSnapshotsUsed', 0))
if snapshots_available <= 0 and "disabled" not in self.classes:
self.classes = [c for c in self.classes] + ['disabled']

View File

@ -280,8 +280,8 @@ class ExtendView(forms.ModalFormView):
context['submit_url'] = reverse(self.submit_url, args=args)
try:
usages = quotas.tenant_limit_usages(self.request)
usages['totalGigabytesUsed'] = (usages['totalGigabytesUsed']
- context['volume'].size)
usages['totalGigabytesUsed'] = (usages['totalGigabytesUsed'] -
context['volume'].size)
context['usages'] = usages
except Exception:
exceptions.handle(self.request)

View File

@ -48,8 +48,9 @@ class ApiaccessPage(basepage.BaseNavigationPage):
self.apiaccess_table.download_openstack_rc_v3()
def list_of_files(self, directory, template):
return [f for f in listdir(directory) if isfile(join(directory, f))
and f.endswith(template)]
return [f for f in listdir(directory)
if (isfile(join(directory, f)) and
f.endswith(template))]
def get_credentials_from_file(self, version, directory, template):
self._wait_until(

View File

@ -72,7 +72,7 @@ class FloatingipsPage(basepage.BaseNavigationPage):
floatingip_form = self.floatingips_table.allocate_ip()
floatingip_form.submit()
ip = re.compile('(([2][5][0-5]\.)|([2][0-4][0-9]\.)'
+ '|([0-1]?[0-9]?[0-9]\.)){3}(([2][5][0-5])|'
'|([0-1]?[0-9]?[0-9]\.)){3}(([2][5][0-5])|'
'([2][0-4][0-9])|([0-1]?[0-9]?[0-9]))')
match = ip.search((self._get_element(
*self._floatingips_fadein_popup_locator)).text)

View File

@ -62,8 +62,7 @@ class NeutronNetworksTestCase(test.TestCase):
response = neutron.Networks().post(request)
self.assertStatusCode(response, 201)
self.assertEqual(response['location'],
'/api/neutron/networks/'
+ self.networks.first().id)
'/api/neutron/networks/' + self.networks.first().id)
exp_resp = self._dictify_network(self.networks.first())
self.assertEqual(response.json, exp_resp)
mock_network_create.assert_called_once_with(request, **expected)

View File

@ -457,9 +457,9 @@ class NeutronApiTests(test.APIMockTestCase):
expected_parent_port_ids.add(trunk['port_id'])
expected_subport_ids |= set([p['port_id'] for p
in trunk['sub_ports']])
expected_normal_port_ids = ({p['id'] for p in ports}
- expected_parent_port_ids
- expected_subport_ids)
expected_normal_port_ids = ({p['id'] for p in ports} -
expected_parent_port_ids -
expected_subport_ids)
ret_val = api.neutron.port_list_with_trunk_types(self.request)
@ -469,8 +469,8 @@ class NeutronApiTests(test.APIMockTestCase):
if isinstance(p, api.neutron.PortTrunkParent)}
subport_ids = {p.id for p in ret_val
if isinstance(p, api.neutron.PortTrunkSubport)}
normal_port_ids = ({p.id for p in ret_val}
- parent_port_ids - subport_ids)
normal_port_ids = ({p.id for p in ret_val} -
parent_port_ids - subport_ids)
self.assertEqual(expected_parent_port_ids, parent_port_ids)
self.assertEqual(expected_subport_ids, subport_ids)
self.assertEqual(expected_normal_port_ids, normal_port_ids)

View File

@ -46,9 +46,9 @@ def import_dashboard_config(modules):
if hasattr(submodule, 'DASHBOARD'):
dashboard = submodule.DASHBOARD
config[dashboard].update(submodule.__dict__)
elif (hasattr(submodule, 'PANEL')
or hasattr(submodule, 'PANEL_GROUP')
or hasattr(submodule, 'FEATURE')):
elif (hasattr(submodule, 'PANEL') or
hasattr(submodule, 'PANEL_GROUP') or
hasattr(submodule, 'FEATURE')):
# If enabled and local.enabled contains a same filename,
# the file loaded later (i.e., local.enabled) will be used.
name = submodule.__name__.rsplit('.', 1)[1]
@ -136,8 +136,8 @@ def update_dashboards(modules, horizon_config, installed_apps):
add_exceptions = config.get('ADD_EXCEPTIONS', {}).items()
for category, exc_list in add_exceptions:
exceptions[category] = tuple(set(exceptions.get(category, ())
+ exc_list))
exceptions[category] = tuple(set(exceptions.get(category, ()) +
exc_list))
angular_modules.extend(config.get('ADD_ANGULAR_MODULES', []))
# avoid pulling in dashboard javascript dependencies multiple times

View File

@ -156,8 +156,7 @@ commands =
filename = *.py,django.wsgi
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py,*/local/*,*/test/test_plugins/*,.ropeproject,node_modules,openstack_dashboard/enabled/*
# E402 module level import not at top of file
# W503 line break before binary operator
ignore = E402,W503
ignore = E402
# Enable the following hacking rules which are disabled by default
# H106 Do not put vim configuration in source files.
# H203 Use assertIs(Not)None to check for None.