Skip to content

Commit

Permalink
Manually remove more .format() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos committed Sep 10, 2024
1 parent 335bb01 commit 3a21e6c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
4 changes: 1 addition & 3 deletions setuptools/command/bdist_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=",
Expand Down
17 changes: 8 additions & 9 deletions setuptools/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -145,20 +144,20 @@ 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):
"""Verify that value is a valid version specifier"""
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):
Expand Down

0 comments on commit 3a21e6c

Please sign in to comment.