Skip to content

Commit

Permalink
Merge branch 'feature/v0.2.4' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Jun 27, 2024
2 parents ff4a27e + a228af4 commit 033fef7
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 26 deletions.
19 changes: 10 additions & 9 deletions colour_hdri/process/dng.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
"read_dng_files_exif_tags",
]

LOGGER = logging.getLogger(__name__)

_IS_MACOS_PLATFORM: bool = platform.system() == "Darwin"
"""Whether the current platform is *macOS*."""

Expand Down Expand Up @@ -267,9 +269,10 @@ def convert_raw_files_to_dng_files(
if path_exists(dng_file):
os.remove(dng_file)

logging.info(
'Converting "{raw_file}" file to "{dng_file}" file.',
extra={"raw_file": raw_file, "dng_file": dng_file},
LOGGER.info(
'Converting "%s" file to "%s" file.',
raw_file,
dng_file,
)

command = [
Expand Down Expand Up @@ -329,12 +332,10 @@ def convert_dng_files_to_intermediate_files(
if path_exists(intermediate_file):
os.remove(intermediate_file)

logging.info(
'Converting "{dng_file}" file to "{intermediate_file}" file.',
extra={
"dng_file": dng_file,
"intermediate_file": intermediate_file,
},
LOGGER.info(
'Converting "%s" file to "%s" file.',
dng_file,
intermediate_file,
)

command = [
Expand Down
27 changes: 15 additions & 12 deletions colour_hdri/utilities/exif.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
"write_exif_tag",
]

LOGGER = logging.getLogger(__name__)

_IS_WINDOWS_PLATFORM: bool = platform.system() in ("Windows", "Microsoft")
"""Whether the current platform is *Windows*."""

Expand Down Expand Up @@ -252,7 +254,7 @@ def read_exif_tags(image: str) -> defaultdict:
EXIF tags.
"""

logging.info("Reading '{image}' image EXIF data.", extra={"image": image})
LOGGER.info('Reading "%s" image EXIF data.', image)

exif_tags = vivification()
lines = str(
Expand Down Expand Up @@ -295,10 +297,7 @@ def copy_exif_tags(source: str, target: str) -> bool:
Definition success.
"""

logging.info(
"Copying '{source}' file EXIF data to '{target}' file.",
extra={"source": source, "target": target},
)
LOGGER.info('Copying "%s" file EXIF data to "%s" file.', source, target)

arguments = [EXIF_EXECUTABLE, "-overwrite_original", "-TagsFromFile"]
arguments += [source, target]
Expand Down Expand Up @@ -348,7 +347,7 @@ def delete_exif_tags(image: str) -> bool:
Definition success.
"""

logging.info("Deleting '{image}' image EXIF tags.", extra={"image": image})
LOGGER.info('Deleting "%s" image EXIF tags.', image)

subprocess.check_output(
[EXIF_EXECUTABLE, "-overwrite_original", "-all=", image],
Expand Down Expand Up @@ -389,9 +388,11 @@ def read_exif_tag(image: str, tag: str) -> str:
.strip()
)

logging.info(
"Reading '{image}' image '{tag}' EXIF tag value: '{value}'",
extra={"image": image, "tag": tag, "value": value},
LOGGER.info(
'Reading "%s" image "%s" EXIF tag value: "%s"',
image,
tag,
value,
)

return value
Expand All @@ -416,9 +417,11 @@ def write_exif_tag(image: str, tag: str, value: str) -> bool:
Definition success.
"""

logging.info(
"Writing '{image}' image '{tag}' EXIF tag with '{value}' value.",
extra={"image": image, "tag": tag, "value": value},
LOGGER.info(
'Writing "%s" image "%s" EXIF tag with "%s" value.',
image,
tag,
value,
)

arguments = [EXIF_EXECUTABLE, "-overwrite_original"]
Expand Down
6 changes: 4 additions & 2 deletions colour_hdri/utilities/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
"ImageStack",
]

LOGGER = logging.getLogger(__name__)


@dataclass
class Metadata(MixinDataclassArray):
Expand Down Expand Up @@ -246,7 +248,7 @@ def read_data(self, cctf_decoding: Callable | None = None) -> NDArrayFloat:
"""

if self._path is not None:
logging.info('Reading "{path}" image.', extra={"path": self._path})
LOGGER.info('Reading "%s" image.', self._path)

data = read_image(str(self._path))
if cctf_decoding is not None:
Expand Down Expand Up @@ -274,7 +276,7 @@ def read_metadata(self) -> Metadata:
"""

if self._path is not None:
logging.info('Reading "{path}" image metadata.', extra={"path": self._path})
LOGGER.info('Reading "%s" image metadata.', self._path)

exif_data = read_exif_tags(self._path)

Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ exclude = [
]

[tool.poetry.dependencies]
python = ">= 3.9, < 3.13"
python = ">= 3.10, < 3.13"
colour-science = ">= 0.4.4"
imageio = ">= 2, < 3"
numpy = ">= 1.22, < 2"
scipy = ">= 1.8, < 2"
numpy = ">= 1.24, < 2"
scipy = ">= 1.10, < 2"
typing-extensions = ">= 4, < 5"

[tool.poetry.group.optional.dependencies]
Expand Down

0 comments on commit 033fef7

Please sign in to comment.