From f6131eb93f37dacb98f8d7b332c44321bfc4a933 Mon Sep 17 00:00:00 2001 From: Reinout van Rees Date: Tue, 1 Oct 2024 20:27:01 +0200 Subject: [PATCH] ruff check --fix --- shell/dos2unix.py | 2 +- tools/add_time.py | 2 +- tools/blog.py | 8 ++++---- tools/mkinit.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/shell/dos2unix.py b/shell/dos2unix.py index af22394..113d124 100755 --- a/shell/dos2unix.py +++ b/shell/dos2unix.py @@ -26,7 +26,7 @@ def unix2dos(data): def confirm(file_): - s = raw_input("%s? " % file_) + s = raw_input(f"{file_}? ") return s and s[0] == "y" diff --git a/tools/add_time.py b/tools/add_time.py index f18dfa8..bcdadaa 100644 --- a/tools/add_time.py +++ b/tools/add_time.py @@ -42,4 +42,4 @@ def main(): out_filename = date_string.replace(":", "_") + ".png" image.save(out_filename, "png") - print("Saved %s" % out_filename) + print(f"Saved {out_filename}") diff --git a/tools/blog.py b/tools/blog.py index f0c8cde..9e56cfa 100644 --- a/tools/blog.py +++ b/tools/blog.py @@ -45,7 +45,7 @@ def copytoblog(): print("pass along filename!") filename = sys.argv[1] if not os.path.exists(filename): - print("%s doesn't exist" % filename) + print(f"{filename} doesn't exist") now = datetime.now() y = "%04d" % now.year @@ -100,7 +100,7 @@ def copytoblog(): webbrowser.open(on_site) if "y" in input("Delete file in ~/blog/? [y/N] "): os.remove(os.path.join(os.path.expanduser("~/blog"), filename)) - print("%s removed" % filename) + print(f"{filename} removed") def makedocs(): @@ -137,7 +137,7 @@ def list_todays_entries(): monthdir = os.path.join(yeardir, m) daydir = os.path.join(monthdir, d) if not os.path.exists(daydir): - print("Nothing posted yet in %s" % daydir) + print(f"Nothing posted yet in {daydir}") sys.exit(1) entries = [ entry @@ -188,7 +188,7 @@ def new_sermon(): yeardir = os.path.join(SERMONSOURCE, yyyy) if not os.path.exists(yeardir): os.mkdir(yeardir) - print("Created %s" % yeardir) + print(f"Created {yeardir}") title = None while not title: diff --git a/tools/mkinit.py b/tools/mkinit.py index 6b5df26..014bf71 100644 --- a/tools/mkinit.py +++ b/tools/mkinit.py @@ -13,8 +13,8 @@ def main(): dirname = sys.argv[1] if not os.path.exists(dirname): os.mkdir(dirname) - print("Created directory %s" % dirname) + print(f"Created directory {dirname}") initfile = os.path.join(dirname, "__init__.py") if not os.path.exists(initfile): open(initfile, "w").write("# package\n") - print("Created file %s" % initfile) + print(f"Created file {initfile}")