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

Minor style update for ruff 0.8.1 #579

Merged
merged 5 commits into from
Dec 5, 2024
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
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 6 additions & 8 deletions src/impactlab_tools/utils/paralog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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!")
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
---------------------
Expand Down
Loading