Skip to content

Commit

Permalink
style: ignore format specs in old code
Browse files Browse the repository at this point in the history
  • Loading branch information
beckermr committed Nov 26, 2024
1 parent 5b11471 commit 00aaa61
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 16 deletions.
3 changes: 2 additions & 1 deletion conda_build/_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ def create_script(fn):
shutil.copy2(src, dst + "-script.py")
FILES.append(f"Scripts/{fn}-script.py")
shutil.copy2(
join(THIS_DIR, "cli-%d.exe" % (8 * tuple.__itemsize__)), dst + ".exe"
join(THIS_DIR, "cli-%d.exe" % (8 * tuple.__itemsize__)), # noqa: UP031
dst + ".exe",
)
FILES.append(f"Scripts/{fn}.exe")
else:
Expand Down
4 changes: 2 additions & 2 deletions conda_build/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,14 +428,14 @@ def inspect_prefix_length(packages, min_prefix_length=_prefix_length):
prefix_lengths = check_prefix_lengths(packages, config)
if prefix_lengths:
print(
"Packages with binary prefixes shorter than %d characters:"
"Packages with binary prefixes shorter than %d characters:" # noqa: UP031
% min_prefix_length
)
for fn, length in prefix_lengths.items():
print(f"{fn} ({length} chars)")
else:
print(
"No packages found with binary prefixes shorter than %d characters."
"No packages found with binary prefixes shorter than %d characters." # noqa: UP031
% min_prefix_length
)
return len(prefix_lengths) == 0
Expand Down
6 changes: 3 additions & 3 deletions conda_build/os_utils/macho.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def add_rpath(path, rpath, build_prefix=None, verbose=False):
else:
print(stderr, file=sys.stderr)
if code:
raise RuntimeError("install_name_tool failed with exit status %d" % code)
raise RuntimeError("install_name_tool failed with exit status %d" % code) # noqa: UP031


def delete_rpath(path, rpath, build_prefix=None, verbose=False):
Expand All @@ -312,7 +312,7 @@ def delete_rpath(path, rpath, build_prefix=None, verbose=False):
else:
print(stderr, file=sys.stderr)
if code:
raise RuntimeError("install_name_tool failed with exit status %d" % code)
raise RuntimeError("install_name_tool failed with exit status %d" % code) # noqa: UP031


def install_name_change(path, build_prefix, cb_func, dylibs, verbose=False):
Expand Down Expand Up @@ -348,7 +348,7 @@ def install_name_change(path, build_prefix, cb_func, dylibs, verbose=False):
print(stderr, file=sys.stderr)
if code:
raise RuntimeError(
"install_name_tool failed with exit status %d, stderr of:\n%s"
"install_name_tool failed with exit status %d, stderr of:\n%s" # noqa: UP031
% (code, stderr)
)
return ret
Expand Down
4 changes: 2 additions & 2 deletions conda_build/os_utils/pyldd.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,15 @@ def __init__(self, fileobj, start=0, size=maxint):
self._pos = 0

def __repr__(self):
return "<fileview [%d, %d] %r>" % (self._start, self._end, self._fileobj)
return "<fileview [%d, %d] %r>" % (self._start, self._end, self._fileobj) # noqa: UP031

def tell(self):
return self._pos

def _checkwindow(self, seekto, op):
if not (self._start <= seekto <= self._end):
raise OSError(
"%s to offset %d is outside window [%d, %d]"
"%s to offset %d is outside window [%d, %d]" # noqa: UP031
% (op, seekto, self._start, self._end)
)

Expand Down
4 changes: 2 additions & 2 deletions conda_build/skeletons/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def skeletonize(

if pypi_resp.status_code != 200:
sys.exit(
"Request to fetch %s failed with status: %d"
"Request to fetch %s failed with status: %d" # noqa: UP031
% (package_pypi_url, pypi_resp.status_code)
)

Expand Down Expand Up @@ -658,7 +658,7 @@ def get_download_data(
if manual_url:
for i, url in enumerate(urls):
print(
"%d: %s (%s) %s"
"%d: %s (%s) %s" # noqa: UP031
% (i, url["url"], human_bytes(url["size"]), url["comment_text"])
)
n = int(input("which version should i use? "))
Expand Down
6 changes: 3 additions & 3 deletions tests/cli/test_main_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_no_filename_hash(testing_workdir, testing_metadata, capfd):
args = ["--output", testing_workdir, "--old-build-string"]
main_render.execute(args)
output, error = capfd.readouterr()
assert not re.search("h[0-9a-f]{%d}" % testing_metadata.config.hash_length, output)
assert not re.search("h[0-9a-f]{%d}" % testing_metadata.config.hash_length, output) # noqa: UP031

args = [
"--no-anaconda-upload",
Expand All @@ -92,11 +92,11 @@ def test_no_filename_hash(testing_workdir, testing_metadata, capfd):
main_build.execute(args)
output, error = capfd.readouterr()
assert not re.search(
"test_no_filename_hash.*h[0-9a-f]{%d}" % testing_metadata.config.hash_length,
"test_no_filename_hash.*h[0-9a-f]{%d}" % testing_metadata.config.hash_length, # noqa: UP031
output,
)
assert not re.search(
"test_no_filename_hash.*h[0-9a-f]{%d}" % testing_metadata.config.hash_length,
"test_no_filename_hash.*h[0-9a-f]{%d}" % testing_metadata.config.hash_length, # noqa: UP031
error,
)

Expand Down
8 changes: 5 additions & 3 deletions tests/test_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,8 @@ def test_reduced_hashing_behavior(testing_config):
"c_compiler" in metadata.get_hash_contents()
), "hash contents should contain c_compiler"
assert re.search(
"h[0-9a-f]{%d}" % testing_config.hash_length, metadata.build_id()
"h[0-9a-f]{%d}" % testing_config.hash_length, # noqa: UP031
metadata.build_id(),
), "hash should be present when compiler jinja2 function is used"

# recipes that use some variable in conda_build_config.yaml to control what
Expand All @@ -486,7 +487,7 @@ def test_reduced_hashing_behavior(testing_config):
bypass_env_check=True,
)[0][0]
assert "zlib" in metadata.get_hash_contents()
assert re.search("h[0-9a-f]{%d}" % testing_config.hash_length, metadata.build_id())
assert re.search("h[0-9a-f]{%d}" % testing_config.hash_length, metadata.build_id()) # noqa: UP031

# anything else does not get a hash
metadata = api.render(
Expand All @@ -496,7 +497,8 @@ def test_reduced_hashing_behavior(testing_config):
)[0][0]
assert not metadata.get_hash_contents()
assert not re.search(
"h[0-9a-f]{%d}" % testing_config.hash_length, metadata.build_id()
"h[0-9a-f]{%d}" % testing_config.hash_length, # noqa: UP031
metadata.build_id(),
)


Expand Down

0 comments on commit 00aaa61

Please sign in to comment.