From a4adb87fa8711478004e7fa008fc0e31b58744cd Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Thu, 27 Jun 2024 17:46:18 +1200 Subject: [PATCH 1/2] Update logging statements. --- colour_hdri/process/dng.py | 19 ++++++++++--------- colour_hdri/utilities/exif.py | 27 +++++++++++++++------------ colour_hdri/utilities/image.py | 6 ++++-- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/colour_hdri/process/dng.py b/colour_hdri/process/dng.py index 37bdaa3..023d3ba 100644 --- a/colour_hdri/process/dng.py +++ b/colour_hdri/process/dng.py @@ -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*.""" @@ -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 = [ @@ -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 = [ diff --git a/colour_hdri/utilities/exif.py b/colour_hdri/utilities/exif.py index 95029c7..ac5d66c 100644 --- a/colour_hdri/utilities/exif.py +++ b/colour_hdri/utilities/exif.py @@ -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*.""" @@ -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( @@ -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] @@ -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], @@ -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 @@ -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"] diff --git a/colour_hdri/utilities/image.py b/colour_hdri/utilities/image.py index bc449ad..65333cf 100644 --- a/colour_hdri/utilities/image.py +++ b/colour_hdri/utilities/image.py @@ -58,6 +58,8 @@ "ImageStack", ] +LOGGER = logging.getLogger(__name__) + @dataclass class Metadata(MixinDataclassArray): @@ -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: @@ -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) From a228af4d2b120b95fdd7c7490455c0e792b606f7 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Thu, 27 Jun 2024 17:48:57 +1200 Subject: [PATCH 2/2] Raise various minimum dependency versions. - *Python*: 3.10 - *Numpy*: 1.24 - *Scipy*: 1.10 - *Matplotlib*: 3.6 --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bb2e7b0..48e167c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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]