From 4466fbc2dd1d9424fa3669bb427663a0d5d0abe2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Oct 2025 22:06:30 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v5.0.0 → v6.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v5.0.0...v6.0.0) - [github.com/codespell-project/codespell: v2.3.0 → v2.4.1](https://github.com/codespell-project/codespell/compare/v2.3.0...v2.4.1) - [github.com/PyCQA/isort: 5.13.2 → 7.0.0](https://github.com/PyCQA/isort/compare/5.13.2...7.0.0) - [github.com/astral-sh/ruff-pre-commit: v0.8.2 → v0.14.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.2...v0.14.0) - [github.com/adamchainz/blacken-docs: 1.19.1 → 1.20.0](https://github.com/adamchainz/blacken-docs/compare/1.19.1...1.20.0) --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5b884e0e..2111b650 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: "v5.0.0" + rev: "v6.0.0" hooks: - id: check-added-large-files - id: check-case-conflict @@ -15,23 +15,23 @@ repos: - id: requirements-txt-fixer - id: trailing-whitespace - repo: https://github.com/codespell-project/codespell - rev: v2.3.0 + rev: v2.4.1 hooks: - id: codespell args: ["--ignore-words-list=socio-economic"] exclude: "BIBLIOGRAPHY.bib|CONTRIBUTORS.rst|.*.ipynb" - repo: https://github.com/PyCQA/isort - rev: "5.13.2" + rev: "7.0.0" hooks: - id: isort - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.8.2" + rev: "v0.14.0" hooks: - id: ruff-format - id: ruff args: [--fix] - repo: https://github.com/adamchainz/blacken-docs - rev: 1.19.1 + rev: 1.20.0 hooks: - id: blacken-docs language_version: python3.10 From ffee406febad12d2e61524f893f9e220567e6675 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Oct 2025 22:07:28 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- colour_hdri/__init__.py | 2 +- colour_hdri/distortion/vignette.py | 6 +++--- colour_hdri/network/graphs.py | 3 +-- colour_hdri/network/nodes.py | 11 ++++------- colour_hdri/sampling/variance_minimization.py | 2 +- colour_hdri/tonemapping/global_operators/operators.py | 2 +- colour_hdri/utilities/image.py | 7 +++---- colour_hdri/utilities/tests/test_exif.py | 6 +----- utilities/export_todo.py | 2 +- 9 files changed, 16 insertions(+), 25 deletions(-) diff --git a/colour_hdri/__init__.py b/colour_hdri/__init__.py index 9c9bb102..50db616d 100644 --- a/colour_hdri/__init__.py +++ b/colour_hdri/__init__.py @@ -335,7 +335,7 @@ def __getattr__(self, attribute: str) -> Any: try: _version: str = ( - subprocess.check_output( # noqa: S603 + subprocess.check_output( ["git", "describe"], # noqa: S607 cwd=os.path.dirname(__file__), stderr=subprocess.STDOUT, diff --git a/colour_hdri/distortion/vignette.py b/colour_hdri/distortion/vignette.py index 3613ea8d..fb26d4ae 100644 --- a/colour_hdri/distortion/vignette.py +++ b/colour_hdri/distortion/vignette.py @@ -148,7 +148,7 @@ def apply_radial_gradient( scale_x, scale_y = tsplit(scale) offset_x, offset_y = tsplit(offset) - height, width = cast(Tuple, image.shape)[0:2] + height, width = cast("Tuple", image.shape)[0:2] ratio = height / width samples_x = np.linspace(-1, 1, height) @@ -159,7 +159,7 @@ def apply_radial_gradient( samples_y += offset_y - 0.5 distance = cast( - NDArrayFloat, + "NDArrayFloat", np.sqrt((samples_x**2)[..., None] + (samples_y**2)[None, ...]), ) @@ -797,7 +797,7 @@ def vignette_sampling_coordinates( radial_samples = radial_sampling_function( samples_rho, samples_phi, - cast(float, 1 + (np.max(principal_point - 0.5) * 2)), + cast("float", 1 + (np.max(principal_point - 0.5) * 2)), radial_bias, ) # NOTE: Some randomisation is required to avoid a diff --git a/colour_hdri/network/graphs.py b/colour_hdri/network/graphs.py index 60ab8846..fc066898 100644 --- a/colour_hdri/network/graphs.py +++ b/colour_hdri/network/graphs.py @@ -76,8 +76,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.description = ( - 'Process given raw file, e.g., "CR2", "CR3", "NEF", using the' - '"DNG" method' + 'Process given raw file, e.g., "CR2", "CR3", "NEF", using the"DNG" method' ) self.add_input_port("index") diff --git a/colour_hdri/network/nodes.py b/colour_hdri/network/nodes.py index 608638f2..84d14a11 100644 --- a/colour_hdri/network/nodes.py +++ b/colour_hdri/network/nodes.py @@ -572,7 +572,7 @@ def process(self, **kwargs: Any) -> None: # noqa: ARG002 if self.get_input("include_exposure_information"): text += ( " - " - f"{exif_group['Exposure Time']:.6f}\" " + f'{exif_group["Exposure Time"]:.6f}" ' f"f{exif_group['F Number']} " f"{exif_group['ISO']}" ) @@ -752,8 +752,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.description = ( - "Compute the input transform from the input metadata using the " - '"DNG" method' + 'Compute the input transform from the input metadata using the "DNG" method' ) self.add_input_port("metadata") @@ -1150,8 +1149,7 @@ def process(self, **kwargs: Any) -> None: # noqa: ARG002 self.log("Lens vignette was successfully corrected!") else: self.log( - "Lens vignette was not corrected, " - "the lens might be missing data." + "Lens vignette was not corrected, the lens might be missing data." ) if self.get_input("correct_chromatic_aberration"): @@ -1198,8 +1196,7 @@ def process(self, **kwargs: Any) -> None: # noqa: ARG002 self.log("Lens distortion was successfully corrected!") else: self.log( - "Lens distortion was not corrected, " - "the lens might be missing data." + "Lens distortion was not corrected, the lens might be missing data." ) self.set_output("output_image", output_image) diff --git a/colour_hdri/sampling/variance_minimization.py b/colour_hdri/sampling/variance_minimization.py index e5f73c93..fabafe05 100644 --- a/colour_hdri/sampling/variance_minimization.py +++ b/colour_hdri/sampling/variance_minimization.py @@ -248,7 +248,7 @@ def light_probe_sampling_variance_minimization_Viriyothai2009( iterations = np.sqrt(lights_count).astype(np.int_) if iterations**2 != lights_count: warning( - f"{lights_count} lights requested, {iterations ** 2} will be " + f"{lights_count} lights requested, {iterations**2} will be " f"effectively computed!" ) diff --git a/colour_hdri/tonemapping/global_operators/operators.py b/colour_hdri/tonemapping/global_operators/operators.py index 9d338147..a440018e 100644 --- a/colour_hdri/tonemapping/global_operators/operators.py +++ b/colour_hdri/tonemapping/global_operators/operators.py @@ -855,4 +855,4 @@ def f( RGB = f(RGB * exposure_bias, A, B, C, D, E, F) - return cast(NDArrayFloat, RGB * (1 / f(linear_whitepoint, A, B, C, D, E, F))) + return cast("NDArrayFloat", RGB * (1 / f(linear_whitepoint, A, B, C, D, E, F))) diff --git a/colour_hdri/utilities/image.py b/colour_hdri/utilities/image.py index 0acda9be..4c14ef84 100644 --- a/colour_hdri/utilities/image.py +++ b/colour_hdri/utilities/image.py @@ -263,7 +263,7 @@ def read_data(self, cctf_decoding: Callable | None = None) -> NDArrayFloat: self.data = data - return cast(NDArrayFloat, data) + return cast("NDArrayFloat", data) exception = 'The image "path" is undefined!' @@ -309,8 +309,7 @@ def read_metadata(self) -> Metadata: if not exif_data.get("EXIF"): warning( - f'"{self._path}" file has no "Exif" data, metadata will ' - f"be undefined!" + f'"{self._path}" file has no "Exif" data, metadata will be undefined!' ) self.metadata = Metadata(*[None] * 6) return self.metadata @@ -369,7 +368,7 @@ def read_metadata(self) -> Metadata: def _luminance_average_key(image: Image) -> NDArrayFloat | None: """Comparison key function.""" - metadata = cast(Metadata, image.metadata) + metadata = cast("Metadata", image.metadata) f_number = metadata.f_number exposure_time = metadata.exposure_time diff --git a/colour_hdri/utilities/tests/test_exif.py b/colour_hdri/utilities/tests/test_exif.py index 0265f46f..94131747 100644 --- a/colour_hdri/utilities/tests/test_exif.py +++ b/colour_hdri/utilities/tests/test_exif.py @@ -120,11 +120,7 @@ def test_parse_exif_array(self) -> None: exif_tag = EXIFTag( "EXIF", "Color Matrix 1", - ( - "0.5309 -0.0229 -0.0336 " - "-0.6241 1.3265 0.3337 " - "-0.0817 0.1215 0.6664" - ), + ("0.5309 -0.0229 -0.0336 -0.6241 1.3265 0.3337 -0.0817 0.1215 0.6664"), "50721", ) np.testing.assert_array_equal( diff --git a/utilities/export_todo.py b/utilities/export_todo.py index d022933d..4ed23bb7 100755 --- a/utilities/export_todo.py +++ b/utilities/export_todo.py @@ -81,7 +81,7 @@ def extract_todo_items(root_directory: str) -> dict: if in_todo and line.startswith("#"): todo_item.append(line.replace("#", "").strip()) - elif len(todo_item): + elif todo_item: key = filename.replace("../", "") if not todo_items.get(key): todo_items[key] = []