diff options
| author | Egor Tensin <egor@tensin.name> | 2026-06-18 16:54:00 +0200 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-06-18 16:54:00 +0200 |
| commit | c663acc4ed8e7d2a9e4389a3e8f790d60a070a0c (patch) | |
| tree | d37fca42651fad8b0c55984a8796881ce8243777 /algorithms/scripts | |
| parent | add .git-blame-ignore-revs (diff) | |
| download | sorting-algorithms-c663acc4ed8e7d2a9e4389a3e8f790d60a070a0c.tar.gz sorting-algorithms-c663acc4ed8e7d2a9e4389a3e8f790d60a070a0c.zip | |
use format strings
Diffstat (limited to 'algorithms/scripts')
| -rwxr-xr-x | algorithms/scripts/plot.py | 8 | ||||
| -rwxr-xr-x | algorithms/scripts/test.py | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/algorithms/scripts/plot.py b/algorithms/scripts/plot.py index 25a87f7..61eeab1 100755 --- a/algorithms/scripts/plot.py +++ b/algorithms/scripts/plot.py @@ -40,7 +40,7 @@ def _parse_non_negative_integer(s): try: n = int(s) except ValueError: - raise argparse.ArgumentTypeError("must be a non-negative integer: " + str(s)) + raise argparse.ArgumentTypeError(f"must be a non-negative integer: {s}") if n < 0: raise argparse.ArgumentTypeError("must be a non-negative integer") return n @@ -50,7 +50,7 @@ def _parse_positive_integer(s): try: n = int(s) except ValueError: - raise argparse.ArgumentTypeError("must be a positive integer: " + str(s)) + raise argparse.ArgumentTypeError(f"must be a positive integer: {s}") if n < 1: raise argparse.ArgumentTypeError("must be a positive integer") return n @@ -60,11 +60,11 @@ def _parse_input_kind(s): try: return InputKind(s) except ValueError: - raise argparse.ArgumentTypeError("invalid input kind: " + str(s)) + raise argparse.ArgumentTypeError(f"invalid input kind: {s}") def _format_algorithm(codename): - return "* {}: {}".format(codename, registry.get(codename).display_name) + return "* {codename}: {registry.get(codename).display_name}" def _format_available_algorithms(): diff --git a/algorithms/scripts/test.py b/algorithms/scripts/test.py index 52acc34..7fd7c68 100755 --- a/algorithms/scripts/test.py +++ b/algorithms/scripts/test.py @@ -30,7 +30,7 @@ def _parse_non_negative_integer(s): try: n = int(s) except ValueError: - raise argparse.ArgumentTypeError("must be a non-negative integer: " + str(s)) + raise argparse.ArgumentTypeError(f"must be a non-negative integer: {s}") if n < 0: raise argparse.ArgumentTypeError("must be a non-negative integer") return n @@ -40,11 +40,11 @@ def _parse_input_kind(s): try: return InputKind(s) except ValueError: - raise argparse.ArgumentTypeError("invalid input kind: " + str(s)) + raise argparse.ArgumentTypeError(f"invalid input kind: {s}") def _format_algorithm(codename): - return "* {}: {}".format(codename, registry.get(codename).display_name) + return "* {codename}: {registry.get(codename).display_name}" def _format_available_algorithms(): |
