Skip to content

Commit 6d15cd6

Browse files
committed
Run autopep8 in agressive 1 mode
1 parent ead7dda commit 6d15cd6

File tree

17 files changed

+31
-32
lines changed

17 files changed

+31
-32
lines changed

easybuild/tools/configobj.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,7 @@ def _parse(self, infile):
16031603
try:
16041604
value = unrepr(value)
16051605
except Exception as e:
1606-
if type(e) == UnknownType:
1606+
if isinstance(e, UnknownType):
16071607
msg = 'Unknown name or type in value at line %s.'
16081608
else:
16091609
msg = 'Parse error in value at line %s.'

easybuild/tools/containers/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def check_tool(tool_name, min_tool_version=None):
7878
out, ec = run_cmd(version_cmd, simple=False, trace=False, force_in_dry_run=True)
7979
if ec:
8080
raise EasyBuildError("Error running '{0}' for tool {1} with output: {2}".format(version_cmd, tool_name, out))
81-
res = re.search("\d+\.\d+(\.\d+)?", out.strip())
81+
res = re.search(r"\d+\.\d+(\.\d+)?", out.strip())
8282
if not res:
8383
raise EasyBuildError("Error parsing version for tool {0}".format(tool_name))
8484
tool_version = res.group(0)

easybuild/tools/docs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ def list_software(output_format=FORMAT_TXT, detailed=False, only_installed=False
522522

523523
ecs.append(ec)
524524
print_msg('\r', prefix=False, newline=False, silent=silent)
525-
print_msg("Processed %d/%d easyconfigs..." % (idx+1, cnt), newline=False, silent=silent)
525+
print_msg("Processed %d/%d easyconfigs..." % (idx + 1, cnt), newline=False, silent=silent)
526526
print_msg('', prefix=False, silent=silent)
527527

528528
software = {}
@@ -902,7 +902,7 @@ def gen_easyblock_doc_section_rst(eb_class, path_to_examples, common_params, doc
902902
'.. _' + classname + ':',
903903
'',
904904
'``' + classname + '``',
905-
'=' * (len(classname)+4),
905+
'=' * (len(classname) + 4),
906906
'',
907907
]
908908

@@ -967,7 +967,7 @@ def gen_easyblock_doc_section_rst(eb_class, path_to_examples, common_params, doc
967967
if os.path.exists(os.path.join(path_to_examples, '%s.eb' % classname)):
968968
title = 'Example easyconfig for ``' + classname + '`` easyblock'
969969
doc.extend([title, '-' * len(title), '', '.. code::', ''])
970-
for line in read_file(os.path.join(path_to_examples, classname+'.eb')).split('\n'):
970+
for line in read_file(os.path.join(path_to_examples, classname + '.eb')).split('\n'):
971971
doc.append(INDENT_4SPACES + line)
972972
doc.append('') # empty line after literal block
973973

easybuild/tools/github.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ def find_software_name_for_patch(patch_name, ec_dirs):
10101010
break
10111011
except EasyBuildError as err:
10121012
_log.debug("Ignoring easyconfig %s that fails to parse: %s", path, err)
1013-
sys.stdout.write('\r%s of %s easyconfigs checked' % (idx+1, nr_of_ecs))
1013+
sys.stdout.write('\r%s of %s easyconfigs checked' % (idx + 1, nr_of_ecs))
10141014
sys.stdout.flush()
10151015

10161016
sys.stdout.write('\n')

easybuild/tools/include.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def verify_imports(pymods, pypkg, from_path):
143143

144144
def is_software_specific_easyblock(module):
145145
"""Determine whether Python module at specified location is a software-specific easyblock."""
146-
return bool(re.search('^class EB_.*\(.*\):\s*$', read_file(module), re.M))
146+
return bool(re.search(r'^class EB_.*\(.*\):\s*$', read_file(module), re.M))
147147

148148

149149
def include_easyblocks(tmpdir, paths):

easybuild/tools/job/pbs_python.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ def info(self, types=None):
454454
return None
455455

456456
# convert single type into list
457-
if type(types) is str:
457+
if isinstance(types, str):
458458
types = [types]
459459

460460
self.log.debug("Return info types %s" % types)

easybuild/tools/module_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ def get_description(self, conflict=True):
736736
"""
737737
txt = '\n'.join([
738738
"proc ModulesHelp { } {",
739-
" puts stderr {%s" % re.sub('([{}\[\]])', r'\\\1', self._generate_help_text()),
739+
" puts stderr {%s" % re.sub(r'([{}\[\]])', r'\\\1', self._generate_help_text()),
740740
" }",
741741
'}',
742742
'',

easybuild/tools/module_naming_scheme/categorized_mns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def is_short_modname_for(self, short_modname, name):
5656
Default implementation checks via a strict regex pattern, and assumes short module names are of the form:
5757
<name>/<version>[-<toolchain>]
5858
"""
59-
modname_regex = re.compile('^[^/]+/%s/\S+$' % re.escape(name))
59+
modname_regex = re.compile(r'^[^/]+/%s/\S+$' % re.escape(name))
6060
res = bool(modname_regex.match(short_modname))
6161

6262
tup = (short_modname, name, modname_regex.pattern, res)

easybuild/tools/module_naming_scheme/mns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def is_short_modname_for(self, short_modname, name):
162162
Default implementation checks via a strict regex pattern, and assumes short module names are of the form:
163163
<name>/<version>[-<toolchain>]
164164
"""
165-
modname_regex = re.compile('^%s(/\S+)?$' % re.escape(name))
165+
modname_regex = re.compile(r'^%s(/\S+)?$' % re.escape(name))
166166
res = bool(modname_regex.match(short_modname))
167167

168168
self.log.debug("Checking whether '%s' is a module name for software with name '%s' via regex %s: %s",

easybuild/tools/modules.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,9 @@ def check_module_path(self):
444444
idx = 1
445445
while(curr_mod_paths[-idx:] == self.mod_paths[-idx:]):
446446
idx += 1
447-
self.log.debug("Not prepending %d last entries of %s", idx-1, self.mod_paths)
447+
self.log.debug("Not prepending %d last entries of %s", idx - 1, self.mod_paths)
448448

449-
for mod_path in self.mod_paths[::-1][idx-1:]:
449+
for mod_path in self.mod_paths[::-1][idx - 1:]:
450450
self.prepend_module_path(mod_path)
451451

452452
self.log.info("$MODULEPATH set via list of module paths (w/ 'module use'): %s" % os.environ['MODULEPATH'])
@@ -1081,7 +1081,7 @@ def path_to_top_of_module_tree(self, top_paths, mod_name, full_mod_subdir, deps,
10811081
if path_matches(full_mod_subdir, full_modpath_exts):
10821082

10831083
# full path to module subdir of dependency is simply path to module file without (short) module name
1084-
dep_full_mod_subdir = self.modulefile_path(dep, strip_ext=True)[:-len(dep)-1]
1084+
dep_full_mod_subdir = self.modulefile_path(dep, strip_ext=True)[:-len(dep) - 1]
10851085
full_mod_subdirs.append(dep_full_mod_subdir)
10861086

10871087
mods_to_top.append(dep)
@@ -1622,7 +1622,7 @@ def __init__(self, *args, **kwargs):
16221622

16231623
def exist(self, mod_names, *args, **kwargs):
16241624
"""No modules, so nothing exists"""
1625-
return [False]*len(mod_names)
1625+
return [False] * len(mod_names)
16261626

16271627
def check_loaded_modules(self):
16281628
"""Nothing to do since no modules"""

0 commit comments

Comments
 (0)