diff --git a/requirements.txt b/requirements.txt index 8579eff..8fe9239 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,4 +10,4 @@ sphinx-rtd-theme==3.0.2 pytest==8.3.3 pytest-cov==6.0.0 pyyaml==6.0.2 -ruff==0.6.8 +ruff==0.8.1 diff --git a/src/impactlab_tools/utils/paralog.py b/src/impactlab_tools/utils/paralog.py index 8b6bc7c..edd687f 100644 --- a/src/impactlab_tools/utils/paralog.py +++ b/src/impactlab_tools/utils/paralog.py @@ -64,7 +64,7 @@ def __init__(self, jobname, jobtitle, logdir, timeout, exclusive_jobnames=None): if not os.path.exists(logdir): os.makedirs(logdir) for ii in itertools.count(): - logpath = os.path.join(logdir, "%s-%d.log" % (jobname, ii)) + logpath = os.path.join(logdir, f"{jobname}-{ii:d}.log") if not os.path.exists(logpath): self.logpath = logpath break @@ -73,12 +73,8 @@ def __init__(self, jobname, jobtitle, logdir, timeout, exclusive_jobnames=None): # Record this process in the master log with open(os.path.join(logdir, "master.log"), 'a') as fp: fp.write( - "%s %s: %d %s\n" % ( - time.asctime(), - self.jobtitle, - os.getpid(), - self.logpath - ) + f"{time.asctime()} {self.jobtitle}:" + f"{os.getpid():d} {self.logpath}\n" ) except Exception: print("CAUGHT A WILD EXCEPTION BUT IGNORING IT WITHOUT LOGGING IT!") @@ -106,7 +102,9 @@ def claim(self, dirpath): status_path = StatusManager.claiming_filepath(dirpath, self.jobname) try: with open(status_path, 'w') as fp: - fp.write("%d %s: %s\n" % (os.getpid(), self.jobtitle, self.logpath)) + fp.write( + f"{os.getpid():d} {self.jobtitle}: {self.logpath}\n" + ) except Exception: print("CAUGHT A WILD EXCEPTION BUT IGNORING IT WITHOUT LOGGING IT!") return False # Writing error: cannot calim directory diff --git a/whatsnew.rst b/whatsnew.rst index b88e879..528c217 100644 --- a/whatsnew.rst +++ b/whatsnew.rst @@ -6,6 +6,7 @@ These are new features and improvements of note in each release. Unreleased ---------- + - Minor code style update. v0.6.0 (May 31, 2024) ---------------------