Skip to content

Commit 61a3bb4

Browse files
committed
STYLE: Apply black formatting to build scripts
Black 24.10.0 (pinned in .pre-commit-config.yaml) collapses parenthesized line-wraps that now fit on one line and drops redundant string escapes.
1 parent 468e8dc commit 61a3bb4

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

Utilities/scripts/build_all_latest_wheels.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ def run(cmd: list[str], **kwargs) -> subprocess.CompletedProcess:
2121
return subprocess.run(cmd, check=True, **kwargs)
2222

2323

24-
def clone(repo: str, dest: Path, branch: str | None = None, depth: int | None = 1) -> bool:
24+
def clone(
25+
repo: str, dest: Path, branch: str | None = None, depth: int | None = 1
26+
) -> bool:
2527
cmd = ["git", "clone"]
2628
if depth is not None:
2729
cmd += ["--depth", str(depth)]

scripts/build_python_instance_base.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -728,9 +728,7 @@ def _update_module_itk_deps(pyproject_path: Path, itk_version: str) -> bool:
728728
pyproject_data = tomllib.load(f)
729729

730730
# --- Strategy 3: module declares dynamic dependencies -----------------
731-
dynamic_fields = (
732-
pyproject_data.get("project", {}).get("dynamic", [])
733-
)
731+
dynamic_fields = pyproject_data.get("project", {}).get("dynamic", [])
734732
if "dependencies" in dynamic_fields:
735733
# The module has opted into dynamic dependency resolution.
736734
# Set ITK_PACKAGE_VERSION in the environment so the
@@ -739,7 +737,7 @@ def _update_module_itk_deps(pyproject_path: Path, itk_version: str) -> bool:
739737
os.environ["ITK_PACKAGE_VERSION"] = itk_version
740738
print(
741739
f"Strategy 3: {pyproject_path.name} declares "
742-
f"dynamic=[\"dependencies\"]; set ITK_PACKAGE_VERSION="
740+
f'dynamic=["dependencies"]; set ITK_PACKAGE_VERSION='
743741
f"{itk_version} for metadata provider"
744742
)
745743
return False # no file modification needed
@@ -760,9 +758,7 @@ def _update_module_itk_deps(pyproject_path: Path, itk_version: str) -> bool:
760758
"itk-segmentation",
761759
)
762760
_base_pkg_alt = "|".join(re.escape(p) for p in _ITK_BASE_PACKAGES)
763-
pattern = re.compile(
764-
rf'"({_base_pkg_alt})\s*==\s*[\d]+\.[\d]+\.\*"'
765-
)
761+
pattern = re.compile(rf'"({_base_pkg_alt})\s*==\s*[\d]+\.[\d]+\.\*"')
766762

767763
# Warn about pinned remote-module cross-deps that may also need
768764
# attention but should not be auto-rewritten.
@@ -790,6 +786,7 @@ def _update_module_itk_deps(pyproject_path: Path, itk_version: str) -> bool:
790786
min_floor = itk_version
791787

792788
changed = False
789+
793790
def _replace(m: re.Match) -> str:
794791
nonlocal changed
795792
changed = True
@@ -822,9 +819,7 @@ def build_external_module_python_wheel(self):
822819
itk_ver = self.package_env_config.get("ITK_PACKAGE_VERSION", "")
823820
if itk_ver:
824821
shutil.copy2(module_pyproject, pyproject_orig)
825-
deps_rewritten = self._update_module_itk_deps(
826-
module_pyproject, itk_ver
827-
)
822+
deps_rewritten = self._update_module_itk_deps(module_pyproject, itk_ver)
828823

829824
# Ensure venv tools are first in PATH
830825
py_exe = str(self.package_env_config["PYTHON_EXECUTABLE"]) # Python3_EXECUTABLE

0 commit comments

Comments
 (0)