diff options
author | Bert JW Regeer <bertjw@regeer.org> | 2020-05-06 23:58:48 -0700 |
---|---|---|
committer | Bert JW Regeer <bertjw@regeer.org> | 2020-08-15 18:55:04 -0700 |
commit | 08b3629cd3fe89f9ce7daee3d445fe03588e3d14 (patch) | |
tree | 42b2d038c1dec353ac6be818e10bbb64beca9c1f /src/waitress/runner.py | |
parent | cf029b4a34b049203640da7a013d4973ec8e465c (diff) | |
download | waitress-08b3629cd3fe89f9ce7daee3d445fe03588e3d14.tar.gz |
Cleanup string formatting
Diffstat (limited to 'src/waitress/runner.py')
-rw-r--r-- | src/waitress/runner.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/waitress/runner.py b/src/waitress/runner.py index 2495084..4fb3e6b 100644 --- a/src/waitress/runner.py +++ b/src/waitress/runner.py @@ -14,7 +14,6 @@ """Command line runner. """ -from __future__ import print_function, unicode_literals import getopt import os @@ -191,7 +190,7 @@ RUNNER_PATTERN = re.compile( def match(obj_name): matches = RUNNER_PATTERN.match(obj_name) if not matches: - raise ValueError("Malformed application '{0}'".format(obj_name)) + raise ValueError("Malformed application '{}'".format(obj_name)) return matches.group("module"), matches.group("object") @@ -216,7 +215,7 @@ def resolve(module_name, object_name): def show_help(stream, name, error=None): # pragma: no cover if error is not None: - print("Error: {0}\n".format(error), file=stream) + print("Error: {}\n".format(error), file=stream) print(HELP.format(name), file=stream) @@ -224,7 +223,7 @@ def show_exception(stream): exc_type, exc_value = sys.exc_info()[:2] args = getattr(exc_value, "args", None) print( - ("There was an exception ({0}) importing your module.\n").format( + ("There was an exception ({}) importing your module.\n").format( exc_type.__name__, ), file=stream, @@ -232,7 +231,7 @@ def show_exception(stream): if args: print("It had these arguments: ", file=stream) for idx, arg in enumerate(args, start=1): - print("{0}. {1}\n".format(idx, arg), file=stream) + print("{}. {}\n".format(idx, arg), file=stream) else: print("It had no arguments.", file=stream) @@ -269,11 +268,11 @@ def run(argv=sys.argv, _serve=serve): try: app = resolve(module, obj_name) except ImportError: - show_help(sys.stderr, name, "Bad module '{0}'".format(module)) + show_help(sys.stderr, name, "Bad module '{}'".format(module)) show_exception(sys.stderr) return 1 except AttributeError: - show_help(sys.stderr, name, "Bad object name '{0}'".format(obj_name)) + show_help(sys.stderr, name, "Bad object name '{}'".format(obj_name)) show_exception(sys.stderr) return 1 if kw["call"]: |