[Trivial]Remove unused variables
This is to remove unused variables and to use merging-isinstance.
Change-Id: I9d7121678a8b18a03b7b872526bfc74351560776
diff --git a/tempest/cmd/account_generator.py b/tempest/cmd/account_generator.py
index ff552a1..917262e 100755
--- a/tempest/cmd/account_generator.py
+++ b/tempest/cmd/account_generator.py
@@ -270,7 +270,7 @@
config.CONF.set_config_path(parsed_args.config_file)
setup_logging()
resources = []
- for count in range(parsed_args.concurrency):
+ for _ in range(parsed_args.concurrency):
# Use N different cred_providers to obtain different
# sets of creds
cred_provider = get_credential_provider(parsed_args)
diff --git a/tempest/lib/auth.py b/tempest/lib/auth.py
index 3fee489..7c279ab 100644
--- a/tempest/lib/auth.py
+++ b/tempest/lib/auth.py
@@ -391,7 +391,7 @@
"""
if auth_data is None:
auth_data = self.get_auth()
- token, _auth_data = auth_data
+ _, _auth_data = auth_data
service = filters.get('service')
region = filters.get('region')
name = filters.get('name')
@@ -524,7 +524,7 @@
"""
if auth_data is None:
auth_data = self.get_auth()
- token, _auth_data = auth_data
+ _, _auth_data = auth_data
service = filters.get('service')
region = filters.get('region')
name = filters.get('name')
diff --git a/tempest/lib/cmd/check_uuid.py b/tempest/lib/cmd/check_uuid.py
index b34066f..ff09671 100755
--- a/tempest/lib/cmd/check_uuid.py
+++ b/tempest/lib/cmd/check_uuid.py
@@ -225,8 +225,7 @@
def _add_import_for_test_uuid(self, patcher, src_parsed, source_path):
import_list = [node for node in src_parsed.body
- if isinstance(node, ast.Import) or
- isinstance(node, ast.ImportFrom)]
+ if isinstance(node, (ast.Import, ast.ImportFrom))]
if not import_list:
print("(WARNING) %s: The file is not valid as it does not contain "
diff --git a/tempest/lib/common/rest_client.py b/tempest/lib/common/rest_client.py
index 0513e90..b47b511 100644
--- a/tempest/lib/common/rest_client.py
+++ b/tempest/lib/common/rest_client.py
@@ -507,7 +507,7 @@
if not hasattr(body, "keys") or len(body.keys()) != 1:
return body
# Just return the "wrapped" element
- first_key, first_item = six.next(six.iteritems(body))
+ _, first_item = six.next(six.iteritems(body))
if isinstance(first_item, (dict, list)):
return first_item
except (ValueError, IndexError):
diff --git a/tempest/lib/common/utils/data_utils.py b/tempest/lib/common/utils/data_utils.py
index 7f94612..44b55eb 100644
--- a/tempest/lib/common/utils/data_utils.py
+++ b/tempest/lib/common/utils/data_utils.py
@@ -129,7 +129,7 @@
:rtype: string
"""
guid = []
- for i in range(8):
+ for _ in range(8):
guid.append("%02x" % random.randint(0x00, 0xff))
return ':'.join(guid)
diff --git a/tempest/lib/services/identity/v3/groups_client.py b/tempest/lib/services/identity/v3/groups_client.py
index f823b21..2cfb24a 100644
--- a/tempest/lib/services/identity/v3/groups_client.py
+++ b/tempest/lib/services/identity/v3/groups_client.py
@@ -110,6 +110,6 @@
def check_group_user_existence(self, group_id, user_id):
"""Check user in group."""
- resp, body = self.head('groups/%s/users/%s' % (group_id, user_id))
+ resp, _ = self.head('groups/%s/users/%s' % (group_id, user_id))
self.expected_success(204, resp.status)
return rest_client.ResponseBody(resp)
diff --git a/tempest/lib/services/identity/v3/inherited_roles_client.py b/tempest/lib/services/identity/v3/inherited_roles_client.py
index 3949437..f937ed6 100644
--- a/tempest/lib/services/identity/v3/inherited_roles_client.py
+++ b/tempest/lib/services/identity/v3/inherited_roles_client.py
@@ -51,7 +51,7 @@
def check_user_inherited_project_role_on_domain(
self, domain_id, user_id, role_id):
"""Checks whether a user has an inherited project role on a domain."""
- resp, body = self.head(
+ resp, _ = self.head(
"OS-INHERIT/domains/%s/users/%s/roles/%s/inherited_to_projects"
% (domain_id, user_id, role_id))
self.expected_success(204, resp.status)
@@ -88,7 +88,7 @@
def check_group_inherited_project_role_on_domain(
self, domain_id, group_id, role_id):
"""Checks whether a group has an inherited project role on a domain."""
- resp, body = self.head(
+ resp, _ = self.head(
"OS-INHERIT/domains/%s/groups/%s/roles/%s/inherited_to_projects"
% (domain_id, group_id, role_id))
self.expected_success(204, resp.status)
@@ -115,7 +115,7 @@
def check_user_has_flag_on_inherited_to_project(
self, project_id, user_id, role_id):
"""Check if user has an inherited project role on project"""
- resp, body = self.head(
+ resp, _ = self.head(
"OS-INHERIT/projects/%s/users/%s/roles/%s/inherited_to_projects"
% (project_id, user_id, role_id))
self.expected_success(204, resp.status)
@@ -142,7 +142,7 @@
def check_group_has_flag_on_inherited_to_project(
self, project_id, group_id, role_id):
"""Check if group has an inherited project role on project"""
- resp, body = self.head(
+ resp, _ = self.head(
"OS-INHERIT/projects/%s/groups/%s/roles/%s/inherited_to_projects"
% (project_id, group_id, role_id))
self.expected_success(204, resp.status)
diff --git a/tempest/lib/services/identity/v3/oauth_token_client.py b/tempest/lib/services/identity/v3/oauth_token_client.py
index 6ca401b..722deca 100644
--- a/tempest/lib/services/identity/v3/oauth_token_client.py
+++ b/tempest/lib/services/identity/v3/oauth_token_client.py
@@ -71,7 +71,7 @@
normalized_params = '&'.join(parameter_parts)
# normalize_uri
- scheme, netloc, path, params, query, fragment = urlparse.urlparse(uri)
+ scheme, netloc, path, params, _, _ = urlparse.urlparse(uri)
scheme = scheme.lower()
netloc = netloc.lower()
path = path.replace('//', '/')
diff --git a/tempest/lib/services/identity/v3/roles_client.py b/tempest/lib/services/identity/v3/roles_client.py
index f9356be..0d7593a 100644
--- a/tempest/lib/services/identity/v3/roles_client.py
+++ b/tempest/lib/services/identity/v3/roles_client.py
@@ -122,16 +122,16 @@
def check_user_role_existence_on_project(self, project_id,
user_id, role_id):
"""Check role of a user on a project."""
- resp, body = self.head('projects/%s/users/%s/roles/%s' %
- (project_id, user_id, role_id))
+ resp, _ = self.head('projects/%s/users/%s/roles/%s' %
+ (project_id, user_id, role_id))
self.expected_success(204, resp.status)
return rest_client.ResponseBody(resp)
def check_user_role_existence_on_domain(self, domain_id,
user_id, role_id):
"""Check role of a user on a domain."""
- resp, body = self.head('domains/%s/users/%s/roles/%s' %
- (domain_id, user_id, role_id))
+ resp, _ = self.head('domains/%s/users/%s/roles/%s' %
+ (domain_id, user_id, role_id))
self.expected_success(204, resp.status)
return rest_client.ResponseBody(resp)
@@ -182,16 +182,16 @@
def check_role_from_group_on_project_existence(self, project_id,
group_id, role_id):
"""Check role of a group on a project."""
- resp, body = self.head('projects/%s/groups/%s/roles/%s' %
- (project_id, group_id, role_id))
+ resp, _ = self.head('projects/%s/groups/%s/roles/%s' %
+ (project_id, group_id, role_id))
self.expected_success(204, resp.status)
return rest_client.ResponseBody(resp)
def check_role_from_group_on_domain_existence(self, domain_id,
group_id, role_id):
"""Check role of a group on a domain."""
- resp, body = self.head('domains/%s/groups/%s/roles/%s' %
- (domain_id, group_id, role_id))
+ resp, _ = self.head('domains/%s/groups/%s/roles/%s' %
+ (domain_id, group_id, role_id))
self.expected_success(204, resp.status)
return rest_client.ResponseBody(resp)
@@ -232,14 +232,14 @@
def check_role_inference_rule(self, prior_role, implies_role):
"""Check a role inference rule."""
- resp, body = self.head('roles/%s/implies/%s' %
- (prior_role, implies_role))
+ resp, _ = self.head('roles/%s/implies/%s' %
+ (prior_role, implies_role))
self.expected_success(204, resp.status)
return rest_client.ResponseBody(resp)
def delete_role_inference_rule(self, prior_role, implies_role):
"""Delete a role inference rule."""
- resp, body = self.delete('roles/%s/implies/%s' %
- (prior_role, implies_role))
+ resp, _ = self.delete('roles/%s/implies/%s' %
+ (prior_role, implies_role))
self.expected_success(204, resp.status)
return rest_client.ResponseBody(resp)
diff --git a/tempest/lib/services/volume/v1/volumes_client.py b/tempest/lib/services/volume/v1/volumes_client.py
index 4ed5eb1..2efb0da 100644
--- a/tempest/lib/services/volume/v1/volumes_client.py
+++ b/tempest/lib/services/volume/v1/volumes_client.py
@@ -302,5 +302,5 @@
def retype_volume(self, volume_id, **kwargs):
"""Updates volume with new volume type."""
post_body = json.dumps({'os-retype': kwargs})
- resp, body = self.post('volumes/%s/action' % volume_id, post_body)
+ resp, _ = self.post('volumes/%s/action' % volume_id, post_body)
self.expected_success(202, resp.status)