Skip to content

Commit 9e102e2

Browse files
authored
Merge pull request #579 from ClimateImpactLab/style_update
Minor style update for ruff 0.8.1
2 parents 5a329c2 + 8f6d796 commit 9e102e2

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ sphinx-rtd-theme==3.0.2
1010
pytest==8.3.3
1111
pytest-cov==6.0.0
1212
pyyaml==6.0.2
13-
ruff==0.6.8
13+
ruff==0.8.1

src/impactlab_tools/utils/paralog.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __init__(self, jobname, jobtitle, logdir, timeout, exclusive_jobnames=None):
6464
if not os.path.exists(logdir):
6565
os.makedirs(logdir)
6666
for ii in itertools.count():
67-
logpath = os.path.join(logdir, "%s-%d.log" % (jobname, ii))
67+
logpath = os.path.join(logdir, f"{jobname}-{ii:d}.log")
6868
if not os.path.exists(logpath):
6969
self.logpath = logpath
7070
break
@@ -73,12 +73,8 @@ def __init__(self, jobname, jobtitle, logdir, timeout, exclusive_jobnames=None):
7373
# Record this process in the master log
7474
with open(os.path.join(logdir, "master.log"), 'a') as fp:
7575
fp.write(
76-
"%s %s: %d %s\n" % (
77-
time.asctime(),
78-
self.jobtitle,
79-
os.getpid(),
80-
self.logpath
81-
)
76+
f"{time.asctime()} {self.jobtitle}:"
77+
f"{os.getpid():d} {self.logpath}\n"
8278
)
8379
except Exception:
8480
print("CAUGHT A WILD EXCEPTION BUT IGNORING IT WITHOUT LOGGING IT!")
@@ -106,7 +102,9 @@ def claim(self, dirpath):
106102
status_path = StatusManager.claiming_filepath(dirpath, self.jobname)
107103
try:
108104
with open(status_path, 'w') as fp:
109-
fp.write("%d %s: %s\n" % (os.getpid(), self.jobtitle, self.logpath))
105+
fp.write(
106+
f"{os.getpid():d} {self.jobtitle}: {self.logpath}\n"
107+
)
110108
except Exception:
111109
print("CAUGHT A WILD EXCEPTION BUT IGNORING IT WITHOUT LOGGING IT!")
112110
return False # Writing error: cannot calim directory

whatsnew.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ These are new features and improvements of note in each release.
66
Unreleased
77
----------
88

9+
- Minor code style update.
910

1011
v0.6.0 (May 31, 2024)
1112
---------------------

0 commit comments

Comments
 (0)