Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix code style issues reported by recent flake8 linter #4049

Merged
merged 1 commit into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions easybuild/base/fancylogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ def streamLog(self, levelno, data):

def write_and_flush_stream(hdlr, data=None):
"""Write to stream and flush the handler"""
if (not hasattr(hdlr, 'stream')) or hdlr.stream is None:
if getattr(hdlr, 'stream', None) is None:
# no stream or not initialised.
raise("write_and_flush_stream failed. No active stream attribute.")
raise ValueError("write_and_flush_stream failed. No active stream attribute.")
if data is not None:
hdlr.stream.write(data)
hdlr.flush()
Expand Down
2 changes: 1 addition & 1 deletion easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ def gen_builddir(self):
if not self.cfg.get('cleanupoldbuild', False):
uniq_builddir = builddir
suff = 0
while(os.path.isdir(uniq_builddir)):
while os.path.isdir(uniq_builddir):
uniq_builddir = "%s.%d" % (builddir, suff)
suff += 1
builddir = uniq_builddir
Expand Down
2 changes: 1 addition & 1 deletion easybuild/framework/easyconfig/format/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def __bool__(self):

def is_valid(self):
"""Check if this is a valid VersionOperator. Suffix can be anything."""
return not(self.version is None or self.operator is None)
return not (self.version is None or self.operator is None)

def set(self, versop_str):
"""
Expand Down
2 changes: 1 addition & 1 deletion easybuild/tools/filetools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2870,7 +2870,7 @@ def copy_framework_files(paths, target_dir):
if framework_topdir in dirnames:
# construct subdirectory by grabbing last entry in dirnames until we hit 'easybuild-framework' dir
subdirs = []
while(dirnames[-1] != framework_topdir):
while dirnames[-1] != framework_topdir:
subdirs.insert(0, dirnames.pop())

parent_dir = os.path.join(*subdirs) if subdirs else ''
Expand Down
2 changes: 1 addition & 1 deletion easybuild/tools/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ def check_module_path(self):
else:
# filter out tail of paths that already matches tail of target, to avoid unnecessary 'unuse' commands
idx = 1
while(curr_mod_paths[-idx:] == self.mod_paths[-idx:]):
while curr_mod_paths[-idx:] == self.mod_paths[-idx:]:
idx += 1
self.log.debug("Not prepending %d last entries of %s", idx - 1, self.mod_paths)

Expand Down