From 3a21e6cba8effda216d9eaf9064223d0d6960911 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Tue, 10 Sep 2024 12:42:35 +0200 Subject: [PATCH] Manually remove more .format() calls --- setuptools/command/bdist_wheel.py | 4 +--- setuptools/dist.py | 17 ++++++++--------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/setuptools/command/bdist_wheel.py b/setuptools/command/bdist_wheel.py index 8f06786659..926b407614 100644 --- a/setuptools/command/bdist_wheel.py +++ b/setuptools/command/bdist_wheel.py @@ -209,9 +209,7 @@ class bdist_wheel(Command): ( "compression=", None, - "zipfile compression (one of: {}) [default: 'deflated']".format( - ", ".join(supported_compressions) - ), + f"zipfile compression (one of: {', '.join(supported_compressions)}) [default: 'deflated']", ), ( "python-tag=", diff --git a/setuptools/dist.py b/setuptools/dist.py index 1dd9861fc4..da4b2cb26f 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -126,8 +126,7 @@ def _check_marker(marker): def assert_bool(dist, attr, value): """Verify that value is True, False, 0, or 1""" if bool(value) != value: - tmpl = "{attr!r} must be a boolean value (got {value!r})" - raise DistutilsSetupError(tmpl.format(attr=attr, value=value)) + raise DistutilsSetupError(f"{attr!r} must be a boolean value (got {value!r})") def invalid_unless_false(dist, attr, value): @@ -145,11 +144,10 @@ def check_requirements(dist, attr, value): if isinstance(value, (dict, set)): raise TypeError("Unordered types are not allowed") except (TypeError, ValueError) as error: - tmpl = ( - "{attr!r} must be a string or list of strings " - "containing valid project/version requirement specifiers; {error}" - ) - raise DistutilsSetupError(tmpl.format(attr=attr, error=error)) from error + raise DistutilsSetupError( + f"{attr!r} must be a string or list of strings " + f"containing valid project/version requirement specifiers; {error}" + ) from error def check_specifier(dist, attr, value): @@ -157,8 +155,9 @@ def check_specifier(dist, attr, value): try: SpecifierSet(value) except (InvalidSpecifier, AttributeError) as error: - tmpl = "{attr!r} must be a string containing valid version specifiers; {error}" - raise DistutilsSetupError(tmpl.format(attr=attr, error=error)) from error + raise DistutilsSetupError( + f"{attr!r} must be a string containing valid version specifiers; {error}" + ) from error def check_entry_points(dist, attr, value):