summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.pylintrc2
-rw-r--r--horizon/tables/base.py4
-rw-r--r--horizon/workflows/base.py6
-rw-r--r--openstack_dashboard/api/neutron.py26
-rw-r--r--openstack_dashboard/dashboards/admin/floating_ips/views.py4
-rw-r--r--openstack_dashboard/dashboards/admin/images/views.py2
-rw-r--r--openstack_dashboard/dashboards/admin/instances/views.py4
-rw-r--r--openstack_dashboard/dashboards/admin/rbac_policies/views.py4
-rw-r--r--openstack_dashboard/dashboards/admin/snapshots/views.py2
-rw-r--r--openstack_dashboard/dashboards/project/floating_ips/views.py4
-rw-r--r--openstack_dashboard/dashboards/project/instances/views.py4
-rw-r--r--openstack_dashboard/dashboards/project/volumes/views.py2
12 files changed, 31 insertions, 33 deletions
diff --git a/.pylintrc b/.pylintrc
index afa5fe216..842e826fc 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -79,9 +79,7 @@ disable=
# "R" Refactor recommendations
chained-comparison,
comparison-with-itself,
- consider-using-dict-comprehension,
consider-using-in,
- consider-using-set-comprehension,
cyclic-import, # TODO
duplicate-code,
inconsistent-return-statements, # TODO
diff --git a/horizon/tables/base.py b/horizon/tables/base.py
index f4e4802bf..2349ab74a 100644
--- a/horizon/tables/base.py
+++ b/horizon/tables/base.py
@@ -653,8 +653,8 @@ class Row(html.HTMLElement):
def status(self):
column_names = self.table._meta.status_columns
if column_names:
- statuses = dict([(column_name, self.cells[column_name].status) for
- column_name in column_names])
+ statuses = dict((column_name, self.cells[column_name].status) for
+ column_name in column_names)
return self.table.calculate_row_status(statuses)
@property
diff --git a/horizon/workflows/base.py b/horizon/workflows/base.py
index 1f814e112..ae39f5efa 100644
--- a/horizon/workflows/base.py
+++ b/horizon/workflows/base.py
@@ -676,9 +676,9 @@ class Workflow(html.HTMLElement):
# registered and ordered.
self.context = WorkflowContext(self)
context_seed = context_seed or {}
- clean_seed = dict([(key, val)
- for key, val in context_seed.items()
- if key in self.contributions | self.depends_on])
+ clean_seed = dict((key, val)
+ for key, val in context_seed.items()
+ if key in self.contributions | self.depends_on)
self.context_seed = clean_seed
self.context.update(clean_seed)
diff --git a/openstack_dashboard/api/neutron.py b/openstack_dashboard/api/neutron.py
index 4220d60ab..1edc038c3 100644
--- a/openstack_dashboard/api/neutron.py
+++ b/openstack_dashboard/api/neutron.py
@@ -687,13 +687,13 @@ class FloatingIpManager(object):
else:
router_ports = [p for p in ports
if p.device_owner in ROUTER_INTERFACE_OWNERS]
- reachable_subnets = set([p.fixed_ips[0]['subnet_id']
- for p in router_ports
- if p.device_id in gw_routers])
+ reachable_subnets = set(p.fixed_ips[0]['subnet_id']
+ for p in router_ports
+ if p.device_id in gw_routers)
# we have to include any shared subnets as well because we may not
# have permission to see the router interface to infer connectivity
- shared = set([s.id for n in network_list(self.request, shared=True)
- for s in n.subnets])
+ shared = set(s.id for n in network_list(self.request, shared=True)
+ for s in n.subnets)
return reachable_subnets | shared
@profiler.trace
@@ -1012,7 +1012,7 @@ def network_list(request, **params):
networks = neutronclient(request).list_networks(**params).get('networks')
# Get subnet list to expand subnet info in network list.
subnets = subnet_list(request)
- subnet_dict = dict([(s['id'], s) for s in subnets])
+ subnet_dict = dict((s['id'], s) for s in subnets)
# Expand subnet list from subnet_id to values.
for n in networks:
# Due to potential timing issues, we can't assume the subnet_dict data
@@ -1328,14 +1328,14 @@ def port_list_with_trunk_types(request, **params):
if 'tenant_id' in params:
trunk_filters['tenant_id'] = params['tenant_id']
trunks = neutronclient(request).list_trunks(**trunk_filters)['trunks']
- parent_ports = set([t['port_id'] for t in trunks])
+ parent_ports = set(t['port_id'] for t in trunks)
# Create a dict map for child ports (port ID to trunk info)
- child_ports = dict([(s['port_id'],
- {'trunk_id': t['id'],
- 'segmentation_type': s['segmentation_type'],
- 'segmentation_id': s['segmentation_id']})
- for t in trunks
- for s in t['sub_ports']])
+ child_ports = dict((s['port_id'],
+ {'trunk_id': t['id'],
+ 'segmentation_type': s['segmentation_type'],
+ 'segmentation_id': s['segmentation_id']})
+ for t in trunks
+ for s in t['sub_ports'])
def _get_port_info(port):
if port['id'] in parent_ports:
diff --git a/openstack_dashboard/dashboards/admin/floating_ips/views.py b/openstack_dashboard/dashboards/admin/floating_ips/views.py
index 39d5c53b3..5ec6dd074 100644
--- a/openstack_dashboard/dashboards/admin/floating_ips/views.py
+++ b/openstack_dashboard/dashboards/admin/floating_ips/views.py
@@ -85,13 +85,13 @@ class IndexView(tables.DataTableView):
exceptions.handle(
self.request,
_('Unable to retrieve instance list.'))
- instances_dict = dict([(obj.id, obj.name) for obj in instances])
+ instances_dict = dict((obj.id, obj.name) for obj in instances)
tenants = get_tenant_list(self.request)
tenant_dict = OrderedDict([(t.id, t) for t in tenants])
pools = get_floatingip_pools(self.request)
- pool_dict = dict([(obj.id, obj.name) for obj in pools])
+ pool_dict = dict((obj.id, obj.name) for obj in pools)
for ip in floating_ips:
ip.instance_name = instances_dict.get(ip.instance_id)
diff --git a/openstack_dashboard/dashboards/admin/images/views.py b/openstack_dashboard/dashboards/admin/images/views.py
index a4b902971..ba3974460 100644
--- a/openstack_dashboard/dashboards/admin/images/views.py
+++ b/openstack_dashboard/dashboards/admin/images/views.py
@@ -107,7 +107,7 @@ class IndexView(tables.DataTableView):
msg = _('Unable to retrieve project list.')
exceptions.handle(self.request, msg)
- tenant_dict = dict([(t.id, t.name) for t in tenants])
+ tenant_dict = dict((t.id, t.name) for t in tenants)
for image in images:
image.tenant_name = tenant_dict.get(image.owner)
diff --git a/openstack_dashboard/dashboards/admin/instances/views.py b/openstack_dashboard/dashboards/admin/instances/views.py
index 488d1c495..006185bf8 100644
--- a/openstack_dashboard/dashboards/admin/instances/views.py
+++ b/openstack_dashboard/dashboards/admin/instances/views.py
@@ -87,7 +87,7 @@ class AdminIndexView(tables.PagedTableMixin, tables.DataTableView):
# Gather our tenants to correlate against IDs
try:
tenants, __ = api.keystone.tenant_list(self.request)
- return dict([(t.id, t) for t in tenants])
+ return dict((t.id, t) for t in tenants)
except Exception:
msg = _('Unable to retrieve instance project information.')
exceptions.handle(self.request, msg)
@@ -112,7 +112,7 @@ class AdminIndexView(tables.PagedTableMixin, tables.DataTableView):
# Gather our flavors to correlate against IDs
try:
flavors = api.nova.flavor_list(self.request)
- return dict([(str(flavor.id), flavor) for flavor in flavors])
+ return dict((str(flavor.id), flavor) for flavor in flavors)
except Exception:
msg = _("Unable to retrieve flavor list.")
exceptions.handle(self.request, msg)
diff --git a/openstack_dashboard/dashboards/admin/rbac_policies/views.py b/openstack_dashboard/dashboards/admin/rbac_policies/views.py
index b517aa8ec..a0adc871d 100644
--- a/openstack_dashboard/dashboards/admin/rbac_policies/views.py
+++ b/openstack_dashboard/dashboards/admin/rbac_policies/views.py
@@ -57,7 +57,7 @@ class IndexView(tables.DataTableView):
msg = _("Unable to retrieve information about the "
"policies' networks.")
exceptions.handle(self.request, msg)
- return dict([(n.id, n.name) for n in networks])
+ return dict((n.id, n.name) for n in networks)
def _get_qos_policies(self):
qos_policies = []
@@ -69,7 +69,7 @@ class IndexView(tables.DataTableView):
msg = _("Unable to retrieve information about the "
"policies' qos policies.")
exceptions.handle(self.request, msg)
- return dict([(q.id, q.name) for q in qos_policies])
+ return dict((q.id, q.name) for q in qos_policies)
def get_data(self):
try:
diff --git a/openstack_dashboard/dashboards/admin/snapshots/views.py b/openstack_dashboard/dashboards/admin/snapshots/views.py
index 75afb30ce..9995285a6 100644
--- a/openstack_dashboard/dashboards/admin/snapshots/views.py
+++ b/openstack_dashboard/dashboards/admin/snapshots/views.py
@@ -62,7 +62,7 @@ class SnapshotsView(tables.PagedTableMixin, tables.DataTableView):
msg = _('Unable to retrieve volume project information.')
exceptions.handle(self.request, msg)
- tenant_dict = dict([(t.id, t) for t in tenants])
+ tenant_dict = dict((t.id, t) for t in tenants)
for snapshot in snapshots:
volume = volumes.get(snapshot.volume_id)
tenant_id = getattr(volume,
diff --git a/openstack_dashboard/dashboards/project/floating_ips/views.py b/openstack_dashboard/dashboards/project/floating_ips/views.py
index d9bfead9e..affbe28a3 100644
--- a/openstack_dashboard/dashboards/project/floating_ips/views.py
+++ b/openstack_dashboard/dashboards/project/floating_ips/views.py
@@ -110,7 +110,7 @@ class IndexView(tables.DataTableView):
floating_ip_pools = []
exceptions.handle(self.request,
_('Unable to retrieve floating IP pools.'))
- pool_dict = dict([(obj.id, obj.name) for obj in floating_ip_pools])
+ pool_dict = dict((obj.id, obj.name) for obj in floating_ip_pools)
attached_instance_ids = [ip.instance_id for ip in floating_ips
if ip.instance_id is not None]
@@ -126,7 +126,7 @@ class IndexView(tables.DataTableView):
exceptions.handle(self.request,
_('Unable to retrieve instance list.'))
- instances_dict = dict([(obj.id, obj.name) for obj in instances])
+ instances_dict = dict((obj.id, obj.name) for obj in instances)
for ip in floating_ips:
ip.instance_name = instances_dict.get(ip.instance_id)
diff --git a/openstack_dashboard/dashboards/project/instances/views.py b/openstack_dashboard/dashboards/project/instances/views.py
index f17da0412..07a105ff0 100644
--- a/openstack_dashboard/dashboards/project/instances/views.py
+++ b/openstack_dashboard/dashboards/project/instances/views.py
@@ -73,7 +73,7 @@ class IndexView(tables.PagedTableMixin, tables.DataTableView):
# Gather our flavors to correlate our instances to them
try:
flavors = api.nova.flavor_list(self.request)
- return dict([(str(flavor.id), flavor) for flavor in flavors])
+ return dict((str(flavor.id), flavor) for flavor in flavors)
except Exception:
exceptions.handle(self.request, ignore=True)
return {}
@@ -83,7 +83,7 @@ class IndexView(tables.PagedTableMixin, tables.DataTableView):
try:
# TODO(gabriel): Handle pagination.
images = api.glance.image_list_detailed(self.request)[0]
- return dict([(str(image.id), image) for image in images])
+ return dict((str(image.id), image) for image in images)
except Exception:
exceptions.handle(self.request, ignore=True)
return {}
diff --git a/openstack_dashboard/dashboards/project/volumes/views.py b/openstack_dashboard/dashboards/project/volumes/views.py
index 17afcb113..5c68a9e3e 100644
--- a/openstack_dashboard/dashboards/project/volumes/views.py
+++ b/openstack_dashboard/dashboards/project/volumes/views.py
@@ -88,7 +88,7 @@ class VolumeTableMixIn(object):
self.request, search_opts=search_opts)
if snapshots:
# extract out the volume ids
- volume_ids = set([(s.volume_id) for s in snapshots])
+ volume_ids = set(s.volume_id for s in snapshots)
except Exception:
exceptions.handle(self.request,
_("Unable to retrieve snapshot list."))