11#
2- # Copyright 2011-2023 Ghent University
2+ # Copyright 2011-2024 Ghent University
33#
44# This file is part of EasyBuild,
55# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
@@ -90,7 +90,7 @@ def set_columns(cols=None):
9090 pass
9191
9292 if cols is not None :
93- os .environ ['COLUMNS' ] = "%s" % cols
93+ os .environ ['COLUMNS' ] = str ( cols )
9494
9595
9696def what_str_list_tuple (name ):
@@ -199,7 +199,8 @@ class ExtOption(CompleterOption):
199199 ALWAYS_TYPED_ACTIONS = Option .ALWAYS_TYPED_ACTIONS + EXTOPTION_EXTRA_OPTIONS
200200
201201 TYPE_STRLIST = ['%s%s' % (name , klass ) for klass in ['list' , 'tuple' ] for name in ['str' , 'path' ]]
202- TYPE_CHECKER = dict ([(x , check_str_list_tuple ) for x in TYPE_STRLIST ] + list (Option .TYPE_CHECKER .items ()))
202+ TYPE_CHECKER = {x : check_str_list_tuple for x in TYPE_STRLIST }
203+ TYPE_CHECKER .update (Option .TYPE_CHECKER )
203204 TYPES = tuple (TYPE_STRLIST + list (Option .TYPES ))
204205 BOOLEAN_ACTIONS = ('store_true' , 'store_false' ,) + EXTOPTION_LOG
205206
@@ -807,7 +808,7 @@ def get_env_options(self):
807808 epilogprefixtxt += "eg. --some-opt is same as setting %(prefix)s_SOME_OPT in the environment."
808809 self .epilog .append (epilogprefixtxt % {'prefix' : self .envvar_prefix })
809810
810- candidates = dict ([( k , v ) for k , v in os .environ .items () if k .startswith ("%s_" % self .envvar_prefix )])
811+ candidates = { k : v for k , v in os .environ .items () if k .startswith ("%s_" % self .envvar_prefix )}
811812
812813 for opt in self ._get_all_options ():
813814 if opt ._long_opts is None :
@@ -822,8 +823,8 @@ def get_env_options(self):
822823 self .environment_arguments .append ("%s=%s" % (lo , val ))
823824 else :
824825 # interpretation of values: 0/no/false means: don't set it
825- if ( "%s" % val ).lower () not in ("0" , "no" , "false" ,):
826- self .environment_arguments .append ("%s" % lo )
826+ if str ( val ).lower () not in ("0" , "no" , "false" ,):
827+ self .environment_arguments .append (str ( lo ) )
827828 else :
828829 self .log .debug ("Environment variable %s is not set" % env_opt_name )
829830
@@ -1031,7 +1032,7 @@ def main_options(self):
10311032 # make_init is deprecated
10321033 if hasattr (self , 'make_init' ):
10331034 self .log .debug ('main_options: make_init is deprecated. Rename function to main_options.' )
1034- getattr ( self , ' make_init' ) ()
1035+ self . make_init ()
10351036 else :
10361037 # function names which end with _options and do not start with main or _
10371038 reg_main_options = re .compile ("^(?!_|main).*_options$" )
@@ -1189,7 +1190,7 @@ def add_group_parser(self, opt_dict, description, prefix=None, otherdefaults=Non
11891190 for extra_detail in details [4 :]:
11901191 if isinstance (extra_detail , (list , tuple ,)):
11911192 # choices
1192- nameds ['choices' ] = ["%s" % x for x in extra_detail ] # force to strings
1193+ nameds ['choices' ] = [str ( x ) for x in extra_detail ] # force to strings
11931194 hlp += ' (choices: %s)' % ', ' .join (nameds ['choices' ])
11941195 elif isinstance (extra_detail , string_type ) and len (extra_detail ) == 1 :
11951196 args .insert (0 , "-%s" % extra_detail )
0 commit comments