Skip to content

Commit d37c280

Browse files
Apply ruff/pyupgrade rule UP031
UP031 Use format specifiers instead of percent format
1 parent 67d154a commit d37c280

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/setuptools_scm/_run_cmd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def has_command(
201201
else:
202202
res = not p.returncode
203203
if not res and warn:
204-
warnings.warn("%r was not found" % name, category=RuntimeWarning)
204+
warnings.warn(f"{name!r} was not found", category=RuntimeWarning)
205205
return res
206206

207207

src/setuptools_scm/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def meta(
216216
) -> ScmVersion:
217217
parsed_version = _parse_tag(tag, preformatted, config)
218218
log.info("version %s -> %s", tag, parsed_version)
219-
assert parsed_version is not None, "Can't parse version %s" % tag
219+
assert parsed_version is not None, f"Can't parse version {tag}"
220220
return ScmVersion(
221221
parsed_version,
222222
distance=distance,

testing/test_git.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def test_git_dirty_notag(
299299
def test_git_worktree_support(wd: WorkDir, tmp_path: Path) -> None:
300300
wd.commit_testfile()
301301
worktree = tmp_path / "work_tree"
302-
wd("git worktree add -b work-tree %s" % worktree)
302+
wd(f"git worktree add -b work-tree {worktree}")
303303

304304
res = run([sys.executable, "-m", "setuptools_scm", "ls"], cwd=worktree)
305305
assert "test.txt" in res.stdout

testing/test_version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,10 @@ def __init__(self, tag_str: str) -> None:
432432
self.tag = tag_str
433433

434434
def __str__(self) -> str:
435-
return "Custom %s" % self.tag
435+
return f"Custom {self.tag}"
436436

437437
def __repr__(self) -> str:
438-
return "MyVersion<Custom%s>" % self.tag
438+
return f"MyVersion<Custom{self.tag}>"
439439

440440
config = Configuration(version_cls=MyVersion) # type: ignore[arg-type]
441441
scm_version = meta("1.0.0-foo", config=config)

0 commit comments

Comments
 (0)