Skip to content

Commit

Permalink
Updated pre-commit modules and applied ruff fixes
Browse files Browse the repository at this point in the history
Closes #615.
  • Loading branch information
agronholm committed May 8, 2024
1 parent bd8ab85 commit 0b7771e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ exclude: ^src/wheel/vendored

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -18,7 +18,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
rev: v0.4.3
hooks:
- id: ruff
args: [--fix, --show-fixes]
Expand Down
7 changes: 3 additions & 4 deletions src/wheel/bdist_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class bdist_wheel(Command):
"plat-name=",
"p",
"platform name to embed in generated filenames "
"(default: %s)" % get_platform(None),
f"(default: {get_platform(None)})",
),
(
"keep-temp",
Expand Down Expand Up @@ -215,8 +215,7 @@ class bdist_wheel(Command):
(
"python-tag=",
None,
"Python implementation compatibility tag"
" (default: '%s')" % (python_tag()),
f"Python implementation compatibility tag (default: '{python_tag()}')",
),
(
"build-number=",
Expand Down Expand Up @@ -282,7 +281,7 @@ def finalize_options(self):
if self.py_limited_api and not re.match(
PY_LIMITED_API_PATTERN, self.py_limited_api
):
raise ValueError("py-limited-api must match '%s'" % PY_LIMITED_API_PATTERN)
raise ValueError(f"py-limited-api must match '{PY_LIMITED_API_PATTERN}'")

# Support legacy [wheel] section for setting universal
wheel = self.distribution.get_option_dict("wheel")
Expand Down
2 changes: 1 addition & 1 deletion src/wheel/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def tags_f(args: argparse.Namespace) -> None:
def version_f(args: argparse.Namespace) -> None:
from .. import __version__

print("wheel %s" % __version__)
print(f"wheel {__version__}")


def parse_build_tag(build_tag: str) -> str:
Expand Down
4 changes: 2 additions & 2 deletions src/wheel/cli/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def wininst2wheel(path: str, dest_dir: str) -> None:
paths = {"platlib": ""}

dist_info = "{name}-{ver}".format(**info)
datadir = "%s.data/" % dist_info
datadir = f"{dist_info}.data/"

# rewrite paths to trick ZipFile into extracting an egg
# XXX grab wininst .ini - between .exe, padding, and first zip file.
Expand Down Expand Up @@ -246,7 +246,7 @@ def wininst2wheel(path: str, dest_dir: str) -> None:
bw.full_tag_supplied = True
bw.full_tag = (pyver, abi, arch)

dist_info_dir = os.path.join(dir, "%s.dist-info" % dist_info)
dist_info_dir = os.path.join(dir, f"{dist_info}.dist-info")
bw.egg2dist(os.path.join(dir, egginfo_name), dist_info_dir)
bw.write_wheelfile(dist_info_dir, generator="wininst2wheel")

Expand Down
2 changes: 1 addition & 1 deletion src/wheel/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def generate_requirements(
yield "Provides-Extra", extra
if condition:
condition = "(" + condition + ") and "
condition += "extra == '%s'" % extra
condition += f"extra == '{extra}'"

if condition:
condition = " ; " + condition
Expand Down
2 changes: 1 addition & 1 deletion tests/test_bdist_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def test_platform_linux32(reported, expected, monkeypatch):
def test_no_ctypes(monkeypatch) -> None:
def _fake_import(name: str, *args, **kwargs):
if name == "ctypes":
raise ModuleNotFoundError("No module named %s" % name)
raise ModuleNotFoundError(f"No module named {name}")

return importlib.__import__(name, *args, **kwargs)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_tagopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def temp_pkg(request, tmp_path):
if ext[0]:
# if ext[1] is not '', it will write a bad header and fail to compile
tmp_path.joinpath("test.c").write_text(
"#include <std%sio.h>" % ext[1], encoding="utf-8"
f"#include <std{ext[1]}io.h>", encoding="utf-8"
)
setup_py = SETUP_PY.format(ext_modules=EXT_MODULES)
else:
Expand Down

0 comments on commit 0b7771e

Please sign in to comment.