Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply ruff rule RUF010 #257

Merged
merged 3 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading