Enable F402 checks and fix violations
This change enables F402 hacking check and fixes all violations found. [F402] import module from line N shadowed by loop variable Basically this rule tries to avoid loop variables using the same name as imported module, for example: from cinder import volume ... for volume in volumes: ... Change-Id: Ie3010616ca87fda113d452fe684e6cff3d5fd978
This commit is contained in:
parent
03884b3d64
commit
3accff25db
|
@ -38,9 +38,9 @@ class UsedLimitsController(wsgi.Controller):
|
|||
}
|
||||
|
||||
used_limits = {}
|
||||
for display_name, quota in quota_map.iteritems():
|
||||
if quota in quotas:
|
||||
used_limits[display_name] = quotas[quota]['in_use']
|
||||
for display_name, single_quota in quota_map.iteritems():
|
||||
if single_quota in quotas:
|
||||
used_limits[display_name] = quotas[single_quota]['in_use']
|
||||
|
||||
resp_obj.obj['limits']['absolute'].update(used_limits)
|
||||
|
||||
|
|
|
@ -47,8 +47,8 @@ class VolumeHostAttributeController(wsgi.Controller):
|
|||
context = req.environ['cinder.context']
|
||||
if authorize(context):
|
||||
resp_obj.attach(xml=VolumeListHostAttributeTemplate())
|
||||
for volume in list(resp_obj.obj['volumes']):
|
||||
self._add_volume_host_attribute(context, req, volume)
|
||||
for vol in list(resp_obj.obj['volumes']):
|
||||
self._add_volume_host_attribute(context, req, vol)
|
||||
|
||||
|
||||
class Volume_host_attribute(extensions.ExtensionDescriptor):
|
||||
|
|
|
@ -76,9 +76,9 @@ class VolumeImageMetadataController(wsgi.Controller):
|
|||
if authorize(context):
|
||||
resp_obj.attach(xml=VolumesImageMetadataTemplate())
|
||||
all_meta = self._get_all_images_metadata(context)
|
||||
for volume in list(resp_obj.obj.get('volumes', [])):
|
||||
image_meta = all_meta.get(volume['id'], {})
|
||||
self._add_image_metadata(context, volume, image_meta)
|
||||
for vol in list(resp_obj.obj.get('volumes', [])):
|
||||
image_meta = all_meta.get(vol['id'], {})
|
||||
self._add_image_metadata(context, vol, image_meta)
|
||||
|
||||
|
||||
class Volume_image_metadata(extensions.ExtensionDescriptor):
|
||||
|
|
|
@ -48,8 +48,8 @@ class VolumeMigStatusAttributeController(wsgi.Controller):
|
|||
context = req.environ['cinder.context']
|
||||
if authorize(context):
|
||||
resp_obj.attach(xml=VolumeListMigStatusAttributeTemplate())
|
||||
for volume in list(resp_obj.obj['volumes']):
|
||||
self._add_volume_mig_status_attribute(req, context, volume)
|
||||
for vol in list(resp_obj.obj['volumes']):
|
||||
self._add_volume_mig_status_attribute(req, context, vol)
|
||||
|
||||
|
||||
class Volume_mig_status_attribute(extensions.ExtensionDescriptor):
|
||||
|
|
|
@ -45,8 +45,8 @@ class VolumeTenantAttributeController(wsgi.Controller):
|
|||
context = req.environ['cinder.context']
|
||||
if authorize(context):
|
||||
resp_obj.attach(xml=VolumeListTenantAttributeTemplate())
|
||||
for volume in list(resp_obj.obj['volumes']):
|
||||
self._add_volume_tenant_attribute(context, req, volume)
|
||||
for vol in list(resp_obj.obj['volumes']):
|
||||
self._add_volume_tenant_attribute(context, req, vol)
|
||||
|
||||
|
||||
class Volume_tenant_attribute(extensions.ExtensionDescriptor):
|
||||
|
|
Loading…
Reference in New Issue