Skip to content

Commit 26657cd

Browse files
use even more single-letter variables in list comprehensions to avoid overwriting variables outside of list comprehensions when using Python 2
1 parent 22b9603 commit 26657cd

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

easybuild/framework/easyconfig/tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def det_easyconfig_paths(orig_paths):
334334
:return: list of paths to easyconfig files
335335
"""
336336
try:
337-
from_prs = [int(pr_nr) for pr_nr in build_option('from_pr')]
337+
from_prs = [int(x) for x in build_option('from_pr')]
338338
except ValueError:
339339
raise EasyBuildError("Argument to --from-pr must be a comma separated list of PR #s.")
340340

easybuild/tools/options.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,7 @@ def set_up_configuration(args=None, logfile=None, testing=False, silent=False):
14641464

14651465
# map list of strings --from-pr value to list of integers
14661466
try:
1467-
from_prs = [int(pr_nr) for pr_nr in eb_go.options.from_pr]
1467+
from_prs = [int(x) for x in eb_go.options.from_pr]
14681468
except ValueError:
14691469
raise EasyBuildError("Argument to --from-pr must be a comma separated list of PR #s.")
14701470

@@ -1500,7 +1500,7 @@ def set_up_configuration(args=None, logfile=None, testing=False, silent=False):
15001500
# done here instead of in _postprocess_include because github integration requires build_options to be initialized
15011501
if eb_go.options.include_easyblocks_from_pr:
15021502
try:
1503-
easyblock_prs = [int(pr_nr) for pr_nr in eb_go.options.include_easyblocks_from_pr]
1503+
easyblock_prs = [int(x) for x in eb_go.options.include_easyblocks_from_pr]
15041504
except ValueError:
15051505
raise EasyBuildError("Argument to --include-easyblocks-from-pr must be a comma separated list of PR #s.")
15061506

easybuild/tools/testing.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def create_test_report(msg, ecs_with_res, init_session_state, pr_nrs=None, gist_
151151
test_report = []
152152
if pr_nrs is not None:
153153
repo = pr_target_repo or GITHUB_EASYCONFIGS_REPO
154-
pr_urls = ["https://github.com/%s/%s/pull/%s" % (pr_target_account, repo, pr_nr) for pr_nr in pr_nrs]
154+
pr_urls = ["https://github.com/%s/%s/pull/%s" % (pr_target_account, repo, x) for x in pr_nrs]
155155
test_report.extend([
156156
"Test report for %s" % ', '.join(pr_urls),
157157
"",
@@ -193,7 +193,7 @@ def create_test_report(msg, ecs_with_res, init_session_state, pr_nrs=None, gist_
193193
descr = "(partial) EasyBuild log for failed build of %s" % ec['spec']
194194

195195
if pr_nrs is not None:
196-
descr += " (PR #%s)" % ', #'.join(str(pr_nr) for pr_nr in pr_nrs)
196+
descr += " (PR #%s)" % ', #'.join(str(x) for x in pr_nrs)
197197

198198
if easyblock_pr_nrs:
199199
descr += "".join(" (easyblock PR #%s)" % nr for nr in easyblock_pr_nrs)
@@ -295,7 +295,7 @@ def post_pr_test_report(pr_nr, repo_type, test_report, msg, init_session_state,
295295

296296
if build_option('include_easyblocks_from_pr'):
297297
if repo_type == GITHUB_EASYCONFIGS_REPO:
298-
easyblocks_pr_nrs = [int(eb_pr_nr) for eb_pr_nr in build_option('include_easyblocks_from_pr')]
298+
easyblocks_pr_nrs = [int(x) for x in build_option('include_easyblocks_from_pr')]
299299
comment_lines.append("Using easyblocks from PR(s) %s" %
300300
", ".join(["https://github.com/%s/%s/pull/%s" %
301301
(pr_target_account, GITHUB_EASYBLOCKS_REPO, easyblocks_pr_nr)
@@ -333,12 +333,12 @@ def overall_test_report(ecs_with_res, orig_cnt, success, msg, init_session_state
333333
dump_path = build_option('dump_test_report')
334334

335335
try:
336-
pr_nrs = [int(pr_nr) for pr_nr in build_option('from_pr')]
336+
pr_nrs = [int(x) for x in build_option('from_pr')]
337337
except ValueError:
338338
raise EasyBuildError("Argument to --from-pr must be a comma separated list of PR #s.")
339339

340340
try:
341-
easyblock_pr_nrs = [int(pr_nr) for pr_nr in build_option('include_easyblocks_from_pr')]
341+
easyblock_pr_nrs = [int(x) for x in build_option('include_easyblocks_from_pr')]
342342
except ValueError:
343343
raise EasyBuildError("Argument to --include-easyblocks-from-pr must be a comma separated list of PR #s.")
344344

0 commit comments

Comments
 (0)