fix flake8 issues

Fixes the following flake8 issues:

- import shadowed by loop variable (flake8 F402)
- list comprehension redefines 'role_ref' (flake8 F812)

Change-Id: Ida64ccc9d7ee8b2ecd110a908615d3a94e93785c
This commit is contained in:
Christoph Gysin 2014-06-17 18:33:11 +03:00
parent 21bf6c7fda
commit fcc29504b2
5 changed files with 14 additions and 14 deletions

View File

@ -574,7 +574,7 @@ class RoleApi(common_ldap.BaseLdap):
except ldap.NO_SUCH_OBJECT:
roles = []
res = []
for role_dn, _ in roles:
for role_dn, _role_attrs in roles:
# ldap.dn.dn2str returns an array, where the first
# element is the first segment.
# For a role assignment, this contains the role ID,
@ -608,7 +608,7 @@ class RoleApi(common_ldap.BaseLdap):
conn.unbind_s()
res = []
for role_dn, _ in roles:
for role_dn, _role_attrs in roles:
# ldap.dn.str2dn returns a list, where the first
# element is the first RDN.
# For a role assignment, this contains the role ID,

View File

@ -15,7 +15,7 @@
import six
import sqlalchemy
from keystone import assignment
from keystone import assignment as keystone_assignment
from keystone import clean
from keystone.common import sql
from keystone import config
@ -33,7 +33,7 @@ class AssignmentType:
GROUP_DOMAIN = 'GroupDomain'
class Assignment(assignment.Driver):
class Assignment(keystone_assignment.Driver):
def _get_project(self, session, project_id):
project_ref = session.query(Project).get(project_id)

View File

@ -640,7 +640,7 @@ class IdentityTests(object):
tenant_id=project_ref['id'])
self.assertEqual(set(role_list),
set([role_ref['id'] for role_ref in role_ref_list]))
set([r['id'] for r in role_ref_list]))
def test_get_role_by_user_and_project(self):
roles_ref = self.assignment_api.get_roles_for_user_and_project(

View File

@ -19,7 +19,7 @@ from keystoneclient.common import cms
import six
from testtools import matchers
from keystone.common import extension
from keystone.common import extension as keystone_extension
from keystone import config
from keystone.tests import rest
@ -110,13 +110,13 @@ class CoreApiTests(object):
def test_public_extensions(self):
r = self.public_request(path='/v2.0/extensions')
self.assertValidExtensionListResponse(r,
extension.PUBLIC_EXTENSIONS)
self.assertValidExtensionListResponse(
r, keystone_extension.PUBLIC_EXTENSIONS)
def test_admin_extensions(self):
r = self.admin_request(path='/v2.0/extensions')
self.assertValidExtensionListResponse(r,
extension.ADMIN_EXTENSIONS)
self.assertValidExtensionListResponse(
r, keystone_extension.ADMIN_EXTENSIONS)
def test_admin_extensions_404(self):
self.admin_request(path='/v2.0/extensions/invalid-extension',
@ -128,8 +128,8 @@ class CoreApiTests(object):
def test_admin_osksadm_extension(self):
r = self.admin_request(path='/v2.0/extensions/OS-KSADM')
self.assertValidExtensionResponse(r,
extension.ADMIN_EXTENSIONS)
self.assertValidExtensionResponse(
r, keystone_extension.ADMIN_EXTENSIONS)
def test_authenticate(self):
r = self.public_request(

View File

@ -20,7 +20,7 @@ import copy
from keystone.common import kvs
from keystone import exception
from keystone.openstack.common import timeutils
from keystone import trust
from keystone import trust as keystone_trust
def _filter_trust(ref):
@ -37,7 +37,7 @@ def _filter_trust(ref):
return ref
class Trust(kvs.Base, trust.Driver):
class Trust(kvs.Base, keystone_trust.Driver):
def create_trust(self, trust_id, trust, roles):
trust_ref = copy.deepcopy(trust)
trust_ref['id'] = trust_id