summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Fink2020-09-23 09:33:05 +0200
committerDennis Fink2020-09-23 09:33:05 +0200
commit583ca3c624978ff49f826157cdc4a66e17125334 (patch)
tree2673584b44d59eb7cc1240c26eecdf987175463f
parent5d02bea91728ca15418da5dd7e942c6470fb9764 (diff)
downloadpatternutils-583ca3c624978ff49f826157cdc4a66e17125334.tar.gz
patternutils-583ca3c624978ff49f826157cdc4a66e17125334.zip
Use f-strings
-rw-r--r--patternutils/commands/patterncfg.py6
-rw-r--r--patternutils/commands/pmatch.py2
-rw-r--r--patternutils/commands/tln.py4
-rw-r--r--patternutils/commands/tmv.py4
4 files changed, 8 insertions, 8 deletions
diff --git a/patternutils/commands/patterncfg.py b/patternutils/commands/patterncfg.py
index a1a7cb3..3ef0518 100644
--- a/patternutils/commands/patterncfg.py
+++ b/patternutils/commands/patterncfg.py
@@ -36,10 +36,10 @@ def list() -> None:
for d in os.listdir(config.CONFIG_PATH):
click.secho(d, fg="blue")
for f in os.listdir(os.path.join(config.CONFIG_PATH, d)):
- click.echo("└── {}".format(f))
+ click.echo(f"└── {f}")
except FileNotFoundError as e:
click.secho(
- "{} not found! Please run patterncfg init first.".format(e.filename),
+ f"{e.filename} not found! Please run patterncfg init first.",
fg="red",
err=True,
)
@@ -66,7 +66,7 @@ def add(template_engine: Optional[str], command: str, name: str) -> None:
else:
fileext = template_engine
- filename = os.path.join(config.CONFIG_PATH, command, "{}.{}".format(name, fileext))
+ filename = os.path.join(config.CONFIG_PATH, command, f"{name}.{fileext}")
click.edit(filename=filename)
diff --git a/patternutils/commands/pmatch.py b/patternutils/commands/pmatch.py
index b889145..e5880d6 100644
--- a/patternutils/commands/pmatch.py
+++ b/patternutils/commands/pmatch.py
@@ -37,7 +37,7 @@ def apply_regex(
try:
match = mat.apply(subject, regex_pattern)
except ValueError:
- click.secho("{} did not match".format(subject), fg="red", err=True)
+ click.secho(f"{subject} did not match", fg="red", err=True)
has_invalid_matches = True
else:
match["_path"] = f.path
diff --git a/patternutils/commands/tln.py b/patternutils/commands/tln.py
index 70e7406..e84ddb4 100644
--- a/patternutils/commands/tln.py
+++ b/patternutils/commands/tln.py
@@ -143,7 +143,7 @@ def tln(
non_existing = {}
for old, new in new_filenames.items():
if os.path.exists(new):
- click.secho("{} does exist!".format(new), fg="red", err=True)
+ click.secho(f"{new} does exist!", fg="red", err=True)
has_existing = True
else:
non_existing[old] = new
@@ -158,7 +158,7 @@ def tln(
for old, new in files_to_move:
if verbose or interactive:
- click.echo("{} -> {}".format(old, new))
+ click.echo(f"{old} -> {new}")
if not (interactive and not click.confirm("Is the match correct?")):
if not dry_run:
diff --git a/patternutils/commands/tmv.py b/patternutils/commands/tmv.py
index cd56906..04321f1 100644
--- a/patternutils/commands/tmv.py
+++ b/patternutils/commands/tmv.py
@@ -139,7 +139,7 @@ def tmv(
non_existing = {}
for old, new in new_filenames.items():
if os.path.exists(new):
- click.secho("{} does exist!".format(new), fg="red", err=True)
+ click.secho(f"{new} does exist!", fg="red", err=True)
has_existing = True
else:
non_existing[old] = new
@@ -154,7 +154,7 @@ def tmv(
for old, new in files_to_move:
if verbose or interactive:
- click.echo("{} -> {}".format(old, new))
+ click.echo(f"{old} -> {new}")
if not (interactive and not click.confirm("Is the match correct?")):
if not dry_run: