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
}
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)
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):
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):
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):
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):
# F841,H302,H305,H307,H405
-ignore = E251,E265,F402,H302,H305,H307,H402,H405,H803,H904
+ignore = E251,E265,H302,H305,H307,H402,H405,H803,H904
builtins = _
exclude = .git,.venv,.tox,dist,tools,doc,common,*egg,build