Skip to content

Commit cb7f154

Browse files
committed
Merge pull request pypa/distutils#257 from DimitriPapadopoulos/RUF010
Apply ruff rule RUF010
2 parents e79d244 + 5b64ea3 commit cb7f154

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

distutils/command/bdist_dumb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def run(self):
116116
):
117117
raise DistutilsPlatformError(
118118
"can't make a dumb built distribution where "
119-
f"base and platbase are different ({repr(install.install_base)}, {repr(install.install_platbase)})"
119+
f"base and platbase are different ({install.install_base!r}, {install.install_platbase!r})"
120120
)
121121
else:
122122
archive_root = os.path.join(

distutils/command/bdist_rpm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def run(self): # noqa: C901
370370

371371
status = out.close()
372372
if status:
373-
raise DistutilsExecError("Failed to execute: %s" % repr(q_cmd))
373+
raise DistutilsExecError("Failed to execute: %r" % q_cmd)
374374

375375
finally:
376376
out.close()

distutils/dist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def __init__(self, attrs=None): # noqa: C901
264264
elif hasattr(self, key):
265265
setattr(self, key, val)
266266
else:
267-
msg = "Unknown distribution option: %s" % repr(key)
267+
msg = "Unknown distribution option: %r" % key
268268
warnings.warn(msg)
269269

270270
# no-user-cfg is handled before other command line args

distutils/version.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def __init__(self, vstring=None):
6060
)
6161

6262
def __repr__(self):
63-
return f"{self.__class__.__name__} ('{str(self)}')"
63+
return f"{self.__class__.__name__} ('{self}')"
6464

6565
def __eq__(self, other):
6666
c = self._cmp(other)
@@ -153,7 +153,7 @@ class StrictVersion(Version):
153153
def parse(self, vstring):
154154
match = self.version_re.match(vstring)
155155
if not match:
156-
raise ValueError("invalid version number '%s'" % vstring)
156+
raise ValueError(f"invalid version number '{vstring}'")
157157

158158
(major, minor, patch, prerelease, prerelease_num) = match.group(1, 2, 4, 5, 6)
159159

@@ -330,7 +330,7 @@ def __str__(self):
330330
return self.vstring
331331

332332
def __repr__(self):
333-
return "LooseVersion ('%s')" % str(self)
333+
return f"LooseVersion ('{self}')"
334334

335335
def _cmp(self, other):
336336
if isinstance(other, str):

ruff.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[lint]
22
extend-select = [
33
"C901",
4+
"RUF010",
45
"W",
56

67
# local

0 commit comments

Comments
 (0)