Skip to content

Commit

Permalink
Merge pull request #257 from DimitriPapadopoulos/RUF010
Browse files Browse the repository at this point in the history
Apply ruff rule RUF010
  • Loading branch information
jaraco authored Jun 27, 2024
2 parents e446f2c + b1f0b00 commit 15a9ffe
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion distutils/command/bdist_dumb.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def run(self):
):
raise DistutilsPlatformError(
"can't make a dumb built distribution where "
f"base and platbase are different ({repr(install.install_base)}, {repr(install.install_platbase)})"
f"base and platbase are different ({install.install_base!r}, {install.install_platbase!r})"
)
else:
archive_root = os.path.join(
Expand Down
2 changes: 1 addition & 1 deletion distutils/command/bdist_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def run(self): # noqa: C901

status = out.close()
if status:
raise DistutilsExecError("Failed to execute: %s" % repr(q_cmd))
raise DistutilsExecError("Failed to execute: %r" % q_cmd)

finally:
out.close()
Expand Down
2 changes: 1 addition & 1 deletion distutils/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def __init__(self, attrs=None): # noqa: C901
elif hasattr(self, key):
setattr(self, key, val)
else:
msg = "Unknown distribution option: %s" % repr(key)
msg = "Unknown distribution option: %r" % key
warnings.warn(msg)

# no-user-cfg is handled before other command line args
Expand Down
6 changes: 3 additions & 3 deletions distutils/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(self, vstring=None):
)

def __repr__(self):
return f"{self.__class__.__name__} ('{str(self)}')"
return f"{self.__class__.__name__} ('{self}')"

def __eq__(self, other):
c = self._cmp(other)
Expand Down Expand Up @@ -153,7 +153,7 @@ class StrictVersion(Version):
def parse(self, vstring):
match = self.version_re.match(vstring)
if not match:
raise ValueError("invalid version number '%s'" % vstring)
raise ValueError(f"invalid version number '{vstring}'")

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

Expand Down Expand Up @@ -330,7 +330,7 @@ def __str__(self):
return self.vstring

def __repr__(self):
return "LooseVersion ('%s')" % str(self)
return f"LooseVersion ('{self}')"

def _cmp(self, other):
if isinstance(other, str):
Expand Down
1 change: 1 addition & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ extend-select = [
"W",

# local
"RUF010",
"RUF100",
]
ignore = [
Expand Down

0 comments on commit 15a9ffe

Please sign in to comment.