Skip to content

Commit 00995c1

Browse files
abravalheriAvasam
authored andcommitted
Use variable msg instead of tmpl in setuptools/dist
1 parent d457d0e commit 00995c1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

setuptools/dist.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ def _check_marker(marker):
140140
def assert_bool(dist, attr, value):
141141
"""Verify that value is True, False, 0, or 1"""
142142
if bool(value) != value:
143-
tmpl = "{attr!r} must be a boolean value (got {value!r})"
144-
raise DistutilsSetupError(tmpl.format(attr=attr, value=value))
143+
raise DistutilsSetupError(f"{attr!r} must be a boolean value (got {value!r})")
145144

146145

147146
def invalid_unless_false(dist, attr, value):
@@ -163,20 +162,20 @@ def check_requirements(dist, attr: str, value: _StrOrIter) -> None:
163162
if isinstance(value, (dict, set)):
164163
raise TypeError("Unordered types are not allowed")
165164
except (TypeError, ValueError) as error:
166-
tmpl = (
165+
msg = (
167166
f"{attr!r} must be a string or iterable of strings "
168167
f"containing valid project/version requirement specifiers; {error}"
169168
)
170-
raise DistutilsSetupError(tmpl) from error
169+
raise DistutilsSetupError(msg) from error
171170

172171

173172
def check_specifier(dist, attr, value):
174173
"""Verify that value is a valid version specifier"""
175174
try:
176175
SpecifierSet(value)
177176
except (InvalidSpecifier, AttributeError) as error:
178-
tmpl = "{attr!r} must be a string containing valid version specifiers; {error}"
179-
raise DistutilsSetupError(tmpl.format(attr=attr, error=error)) from error
177+
msg = f"{attr!r} must be a string containing valid version specifiers; {error}"
178+
raise DistutilsSetupError(msg) from error
180179

181180

182181
def check_entry_points(dist, attr, value):

0 commit comments

Comments
 (0)