Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion colour_hdri/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions colour_hdri/distortion/vignette.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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, ...]),
)

Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions colour_hdri/network/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
11 changes: 4 additions & 7 deletions colour_hdri/network/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']}"
)
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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"):
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion colour_hdri/sampling/variance_minimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
)

Expand Down
2 changes: 1 addition & 1 deletion colour_hdri/tonemapping/global_operators/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
7 changes: 3 additions & 4 deletions colour_hdri/utilities/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!'

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions colour_hdri/utilities/tests/test_exif.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion utilities/export_todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] = []
Expand Down
Loading