Skip to content

Commit

Permalink
Rename loop control variables not used within loop body
Browse files Browse the repository at this point in the history
  • Loading branch information
lwesterhof committed Aug 1, 2024
1 parent c2ab3c2 commit 4681a84
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ def validate_data(ctx, data, allow_update):
can_add_category = user.is_member_of(ctx, 'priv-category-add')
is_admin = user.is_admin(ctx)

for (category, subcategory, groupname, managers, members, viewers, _, _) in data:
for (category, subcategory, groupname, _managers, _members, _viewers, _schema_id, _expiration_date) in data:

if group.exists(ctx, groupname) and not allow_update:
errors.append('Group "{}" already exists'.format(groupname))
Expand Down Expand Up @@ -739,7 +739,7 @@ def provisionExternalUser(ctx, username, creatorUser, creatorZone):
eus_api_secret},
timeout=10,
verify=eus_api_tls_verify)
except requests.ConnectionError or requests.ConnectTimeout:
except (requests.ConnectionError, requests.ConnectTimeout):
return -1

return response.status_code
Expand Down
6 changes: 3 additions & 3 deletions revisions.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def api_revisions_search_on_filename(ctx, searchString, offset=0, limit=10):
"AND META_DATA_ATTR_VALUE = '" + rev_data['main_original_dataname'] + "' ", # *originalDataName
genquery.AS_DICT, ctx)

for row in iter:
for _row in iter:
# Data is collected on the basis of ORG_COLL_NAME, duplicates can be present
try:
# This is a double entry and has to be corrected in the total returned to the frontend
Expand Down Expand Up @@ -468,7 +468,7 @@ def remove_revision_error_flag(ctx, data_id, path, errorattr):
"DATA_ID = '{}' AND META_DATA_ATTR_NAME = '{}' AND META_DATA_ATTR_VALUE = 'true'".format(data_id, errorattr),
genquery.AS_LIST, ctx
)
for row in iter2:
for _row in iter2:
# Only try to remove it if we know for sure it exists,
# otherwise we get useless errors in the log.
avu.rmw_from_data(ctx, path, errorattr, "%")
Expand Down Expand Up @@ -867,7 +867,7 @@ def get_original_exists_dict(ctx, revision_data):
"""
result = dict()
for data_object_data in revision_data:
for (data_id, timestamp, revision_path) in data_object_data:
for (_data_id, _timestamp, revision_path) in data_object_data:

try:
result[revision_path] = versioned_data_object_exists(ctx, revision_path)
Expand Down
10 changes: 5 additions & 5 deletions schema_transformations.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""JSON schema transformation functions."""

__copyright__ = 'Copyright (c) 2019-2023, Utrecht University'
__copyright__ = 'Copyright (c) 2019-2024, Utrecht University'
__license__ = 'GPLv3, see LICENSE'

import re
Expand Down Expand Up @@ -581,13 +581,13 @@ def _hptlab0_hptlab1(ctx, m):
try:
for item_search in m[attribute]:
found = False
for i, elem in enumerate(reference_list):
for _i, elem in enumerate(reference_list):
if item_search.lower() in elem.lower():
found = True
new_list.append(elem)
break
if not found:
for i, elem in enumerate(reference_list):
for _i, elem in enumerate(reference_list):
# Split on ' ' an compare based on the first token
if item_search.split(' ')[0].lower() in elem.lower():
found = True
Expand Down Expand Up @@ -641,13 +641,13 @@ def _teclab0_teclab1(ctx, m):
try:
for item_search in m[attribute]:
found = False
for i, elem in enumerate(reference_list):
for _i, elem in enumerate(reference_list):
if item_search.lower() in elem.lower():
found = True
new_list.append(elem)
break
if not found:
for i, elem in enumerate(reference_list):
for _i, elem in enumerate(reference_list):
# Split on ' ' an compare based on the first token
if item_search.split(' ')[0].lower() in elem.lower():
found = True
Expand Down
4 changes: 2 additions & 2 deletions vault_archive.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Functions to archive vault data packages."""

__copyright__ = 'Copyright (c) 2023, Utrecht University'
__copyright__ = 'Copyright (c) 2023-2024, Utrecht University'
__license__ = 'GPLv3, see LICENSE'

import json
Expand Down Expand Up @@ -87,7 +87,7 @@ def vault_archivable(ctx, coll):
return True

if not coll.endswith("/original"):
for row in genquery.row_iterator("META_COLL_ATTR_VALUE",
for _row in genquery.row_iterator("META_COLL_ATTR_VALUE",
"META_COLL_ATTR_NAME = 'org_vault_status' AND COLL_NAME = '{}'".format(coll),
genquery.AS_LIST,
ctx):
Expand Down
7 changes: 4 additions & 3 deletions vault_download.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Functions to download vault data packages."""

__copyright__ = 'Copyright (c) 2023, Utrecht University'
__copyright__ = 'Copyright (c) 2023-2024, Utrecht University'
__license__ = 'GPLv3, see LICENSE'

import genquery
Expand All @@ -18,12 +18,13 @@
def vault_downloadable(ctx, coll):
if coll.endswith("/original"):
return False
for row in genquery.row_iterator("DATA_SIZE",

for _row in genquery.row_iterator("DATA_SIZE",
"COLL_NAME = '{}' AND DATA_NAME = 'download.zip'".format(coll),
genquery.AS_LIST,
ctx):
return False
for row in genquery.row_iterator("META_COLL_ATTR_VALUE",
for _row in genquery.row_iterator("META_COLL_ATTR_VALUE",
"META_COLL_ATTR_NAME = 'org_vault_status' AND COLL_NAME = '{}'".format(coll),
genquery.AS_LIST,
ctx):
Expand Down

0 comments on commit 4681a84

Please sign in to comment.