Skip to content

Commit 0cb9a80

Browse files
committed
Use fstrings
1 parent 5efd4ed commit 0cb9a80

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

easybuild/framework/easyblock.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
630630
if isinstance(ext_options, dict):
631631
ext_options.update(ext[2])
632632
else:
633-
raise EasyBuildError("Unexpected type (non-dict) for 3rd element of %s", ext)
633+
raise EasyBuildError(f"Unexpected type (non-dict) for 3rd element of {ext}")
634634
elif len(ext) > 3:
635635
raise EasyBuildError('Extension specified in unknown format (list/tuple too long)')
636636

@@ -666,8 +666,8 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
666666
if len(sources) == 1:
667667
source = sources[0]
668668
else:
669-
error_msg = "'sources' spec for %s in exts_list must be single element list. Is: %s"
670-
raise EasyBuildError(error_msg, ext_name, sources)
669+
raise EasyBuildError(f"'sources' spec for {ext_name} in exts_list must be single element list."
670+
f" Is: {sources}")
671671
else:
672672
source = sources
673673

@@ -676,7 +676,7 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
676676
if isinstance(source, str):
677677
source = {'filename': source}
678678
elif not isinstance(source, dict):
679-
raise EasyBuildError("Incorrect value type for source of extension %s: %s", ext_name, source)
679+
raise EasyBuildError(f"Incorrect value type for source of extension {ext_name}: {source}")
680680

681681
# if no custom source URLs are specified in sources spec,
682682
# inject the ones specified for this extension
@@ -701,8 +701,8 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
701701
# use default template for name of source file if none is specified
702702
src_fn = '%(name)s-%(version)s.tar.gz'
703703
elif not isinstance(src_fn, str):
704-
error_msg = "source_tmpl value must be a string! (found value of type '%s'): %s"
705-
raise EasyBuildError(error_msg, type(src_fn).__name__, src_fn)
704+
raise EasyBuildError("source_tmpl value must be a string! "
705+
f"(found value of type '{type(src_fn).__name__}'): {src_fn}")
706706

707707
src_fn = resolve_template(src_fn, template_values)
708708

@@ -713,7 +713,7 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
713713
if src_path:
714714
ext_src.update({'src': src_path})
715715
else:
716-
raise EasyBuildError("Source for extension %s not found.", ext)
716+
raise EasyBuildError(f"Source for extension {ext} not found.")
717717

718718
# verify checksum for extension sources
719719
if verify_checksums and 'src' in ext_src:
@@ -732,10 +732,10 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
732732
if verify_checksum(src_path, fn_checksum, src_checksums):
733733
self.log.info('Checksum for extension source %s verified', src_fn)
734734
elif build_option('ignore_checksums'):
735-
print_warning("Ignoring failing checksum verification for %s" % src_fn)
735+
print_warning(f"Ignoring failing checksum verification for {src_fn}")
736736
else:
737737
raise EasyBuildError(
738-
'Checksum verification for extension source %s failed', src_fn,
738+
f'Checksum verification for extension source {src_fn} failed',
739739
exit_code=EasyBuildExit.FAIL_CHECKSUM
740740
)
741741

@@ -770,14 +770,14 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
770770
if verify_checksum(patch, checksum, computed_checksums[patch]):
771771
self.log.info('Checksum for extension patch %s verified', patch_fn)
772772
elif build_option('ignore_checksums'):
773-
print_warning("Ignoring failing checksum verification for %s" % patch_fn)
773+
print_warning(f"Ignoring failing checksum verification for {patch_fn}")
774774
else:
775775
raise EasyBuildError(
776-
"Checksum verification for extension patch %s failed", patch_fn,
776+
f"Checksum verification for extension patch {patch_fn} failed",
777777
exit_code=EasyBuildExit.FAIL_CHECKSUM
778778
)
779779
else:
780-
self.log.debug('No patches found for extension %s.' % ext_name)
780+
self.log.debug('No patches found for extension %s.', ext_name)
781781

782782
exts_sources.append(ext_src)
783783

0 commit comments

Comments
 (0)