apply black v25.1.0 (#49076)
This commit is contained in:
parent
b11578ed7c
commit
754a64d1fe
@ -269,7 +269,7 @@ def __init__(
|
||||
|
||||
@staticmethod
|
||||
def _poll_interval_generator(
|
||||
_wait_times: Optional[Tuple[float, float, float]] = None
|
||||
_wait_times: Optional[Tuple[float, float, float]] = None,
|
||||
) -> Generator[float, None, None]:
|
||||
"""This implements a backoff scheme for polling a contended resource
|
||||
by suggesting a succession of wait times between polls.
|
||||
|
@ -2,8 +2,7 @@
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
"""Utility classes for logging the output of blocks of code.
|
||||
"""
|
||||
"""Utility classes for logging the output of blocks of code."""
|
||||
import atexit
|
||||
import ctypes
|
||||
import errno
|
||||
|
@ -923,7 +923,7 @@ class FileTypes:
|
||||
UNKNOWN = 2
|
||||
|
||||
|
||||
NOT_ISO8859_1_TEXT = re.compile(b"[\x00\x7F-\x9F]")
|
||||
NOT_ISO8859_1_TEXT = re.compile(b"[\x00\x7f-\x9f]")
|
||||
|
||||
|
||||
def file_type(f: IO[bytes]) -> int:
|
||||
|
@ -310,7 +310,7 @@ def find_windows_kit_roots() -> List[str]:
|
||||
|
||||
@staticmethod
|
||||
def find_windows_kit_bin_paths(
|
||||
kit_base: Union[Optional[str], Optional[list]] = None
|
||||
kit_base: Union[Optional[str], Optional[list]] = None,
|
||||
) -> List[str]:
|
||||
"""Returns Windows kit bin directory per version"""
|
||||
kit_base = WindowsKitExternalPaths.find_windows_kit_roots() if not kit_base else kit_base
|
||||
@ -325,7 +325,7 @@ def find_windows_kit_bin_paths(
|
||||
|
||||
@staticmethod
|
||||
def find_windows_kit_lib_paths(
|
||||
kit_base: Union[Optional[str], Optional[list]] = None
|
||||
kit_base: Union[Optional[str], Optional[list]] = None,
|
||||
) -> List[str]:
|
||||
"""Returns Windows kit lib directory per version"""
|
||||
kit_base = WindowsKitExternalPaths.find_windows_kit_roots() if not kit_base else kit_base
|
||||
|
@ -568,7 +568,7 @@ def patch(
|
||||
"""
|
||||
|
||||
def _execute_patch(
|
||||
pkg_or_dep: Union[Type[spack.package_base.PackageBase], Dependency]
|
||||
pkg_or_dep: Union[Type[spack.package_base.PackageBase], Dependency],
|
||||
) -> None:
|
||||
pkg = pkg_or_dep.pkg if isinstance(pkg_or_dep, Dependency) else pkg_or_dep
|
||||
|
||||
|
@ -283,21 +283,21 @@ def relocate_text_bin(binaries: Iterable[str], prefix_to_prefix: PrefixToPrefix)
|
||||
def is_macho_magic(magic: bytes) -> bool:
|
||||
return (
|
||||
# In order of popularity: 64-bit mach-o le/be, 32-bit mach-o le/be.
|
||||
magic.startswith(b"\xCF\xFA\xED\xFE")
|
||||
or magic.startswith(b"\xFE\xED\xFA\xCF")
|
||||
or magic.startswith(b"\xCE\xFA\xED\xFE")
|
||||
or magic.startswith(b"\xFE\xED\xFA\xCE")
|
||||
magic.startswith(b"\xcf\xfa\xed\xfe")
|
||||
or magic.startswith(b"\xfe\xed\xfa\xcf")
|
||||
or magic.startswith(b"\xce\xfa\xed\xfe")
|
||||
or magic.startswith(b"\xfe\xed\xfa\xce")
|
||||
# universal binaries: 0xcafebabe be (most common?) or 0xbebafeca le (not sure if exists).
|
||||
# Here we need to disambiguate mach-o and JVM class files. In mach-o the next 4 bytes are
|
||||
# the number of binaries; in JVM class files it's the java version number. We assume there
|
||||
# are less than 10 binaries in a universal binary.
|
||||
or (magic.startswith(b"\xCA\xFE\xBA\xBE") and int.from_bytes(magic[4:8], "big") < 10)
|
||||
or (magic.startswith(b"\xBE\xBA\xFE\xCA") and int.from_bytes(magic[4:8], "little") < 10)
|
||||
or (magic.startswith(b"\xca\xfe\xba\xbe") and int.from_bytes(magic[4:8], "big") < 10)
|
||||
or (magic.startswith(b"\xbe\xba\xfe\xca") and int.from_bytes(magic[4:8], "little") < 10)
|
||||
)
|
||||
|
||||
|
||||
def is_elf_magic(magic: bytes) -> bool:
|
||||
return magic.startswith(b"\x7FELF")
|
||||
return magic.startswith(b"\x7fELF")
|
||||
|
||||
|
||||
def is_binary(filename: str) -> bool:
|
||||
|
@ -2706,7 +2706,7 @@ def name_and_dependency_types(s: str) -> Tuple[str, dt.DepFlag]:
|
||||
return name, depflag
|
||||
|
||||
def spec_and_dependency_types(
|
||||
s: Union[Spec, Tuple[Spec, str]]
|
||||
s: Union[Spec, Tuple[Spec, str]],
|
||||
) -> Tuple[Spec, dt.DepFlag]:
|
||||
"""Given a non-string key in the literal, extracts the spec
|
||||
and its dependency types.
|
||||
|
@ -190,7 +190,6 @@ def test_environment_cant_modify_environments_root(tmpdir):
|
||||
@pytest.mark.parametrize(
|
||||
"original_content",
|
||||
[
|
||||
(
|
||||
"""\
|
||||
spack:
|
||||
specs:
|
||||
@ -199,7 +198,6 @@ def test_environment_cant_modify_environments_root(tmpdir):
|
||||
- - a
|
||||
concretizer:
|
||||
unify: false"""
|
||||
)
|
||||
],
|
||||
)
|
||||
def test_roundtrip_spack_yaml_with_comments(original_content, mock_packages, config, tmp_path):
|
||||
|
@ -557,7 +557,7 @@ def test_combine_phase_logs(tmpdir):
|
||||
|
||||
def test_combine_phase_logs_does_not_care_about_encoding(tmpdir):
|
||||
# this is invalid utf-8 at a minimum
|
||||
data = b"\x00\xF4\xBF\x00\xBF\xBF"
|
||||
data = b"\x00\xf4\xbf\x00\xbf\xbf"
|
||||
input = [str(tmpdir.join("a")), str(tmpdir.join("b"))]
|
||||
output = str(tmpdir.join("c"))
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.directives
|
||||
import spack.directives_meta
|
||||
import spack.paths
|
||||
import spack.repo
|
||||
|
@ -2,8 +2,7 @@
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
"""Non-fixture utilities for test code. Must be imported.
|
||||
"""
|
||||
"""Non-fixture utilities for test code. Must be imported."""
|
||||
from spack.main import make_argument_parser
|
||||
|
||||
|
||||
|
@ -33,5 +33,5 @@ class LibpressioNvcomp(CMakePackage, CudaPackage):
|
||||
|
||||
def cmake_args(self):
|
||||
cuda_arch = self.spec.variants["cuda_arch"].value
|
||||
args = [("-DCMAKE_CUDA_ARCHITECTURES=%s" % cuda_arch)]
|
||||
args = ["-DCMAKE_CUDA_ARCHITECTURES=%s" % cuda_arch]
|
||||
return args
|
||||
|
Loading…
Reference in New Issue
Block a user