From 9937dee02abf52f9dcad9bdfd9e2dffc694e917f Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Sat, 14 Jan 2023 07:17:24 +1300 Subject: [PATCH 01/26] Update "pyproject.toml" file. --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 70dd90c..2ba2fc4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -115,6 +115,7 @@ development = [ "pydocstyle", "pytest", "pytest-cov", + "pytest-xdist", "pyupgrade", "restructuredtext-lint", "sphinx", From 67e5362ca183a3ff84ca0ae1d204f695690f2fd9 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Mon, 23 Jan 2023 21:27:31 +1300 Subject: [PATCH 02/26] Update "Github Actions" badge. --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index d1847bd..30e0b24 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ Colour - Datasets |actions| |coveralls| |codacy| |version| -.. |actions| image:: https://img.shields.io/github/workflow/status/colour-science/colour-datasets/Continuous%20Integration%20-%20Quality%20&%20Unit%20Tests?label=actions&logo=github&style=flat-square +.. |actions| image:: https://img.shields.io/github/actions/workflow/status/colour-science/colour-datasets/.github/workflows/continuous-integration-quality-unit-tests.yml?branch=develop&style=flat-square :target: https://github.com/colour-science/colour-datasets/actions :alt: Develop Build Status .. |coveralls| image:: http://img.shields.io/coveralls/colour-science/colour-datasets/develop.svg?style=flat-square From 2461a82ad1acf5c04b84dacce23521edb5721f5b Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Sun, 11 Dec 2022 20:35:51 +1300 Subject: [PATCH 03/26] Replace "Mypy" with "Pyright". --- .github/PULL_REQUEST_TEMPLATE.md | 4 +- ...nuous-integration-static-type-checking.yml | 2 +- .gitignore | 2 - colour_datasets/__init__.py | 2 +- colour_datasets/loaders/__init__.py | 6 +- colour_datasets/loaders/asano2015.py | 8 +-- colour_datasets/loaders/brendel2020.py | 4 +- colour_datasets/loaders/dyer2017.py | 36 ++++++------ colour_datasets/loaders/ebner1998.py | 8 +-- colour_datasets/loaders/hung1995.py | 4 +- colour_datasets/loaders/jakob2019.py | 4 +- colour_datasets/loaders/jiang2013.py | 4 +- colour_datasets/loaders/karge2015.py | 4 +- colour_datasets/loaders/kuopio.py | 6 +- colour_datasets/loaders/labsphere2019.py | 4 +- colour_datasets/loaders/luo1997.py | 4 +- colour_datasets/loaders/luo1999.py | 46 ++++++++++----- colour_datasets/loaders/tests/test_kuopio.py | 18 +++--- colour_datasets/loaders/winquist2022.py | 4 +- colour_datasets/loaders/xrite2016.py | 4 +- colour_datasets/loaders/zhao2009.py | 4 +- colour_datasets/records/configuration.py | 4 +- colour_datasets/records/zenodo.py | 22 ++++---- colour_datasets/utilities/common.py | 16 +++--- colour_datasets/utilities/spreadsheet.py | 12 ++-- docs/conf.py | 29 ++++------ pyproject.toml | 22 +++++--- requirements.txt | 19 +++---- tasks.py | 56 +++++++------------ 29 files changed, 174 insertions(+), 184 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 21ad42b..32e3642 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -15,11 +15,11 @@ is available to guide the process: https://www.colour-science.org/contributing/. **Code Style and Quality** - [ ] Unit tests have been implemented and passed. -- [ ] Mypy static checking has been run and passed. +- [ ] Pyright static checking has been run and passed. - [ ] Pre-commit hooks have been run and passed. - + **Documentation** diff --git a/.github/workflows/continuous-integration-static-type-checking.yml b/.github/workflows/continuous-integration-static-type-checking.yml index 6b834da..7cba9b6 100644 --- a/.github/workflows/continuous-integration-static-type-checking.yml +++ b/.github/workflows/continuous-integration-static-type-checking.yml @@ -26,4 +26,4 @@ jobs: pip install -r requirements.txt - name: Static Type Checking run: | - mypy --install-types --non-interactive --show-error-codes --warn-unused-ignores --warn-redundant-casts $CI_PACKAGE + pyright --skipunannotated diff --git a/.gitignore b/.gitignore index 2088310..278475e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,11 +3,9 @@ *.pyo .DS_Store .coverage -.dmypy.json .fleet .idea .ipynb_checkpoints -.mypy_cache .sandbox .vs .vscode diff --git a/colour_datasets/__init__.py b/colour_datasets/__init__.py index 90b4b20..cac6cb8 100644 --- a/colour_datasets/__init__.py +++ b/colour_datasets/__init__.py @@ -70,7 +70,7 @@ except Exception: _version = __version__ -colour.utilities.ANCILLARY_COLOUR_SCIENCE_PACKAGES[ +colour.utilities.ANCILLARY_COLOUR_SCIENCE_PACKAGES[ # pyright: ignore "colour-datasets" ] = _version diff --git a/colour_datasets/loaders/__init__.py b/colour_datasets/loaders/__init__.py index b535144..2bc25e3 100644 --- a/colour_datasets/loaders/__init__.py +++ b/colour_datasets/loaders/__init__.py @@ -2,7 +2,7 @@ import sys -from colour.hints import Any, Boolean, Integer, Union +from colour.hints import Any, Union from colour.utilities import CanonicalMapping, warning from colour_datasets.records import datasets @@ -124,7 +124,7 @@ del _module, _export -_HAS_TITLE_KEYS: Boolean = False +_HAS_TITLE_KEYS: bool = False """ Whether the :attr:`colour_datasets.loaders.DATASET_LOADERS` attribute has been updated with dataset titles. This variable is used in the one time @@ -133,7 +133,7 @@ """ -def load(dataset: Union[Integer, str]) -> Any: +def load(dataset: Union[int, str]) -> Any: """ Load given dataset: The dataset is pulled locally, i.e. synced if required and then its data is loaded. diff --git a/colour_datasets/loaders/asano2015.py b/colour_datasets/loaders/asano2015.py index cd08dbb..0bb560a 100644 --- a/colour_datasets/loaders/asano2015.py +++ b/colour_datasets/loaders/asano2015.py @@ -26,7 +26,7 @@ XYZ_ColourMatchingFunctions, LMS_ConeFundamentals, ) -from colour.hints import Boolean, Dict, NDArray, Optional, Tuple +from colour.hints import Dict, NDArrayFloat, Optional from colour.utilities import as_float_array, tstack from colour_datasets.loaders import AbstractDatasetLoader @@ -82,7 +82,7 @@ def __new__( XYZ_10: XYZ_ColourMatchingFunctions, LMS_2: LMS_ConeFundamentals, LMS_10: LMS_ConeFundamentals, - parameters: NDArray, + parameters: NDArrayFloat, others: Optional[Dict] = None, ): """ @@ -217,7 +217,7 @@ def load(self) -> Dict[str, Specification_Asano2015]: @staticmethod def parse_workbook_Asano2015( - workbook: str, template: str, observers: Tuple = (1, 10) + workbook: str, template: str, observers: tuple = (1, 10) ) -> Dict[str, Dict]: """ Parse given *Asano (2015)* *Observer Function Database* workbook. @@ -317,7 +317,7 @@ def parse_workbook_Asano2015( """ -def build_Asano2015(load: Boolean = True) -> DatasetLoader_Asano2015: +def build_Asano2015(load: bool = True) -> DatasetLoader_Asano2015: """ Singleton factory that the builds *Asano (2015)* *Observer Function Database* dataset loader. diff --git a/colour_datasets/loaders/brendel2020.py b/colour_datasets/loaders/brendel2020.py index 8421704..4c2f68a 100644 --- a/colour_datasets/loaders/brendel2020.py +++ b/colour_datasets/loaders/brendel2020.py @@ -21,7 +21,7 @@ import os from colour import LinearInterpolator, SpectralShape, SpectralDistribution -from colour.hints import Boolean, Dict, Optional +from colour.hints import Dict, Optional from colour.utilities import as_int from colour_datasets.loaders import AbstractDatasetLoader @@ -115,7 +115,7 @@ def load(self) -> Dict[str, SpectralDistribution]: """ -def build_Brendel2020(load: Boolean = True) -> DatasetLoader_Brendel2020: +def build_Brendel2020(load: bool = True) -> DatasetLoader_Brendel2020: """ Singleton factory that builds the *Brendel (2020)* *Measured Commercial LED Spectra* dataset loader. diff --git a/colour_datasets/loaders/dyer2017.py b/colour_datasets/loaders/dyer2017.py index 5055ab0..5bacda4 100644 --- a/colour_datasets/loaders/dyer2017.py +++ b/colour_datasets/loaders/dyer2017.py @@ -24,9 +24,7 @@ from colour.continuous import MultiSignals, Signal from colour.hints import ( Any, - Boolean, Dict, - Floating, Literal, Optional, Type, @@ -569,8 +567,8 @@ def __init__( transmission_geometry: Optional[ Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"] ] = None, - bandwidth_FWHM: Optional[Floating] = None, - bandwidth_corrected: Optional[Boolean] = None, + bandwidth_FWHM: Optional[float] = None, + bandwidth_corrected: Optional[bool] = None, ) -> None: super().__init__() @@ -616,9 +614,9 @@ def __init__( Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"] ] = None self.transmission_geometry = transmission_geometry - self._bandwidth_FWHM: Optional[Floating] = None + self._bandwidth_FWHM: Optional[float] = None self.bandwidth_FWHM = bandwidth_FWHM - self._bandwidth_corrected: Optional[Boolean] = None + self._bandwidth_corrected: Optional[bool] = None self.bandwidth_corrected = bandwidth_corrected @property @@ -847,7 +845,7 @@ def transmission_geometry( self._transmission_geometry = value @property - def bandwidth_FWHM(self) -> Optional[Floating]: + def bandwidth_FWHM(self) -> Optional[float]: """ Getter and setter property for the full-width half-maximum bandwidth. @@ -865,7 +863,7 @@ def bandwidth_FWHM(self) -> Optional[Floating]: return self._bandwidth_FWHM @bandwidth_FWHM.setter - def bandwidth_FWHM(self, value: Optional[Floating]): + def bandwidth_FWHM(self, value: Optional[float]): """Setter for the **self.bandwidth_FWHM** property.""" if value is not None: @@ -877,7 +875,7 @@ def bandwidth_FWHM(self, value: Optional[Floating]): self._bandwidth_FWHM = value @property - def bandwidth_corrected(self) -> Optional[Boolean]: + def bandwidth_corrected(self) -> Optional[bool]: """ Getter and setter property for whether bandwidth correction has been applied to the measured data. @@ -896,7 +894,7 @@ def bandwidth_corrected(self) -> Optional[Boolean]: return self._bandwidth_corrected @bandwidth_corrected.setter - def bandwidth_corrected(self, value: Optional[Boolean]): + def bandwidth_corrected(self, value: Optional[bool]): """Setter for the **self.bandwidth_corrected** property.""" if value is not None: @@ -1077,8 +1075,8 @@ def __init__( transmission_geometry: Optional[ Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"] ] = None, - bandwidth_FWHM: Optional[Floating] = None, - bandwidth_corrected: Optional[Boolean] = None, + bandwidth_FWHM: Optional[float] = None, + bandwidth_corrected: Optional[bool] = None, ) -> None: super().__init__() @@ -1124,9 +1122,9 @@ def __init__( Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"] ] = None self.transmission_geometry = transmission_geometry - self._bandwidth_FWHM: Optional[Floating] = None + self._bandwidth_FWHM: Optional[float] = None self.bandwidth_FWHM = bandwidth_FWHM - self._bandwidth_corrected: Optional[Boolean] = None + self._bandwidth_corrected: Optional[bool] = None self.bandwidth_corrected = bandwidth_corrected @property @@ -1355,7 +1353,7 @@ def transmission_geometry( self._transmission_geometry = value @property - def bandwidth_FWHM(self) -> Optional[Floating]: + def bandwidth_FWHM(self) -> Optional[float]: """ Getter and setter property for the full-width half-maximum bandwidth. @@ -1373,7 +1371,7 @@ def bandwidth_FWHM(self) -> Optional[Floating]: return self._bandwidth_FWHM @bandwidth_FWHM.setter - def bandwidth_FWHM(self, value: Optional[Floating]): + def bandwidth_FWHM(self, value: Optional[float]): """Setter for the **self.bandwidth_FWHM** property.""" if value is not None: @@ -1385,7 +1383,7 @@ def bandwidth_FWHM(self, value: Optional[Floating]): self._bandwidth_FWHM = value @property - def bandwidth_corrected(self) -> Optional[Boolean]: + def bandwidth_corrected(self) -> Optional[bool]: """ Getter and setter property for whether bandwidth correction has been applied to the measured data. @@ -1404,7 +1402,7 @@ def bandwidth_corrected(self) -> Optional[Boolean]: return self._bandwidth_corrected @bandwidth_corrected.setter - def bandwidth_corrected(self, value: Optional[Boolean]): + def bandwidth_corrected(self, value: Optional[bool]): """Setter for the **self.bandwidth_corrected** property.""" if value is not None: @@ -1566,7 +1564,7 @@ def load( """ -def build_Dyer2017(load: Boolean = True) -> DatasetLoader_Dyer2017: +def build_Dyer2017(load: bool = True) -> DatasetLoader_Dyer2017: """ Singleton factory that builds the *Dyer et al. (2017)* *RAW to ACES Utility Data* dataset loader. diff --git a/colour_datasets/loaders/ebner1998.py b/colour_datasets/loaders/ebner1998.py index bb2f85c..833a239 100644 --- a/colour_datasets/loaders/ebner1998.py +++ b/colour_datasets/loaders/ebner1998.py @@ -23,7 +23,7 @@ import os from collections import namedtuple -from colour.hints import Boolean, Dict, Integer, NDArray, Optional +from colour.hints import Dict, NDArrayFloat, Optional from colour.utilities import as_float_array from colour_datasets.loaders import AbstractDatasetLoader @@ -98,7 +98,7 @@ def __init__(self) -> None: def load( self, - ) -> Dict[str, Dict[Integer, ConstantPerceivedHueColourMatches_Ebner1998]]: + ) -> Dict[str, Dict[int, ConstantPerceivedHueColourMatches_Ebner1998]]: """ Sync, parse, convert and return the *Ebner and Fairchild (1998)* *Constant Perceived-Hue Data* dataset content. @@ -128,7 +128,7 @@ def load( self.record.repository, "dataset", "Ebner_Constant_Hue_Data.txt" ) - def _parse_float_values(data: str) -> NDArray: + def _parse_float_values(data: str) -> NDArrayFloat: """Parse float values from given data.""" values = np.reshape( @@ -173,7 +173,7 @@ def _parse_float_values(data: str) -> NDArray: """ -def build_Ebner1998(load: Boolean = True) -> DatasetLoader_Ebner1998: +def build_Ebner1998(load: bool = True) -> DatasetLoader_Ebner1998: """ Singleton factory that builds the *Ebner and Fairchild (1998)* *Constant Perceived-Hue Data* dataset loader. diff --git a/colour_datasets/loaders/hung1995.py b/colour_datasets/loaders/hung1995.py index 7c512de..f46d87d 100644 --- a/colour_datasets/loaders/hung1995.py +++ b/colour_datasets/loaders/hung1995.py @@ -23,7 +23,7 @@ from collections import namedtuple from colour import CCS_ILLUMINANTS, xy_to_XYZ, xyY_to_XYZ -from colour.hints import Boolean, Dict, Optional +from colour.hints import Dict, Optional from colour_datasets.loaders import AbstractDatasetLoader from colour_datasets.records import datasets @@ -216,7 +216,7 @@ def load( """ -def build_Hung1995(load: Boolean = True) -> DatasetLoader_Hung1995: +def build_Hung1995(load: bool = True) -> DatasetLoader_Hung1995: """ Singleton factory that builds the *Hung and Berns (1995)* *Constant Hue Loci Data* dataset loader. diff --git a/colour_datasets/loaders/jakob2019.py b/colour_datasets/loaders/jakob2019.py index f0bad7e..0b15994 100644 --- a/colour_datasets/loaders/jakob2019.py +++ b/colour_datasets/loaders/jakob2019.py @@ -20,7 +20,7 @@ import glob import os -from colour.hints import Boolean, Dict, Optional +from colour.hints import Dict, Optional from colour.recovery import LUT3D_Jakob2019 from colour_datasets.loaders import AbstractDatasetLoader @@ -124,7 +124,7 @@ def load(self) -> Dict[str, LUT3D_Jakob2019]: """ -def build_Jakob2019(load: Boolean = True) -> DatasetLoader_Jakob2019: +def build_Jakob2019(load: bool = True) -> DatasetLoader_Jakob2019: """ Singleton factory that builds the *Jakob and Hanika (2019)* *Spectral Upsampling Coefficient Tables* dataset loader. diff --git a/colour_datasets/loaders/jiang2013.py b/colour_datasets/loaders/jiang2013.py index bff0fd2..80752e4 100644 --- a/colour_datasets/loaders/jiang2013.py +++ b/colour_datasets/loaders/jiang2013.py @@ -25,7 +25,7 @@ from colour import SpectralShape from colour.characterisation import RGB_CameraSensitivities -from colour.hints import Boolean, Dict, Optional +from colour.hints import Dict, Optional from colour.utilities import as_float_array from colour_datasets.loaders import AbstractDatasetLoader @@ -131,7 +131,7 @@ def load(self) -> Dict[str, RGB_CameraSensitivities]: """ -def build_Jiang2013(load: Boolean = True) -> DatasetLoader_Jiang2013: +def build_Jiang2013(load: bool = True) -> DatasetLoader_Jiang2013: """ Singleton factory that builds the *Jiang et al. (2013)* *Camera Spectral Sensitivity Database* dataset loader. diff --git a/colour_datasets/loaders/karge2015.py b/colour_datasets/loaders/karge2015.py index 8832dee..7c09d83 100644 --- a/colour_datasets/loaders/karge2015.py +++ b/colour_datasets/loaders/karge2015.py @@ -23,7 +23,7 @@ from collections import defaultdict from colour.algebra import LinearInterpolator -from colour.hints import Boolean, Dict, Optional +from colour.hints import Dict, Optional from colour.io import read_sds_from_csv_file from colour_datasets.loaders import AbstractDatasetLoader @@ -131,7 +131,7 @@ def load(self) -> Dict[str, Dict[str, Dict]]: """ -def build_Karge2015(load: Boolean = True) -> DatasetLoader_Karge2015: +def build_Karge2015(load: bool = True) -> DatasetLoader_Karge2015: """ Singleton factory that builds the *Karge et al. (2015)* *Spectral Database of Commonly Used Cine Lighting* dataset loader. diff --git a/colour_datasets/loaders/kuopio.py b/colour_datasets/loaders/kuopio.py index 42d7010..585565d 100644 --- a/colour_datasets/loaders/kuopio.py +++ b/colour_datasets/loaders/kuopio.py @@ -44,7 +44,7 @@ from collections import namedtuple from colour import SpectralDistribution, SpectralShape -from colour.hints import Any, Boolean, Dict, Tuple, Type, cast +from colour.hints import Any, Dict, Tuple, Type, cast from colour_datasets.loaders import AbstractDatasetLoader from colour_datasets.records import datasets @@ -275,7 +275,7 @@ class instances. def build_KuopioUniversity( dataset_loader_class: Type[DatasetLoader_KuopioUniversity], - load: Boolean = True, + load: bool = True, ) -> DatasetLoader_KuopioUniversity: """ Singleton factory that builds a *University of Kuopio* dataset loader. @@ -499,7 +499,7 @@ def build_KuopioUniversity( for _id, _data in DATA_KUOPIO_UNIVERSITY.items(): _module = sys.modules["colour_datasets.loaders.kuopio"] _dataset_loader_class = _build_dataset_loader_class_KuopioUniversity( - _id, *_data + _id, *_data # pyright: ignore ) _partial_function = functools.partial( build_KuopioUniversity, _dataset_loader_class diff --git a/colour_datasets/loaders/labsphere2019.py b/colour_datasets/loaders/labsphere2019.py index 541006a..ff26c65 100644 --- a/colour_datasets/loaders/labsphere2019.py +++ b/colour_datasets/loaders/labsphere2019.py @@ -18,7 +18,7 @@ import os from colour import SpectralDistribution -from colour.hints import Boolean, Dict, Optional +from colour.hints import Dict, Optional from colour.utilities import tsplit from colour_datasets.loaders import AbstractDatasetLoader @@ -110,7 +110,7 @@ def load(self) -> Dict[str, SpectralDistribution]: """ -def build_Labsphere2019(load: Boolean = True) -> DatasetLoader_Labsphere2019: +def build_Labsphere2019(load: bool = True) -> DatasetLoader_Labsphere2019: """ Singleton factory that builds the *Labsphere (2019)* *Labsphere SRS-99-020* dataset loader. diff --git a/colour_datasets/loaders/luo1997.py b/colour_datasets/loaders/luo1997.py index 7b27d3d..5590637 100644 --- a/colour_datasets/loaders/luo1997.py +++ b/colour_datasets/loaders/luo1997.py @@ -35,7 +35,7 @@ import os from collections import namedtuple -from colour.hints import Boolean, Dict, Optional, Tuple +from colour.hints import Dict, Optional, Tuple from colour.utilities import as_float_array, usage_warning from colour_datasets.loaders import AbstractDatasetLoader @@ -1112,7 +1112,7 @@ def load(self) -> Dict[str, ExperimentalGroupLuo1997]: """ -def build_Luo1997(load: Boolean = True) -> DatasetLoader_Luo1997: +def build_Luo1997(load: bool = True) -> DatasetLoader_Luo1997: """ Singleton factory that the builds *Luo and Rhodes (1997)* *LUTCHI Colour Appearance Data* dataset loader. diff --git a/colour_datasets/loaders/luo1999.py b/colour_datasets/loaders/luo1999.py index 5dc50ae..8d9d6a8 100644 --- a/colour_datasets/loaders/luo1999.py +++ b/colour_datasets/loaders/luo1999.py @@ -30,7 +30,7 @@ import os from collections import namedtuple -from colour.hints import Boolean, Dict, Optional, Tuple +from colour.hints import Dict, Optional, Tuple, cast from colour.utilities import as_float_array from colour_datasets.loaders import AbstractDatasetLoader @@ -502,18 +502,36 @@ def load(self) -> Dict[str, CorrespondingColourDataset_Luo1999]: name = f"{key} - {filename.split('.')[1]}" dataset_metadata = dict(zip(metadata_headers, metadata)) - Y_r = dataset_metadata["Illuminance (lux)"][i][0] - Y_t = dataset_metadata["Illuminance (lux)"][i][1] - - B_r = dataset_metadata["Background (Y%)"][i][0] - B_t = dataset_metadata["Background (Y%)"][i][1] - - dataset_metadata["Illuminance (lux)"] = dataset_metadata[ + Y_r = ( + dataset_metadata["Illuminance (lux)"][ # pyright: ignore + i + ][0], + ) + Y_t = dataset_metadata["Illuminance (lux)"][ # pyright: ignore + i + ][1] + + B_r = dataset_metadata["Background (Y%)"][ # pyright: ignore + i + ][0] + B_t = dataset_metadata["Background (Y%)"][ # pyright: ignore + i + ][1] + + dataset_metadata[ "Illuminance (lux)" - ][i] - dataset_metadata["Background (Y%)"] = dataset_metadata[ + ] = dataset_metadata[ # pyright: ignore + "Illuminance (lux)" + ][ + i + ] + dataset_metadata[ + "Background (Y%)" + ] = dataset_metadata[ # pyright: ignore "Background (Y%)" - ][i] + ][ + i + ] self._content[name] = CorrespondingColourDataset_Luo1999( name, @@ -521,8 +539,8 @@ def load(self) -> Dict[str, CorrespondingColourDataset_Luo1999]: as_float_array(XYZ_t) / 100, as_float_array(XYZ_cr) / 100, as_float_array(XYZ_ct) / 100, - Y_r * np.pi, - Y_t * np.pi, + cast(float, Y_r) * np.pi, + cast(float, Y_t) * np.pi, B_r, B_t, dataset_metadata, @@ -538,7 +556,7 @@ def load(self) -> Dict[str, CorrespondingColourDataset_Luo1999]: """ -def build_Luo1999(load: Boolean = True) -> DatasetLoader_Luo1999: +def build_Luo1999(load: bool = True) -> DatasetLoader_Luo1999: """ Singleton factory that the builds *Luo and Rhodes (1999)* *Corresponding-Colour Datasets* dataset loader. diff --git a/colour_datasets/loaders/tests/test_kuopio.py b/colour_datasets/loaders/tests/test_kuopio.py index 9b85ea9..1422cf8 100644 --- a/colour_datasets/loaders/tests/test_kuopio.py +++ b/colour_datasets/loaders/tests/test_kuopio.py @@ -11,15 +11,15 @@ MatFileMetadata_KuopioUniversity, read_sds_from_mat_file_KuopioUniversity, ) -from colour_datasets.loaders.kuopio import ( # type: ignore[attr-defined] - DatasetLoader_MunsellColorsMattSpectrofotometerMeasured, - DatasetLoader_MunsellColorsMattAOTFMeasured, - DatasetLoader_MunsellColorsGlossySpectrofotometerMeasured, - DatasetLoader_MunsellColorsGlossyAllSpectrofotometerMeasured, - DatasetLoader_ForestColors, - DatasetLoader_PaperSpectra, - DatasetLoader_LumberSpectra, - DatasetLoader_AgfaIT872Set, +from colour_datasets.loaders.kuopio import ( + DatasetLoader_MunsellColorsMattSpectrofotometerMeasured, # pyright: ignore + DatasetLoader_MunsellColorsMattAOTFMeasured, # pyright: ignore + DatasetLoader_MunsellColorsGlossySpectrofotometerMeasured, # pyright: ignore + DatasetLoader_MunsellColorsGlossyAllSpectrofotometerMeasured, # pyright: ignore + DatasetLoader_ForestColors, # pyright: ignore + DatasetLoader_PaperSpectra, # pyright: ignore + DatasetLoader_LumberSpectra, # pyright: ignore + DatasetLoader_AgfaIT872Set, # pyright: ignore ) __author__ = "Colour Developers" diff --git a/colour_datasets/loaders/winquist2022.py b/colour_datasets/loaders/winquist2022.py index c1707af..aa8a462 100644 --- a/colour_datasets/loaders/winquist2022.py +++ b/colour_datasets/loaders/winquist2022.py @@ -21,7 +21,7 @@ import glob import os -from colour.hints import Boolean, Dict, Optional +from colour.hints import Dict, Optional from colour_datasets.loaders import AbstractDatasetLoader from colour_datasets.loaders.dyer2017 import MultiSpectralDistributions_AMPAS @@ -107,7 +107,7 @@ def load(self) -> Dict[str, MultiSpectralDistributions_AMPAS]: """ -def build_Winquist2022(load: Boolean = True) -> DatasetLoader_Winquist2022: +def build_Winquist2022(load: bool = True) -> DatasetLoader_Winquist2022: """ Singleton factory that builds the *Winquist et al. (2022)* *Physlight - Camera Spectral Sensitivity Curves* dataset loader. diff --git a/colour_datasets/loaders/xrite2016.py b/colour_datasets/loaders/xrite2016.py index a54e93d..d2995ff 100644 --- a/colour_datasets/loaders/xrite2016.py +++ b/colour_datasets/loaders/xrite2016.py @@ -24,7 +24,7 @@ from colour import CCS_ILLUMINANTS, Lab_to_XYZ, XYZ_to_xyY from colour.characterisation import ColourChecker -from colour.hints import Boolean, Dict, Optional +from colour.hints import Dict, Optional from colour_datasets.loaders import AbstractDatasetLoader from colour_datasets.records import datasets @@ -165,7 +165,7 @@ def load(self) -> Dict[str, ColourChecker]: """ -def build_XRite2016(load: Boolean = True) -> DatasetLoader_XRite2016: +def build_XRite2016(load: bool = True) -> DatasetLoader_XRite2016: """ Singleton factory that the builds *X-Rite (2016)* *New Color Specifications for ColorChecker SG and Classic Charts* dataset diff --git a/colour_datasets/loaders/zhao2009.py b/colour_datasets/loaders/zhao2009.py index f93a775..c22713b 100644 --- a/colour_datasets/loaders/zhao2009.py +++ b/colour_datasets/loaders/zhao2009.py @@ -21,7 +21,7 @@ import os from colour.characterisation import RGB_CameraSensitivities -from colour.hints import Boolean, Dict, Optional +from colour.hints import Dict, Optional from colour_datasets.loaders import AbstractDatasetLoader from colour_datasets.records import datasets @@ -125,7 +125,7 @@ def load(self) -> Dict[str, RGB_CameraSensitivities]: """ -def build_Zhao2009(load: Boolean = True) -> DatasetLoader_Zhao2009: +def build_Zhao2009(load: bool = True) -> DatasetLoader_Zhao2009: """ Singleton factory that builds the *Zhao et al. (2009)* *Spectral Sensitivity Database* dataset loader. diff --git a/colour_datasets/records/configuration.py b/colour_datasets/records/configuration.py index bd29737..821a347 100644 --- a/colour_datasets/records/configuration.py +++ b/colour_datasets/records/configuration.py @@ -10,7 +10,7 @@ import functools import os -from colour.hints import Any, Boolean, Callable, Dict, Optional +from colour.hints import Any, Callable, Dict, Optional from colour.utilities import Structure from colour.utilities.documentation import ( DocstringDict, @@ -72,7 +72,7 @@ def __init__(self, configuration: Optional[Dict] = None) -> None: def use_sandbox( - state: Boolean = True, + state: bool = True, api_url: str = "https://sandbox.zenodo.org/api", community: str = "colour-science-datasets", ): diff --git a/colour_datasets/records/zenodo.py b/colour_datasets/records/zenodo.py index 407e229..c867360 100644 --- a/colour_datasets/records/zenodo.py +++ b/colour_datasets/records/zenodo.py @@ -26,11 +26,9 @@ from colour.hints import ( Any, - Boolean, Callable, Dict, Generator, - Integer, List, Optional, Union, @@ -194,7 +192,7 @@ def strip_html(text: str) -> str: parts: List[str] = [] parser = HTMLParser() - parser.handle_data = parts.append # type: ignore[assignment] + parser.handle_data = parts.append # pyright: ignore parser.feed(text) return "".join(parts) @@ -280,7 +278,7 @@ def __repr__(self) -> str: def from_id( id_: str, configuration: Optional[Configuration] = None, - retries: Integer = 3, + retries: int = 3, ) -> Record: """ :class:`colour_datasets.Record` class factory that builds an instance @@ -320,7 +318,7 @@ def from_id( return Record(json_open(record_url, retries), configuration) - def synced(self) -> Boolean: + def synced(self) -> bool: """ Return whether the *Zenodo* record data is synced to the local repository. @@ -357,7 +355,7 @@ def synced(self) -> Boolean: ] ) - def pull(self, use_urls_txt_file: Boolean = True, retries: Integer = 3): + def pull(self, use_urls_txt_file: bool = True, retries: int = 3): """ Pull the *Zenodo* record data to the local repository. @@ -409,9 +407,9 @@ def urls_download(urls: Dict): for url, md5 in urls.items(): filename = os.path.join( downloads_directory, - urllib.parse.unquote( # type: ignore[attr-defined] + urllib.parse.unquote( url.split("/")[-1] - ), + ), # pyright: ignore ) url_download(url, filename, md5.split(":")[-1], retries) @@ -767,7 +765,7 @@ def __iter__(self) -> Generator: yield from self._records - def __len__(self) -> Integer: + def __len__(self) -> int: """ Return *Zenodo* community records count. @@ -790,7 +788,7 @@ def __len__(self) -> Integer: def from_id( id_: str, configuration: Optional[Configuration] = None, - retries: Integer = 3, + retries: int = 3, ) -> Community: """ :class:`colour_datasets.Community` class factory that builds an @@ -884,7 +882,7 @@ def from_id( return Community(data, configuration) - def synced(self) -> Boolean: + def synced(self) -> bool: """ Return whether the *Zenodo* community data is synced to the local repository. @@ -911,7 +909,7 @@ def synced(self) -> Boolean: return all([record.synced() for record in self._records.values()]) - def pull(self, use_urls_txt_file: Boolean = True, retries: Integer = 3): + def pull(self, use_urls_txt_file: bool = True, retries: int = 3): """ Pull the *Zenodo* community data to the local repository. diff --git a/colour_datasets/utilities/common.py b/colour_datasets/utilities/common.py index cac2981..2e0bcde 100644 --- a/colour_datasets/utilities/common.py +++ b/colour_datasets/utilities/common.py @@ -20,7 +20,7 @@ from tqdm import tqdm from cachetools import cached, TTLCache -from colour.hints import Any, Boolean, Callable, Dict, Integer, Optional +from colour.hints import Any, Callable, Dict, Optional __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" @@ -72,9 +72,9 @@ class TqdmUpTo(tqdm): def update_to( self, - chunks_count: Integer = 1, - chunk_size: Integer = 1, - total_size: Optional[Integer] = None, + chunks_count: int = 1, + chunk_size: int = 1, + total_size: Optional[int] = None, ): """ Report the progress of an action. @@ -95,7 +95,7 @@ def update_to( self.update(chunks_count * chunk_size - self.n) -def hash_md5(filename: str, chunk_size: Integer = 2**16) -> str: +def hash_md5(filename: str, chunk_size: int = 2**16) -> str: """ Compute the *Message Digest 5 (MD5)* hash of given file. @@ -126,7 +126,7 @@ def hash_md5(filename: str, chunk_size: Integer = 2**16) -> str: def url_download( - url: str, filename: str, md5: Optional[str] = None, retries: Integer = 3 + url: str, filename: str, md5: Optional[str] = None, retries: int = 3 ): """ Download given url and saves its content at given file. @@ -187,7 +187,7 @@ def url_download( @cached(cache=TTLCache(maxsize=256, ttl=300)) -def json_open(url: str, retries: Integer = 3) -> Dict: +def json_open(url: str, retries: int = 3) -> Dict: """ Open given url and return its content as *JSON*. @@ -240,7 +240,7 @@ def json_open(url: str, retries: Integer = 3) -> Dict: def unpack_gzipfile( filename: str, extraction_directory: str, *args: Any -) -> Boolean: +) -> bool: """ Unpack given *GZIP* file to given extraction directory. diff --git a/colour_datasets/utilities/spreadsheet.py b/colour_datasets/utilities/spreadsheet.py index 5138ec5..e5dda64 100644 --- a/colour_datasets/utilities/spreadsheet.py +++ b/colour_datasets/utilities/spreadsheet.py @@ -15,7 +15,7 @@ import re import xlrd -from colour.hints import Dict, Integer, List, Union +from colour.hints import Dict, List, Union from colour.utilities import CanonicalMapping __author__ = "Colour Developers, Openpyxl Developers" @@ -38,7 +38,7 @@ ] -def _column_number_to_letters(number: Integer) -> str: +def _column_number_to_letters(number: int) -> str: """ Convert given column number into a column letters. @@ -94,7 +94,7 @@ def _column_number_to_letters(number: Integer) -> str: _LETTERS_TO_NUMBER_CACHE[letter] = i -def row_to_index(row: Union[Integer, str]) -> Integer: +def row_to_index(row: Union[int, str]) -> int: """ Return the 0-based index of given row name. @@ -121,7 +121,7 @@ def row_to_index(row: Union[Integer, str]) -> Integer: return row - 1 -def index_to_row(index: Integer) -> str: +def index_to_row(index: int) -> str: """ Return the row name of given 0-based index. @@ -145,7 +145,7 @@ def index_to_row(index: Integer) -> str: return str(index + 1) -def column_to_index(column: str) -> Integer: +def column_to_index(column: str) -> int: """ Return the 0-based index of given column letters. @@ -168,7 +168,7 @@ def column_to_index(column: str) -> Integer: return _LETTERS_TO_NUMBER_CACHE[column] - 1 -def index_to_column(index: Integer) -> str: +def index_to_column(index: int) -> str: """ Return the column letters of given 0-based index. diff --git a/docs/conf.py b/docs/conf.py index fc5afcb..9e2d6fd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -37,27 +37,20 @@ autodoc_typehints = "both" autodoc_type_aliases = { "ArrayLike": "ArrayLike", - "Boolean": "bool", - "BooleanOrArrayLike": "BooleanOrArrayLike", - "BooleanOrNDArray": "BooleanOrNDArray", "DType": "DType", "DTypeBoolean": "DTypeBoolean", "DTypeComplex": "DTypeComplex", - "DTypeFloating": "DTypeFloating", - "DTypeInteger": "DTypeInteger", - "DTypeNumber": "DTypeNumber", - "Floating": "float", - "FloatingOrArrayLike": "FloatingOrArrayLike", - "FloatingOrNDArray": "FloatingOrNDArray", - "Integer": "int", - "IntegerOrArrayLike": "IntegerOrArrayLike", - "IntegerOrNDArray": "IntegerOrNDArray", - "NestedSequence": "NestedSequence", - "Number": "Number", - "NumberOrArrayLike": "NumberOrArrayLike", - "NumberOrNDArray": "NumberOrNDArray", - "StrOrArrayLike": "StrOrArrayLike", - "StrOrNDArray": "StrOrNDArray", + "DTypeFloat": "DTypeFloat", + "DTypeInt": "DTypeInt", + "DTypeReal": "DTypeReal", + "Dataclass": "Dataclass", + "NDArrayBoolean": "NDArrayBoolean", + "NDArrayComplex": "NDArrayComplex", + "NDArrayFloat": "NDArrayFloat", + "NDArrayInt": "NDArrayInt", + "NDArrayReal": "NDArrayReal", + "NDArrayStr": "NDArrayStr", + "Real": "Real", } autodoc_preserve_defaults = True diff --git a/pyproject.toml b/pyproject.toml index 2ba2fc4..525de88 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,7 +51,7 @@ numpy = ">= 1.20, < 2" opencv-python = ">= 4, < 5" scipy = ">= 1.7, < 2" tqdm = "*" -typing-extensions = ">= 4, < 5" # Convenience for Google Colab. +typing-extensions = ">= 4, < 5" xlrd = ">= 1.2, < 2" biblib-simple = { version = "*", optional = true } # Development dependency. @@ -62,10 +62,10 @@ coveralls = { version = "*", optional = true } # Development dependency. flake8 = { version = "*", optional = true } # Development dependency. flynt = { version = "*", optional = true } # Development dependency. invoke = { version = "*", optional = true } # Development dependency. -mypy = { version = "*", optional = true } # Development dependency. pre-commit = { version = "*", optional = true } # Development dependency. pydata-sphinx-theme = { version = "*", optional = true } # Development dependency. pydocstyle = { version = "*", optional = true } # Development dependency. +pyright = { version = "*", optional = true } # Development dependency. pytest = { version = "*", optional = true } # Development dependency. pytest-cov = { version = "*", optional = true } # Development dependency. pytest-xdist = { version = "*", optional = true} #Development dependency @@ -85,11 +85,11 @@ coveralls = "*" flake8 = "*" flynt = "*" invoke = "*" -mypy = "*" pre-commit = "*" pytest = "*" pydata-sphinx-theme = "*" pydocstyle = "*" +pyright = "*" pytest-cov = "*" pytest-xdist = "*" pyupgrade = "*" @@ -109,10 +109,10 @@ development = [ "flake8", "flynt", "invoke", - "mypy", "pre-commit", "pydata-sphinx-theme", "pydocstyle", + "pyright", "pytest", "pytest-cov", "pytest-xdist", @@ -130,7 +130,6 @@ line-length = 79 exclude = ''' /( \.git - | \.mypy_cache | build | dist )/ @@ -139,14 +138,19 @@ exclude = ''' [tool.flynt] line_length=999 -[tool.mypy] -plugins = "numpy.typing.mypy_plugin" -ignore_missing_imports = true - [tool.pydocstyle] convention = "numpy" add-ignore = "D104,D200,D202,D205,D301,D400" +[tool.pyright] +reportMissingImports = false +reportMissingModuleSource = false +reportUnboundVariable = false +reportUnnecessaryCast = true +reportUnnecessaryTypeIgnoreComment = true +reportUnsupportedDunderAll = false +reportUnusedExpression = false + [tool.pytest.ini_options] addopts = "--durations=5" diff --git a/requirements.txt b/requirements.txt index 258cfbb..dcad26f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,11 +4,11 @@ attrs==22.1.0 Babel==2.11.0 beautifulsoup4==4.11.1 biblib-simple==0.1.2 -black==22.10.0 +black==22.12.0 blackdoc==0.3.8 bleach==5.0.1 cachetools==5.2.0 -certifi==2022.9.24 +certifi==2022.12.7 cfgv==3.3.1 charset-normalizer==2.1.1 click==8.1.3 @@ -20,7 +20,7 @@ distlib==0.3.6 docopt==0.6.2 docutils==0.17.1 execnet==1.9.0 -filelock==3.8.0 +filelock==3.8.2 flake8==6.0.0 flynt==0.77 identify==2.5.9 @@ -37,17 +37,16 @@ latexcodec==2.0.1 MarkupSafe==2.1.1 mccabe==0.7.0 more-itertools==9.0.0 -mypy==0.991 mypy-extensions==0.4.3 nodeenv==1.7.0 numpy==1.23.5 opencv-python==4.6.0.66 -packaging==21.3 -pathspec==0.10.2 +packaging==22.0 +pathspec==0.10.3 Pillow==9.3.0 pip==22.3.1 pkginfo==1.9.2 -platformdirs==2.5.4 +platformdirs==2.6.0 pluggy==1.0.0 pre-commit==2.20.0 pybtex==0.24.0 @@ -57,12 +56,12 @@ pydata-sphinx-theme==0.12.0 pydocstyle==6.1.1 pyflakes==3.0.1 Pygments==2.13.0 -pyparsing==3.0.9 +pyright==1.1.283 pytest==7.2.0 pytest-cov==4.0.0 pytest-xdist==3.1.0 pytz==2022.6 -pyupgrade==3.3.0 +pyupgrade==3.3.1 PyYAML==6.0 readme-renderer==37.3 requests==2.28.1 @@ -92,7 +91,7 @@ types-cachetools==5.2.1 types-setuptools==65.6.0.1 typing_extensions==4.4.0 urllib3==1.26.13 -virtualenv==20.17.0 +virtualenv==20.17.1 webencodings==0.5.1 wheel==0.38.4 xlrd==1.2.0 diff --git a/tasks.py b/tasks.py index 1bf592d..44fa1c2 100644 --- a/tasks.py +++ b/tasks.py @@ -12,13 +12,12 @@ import uuid import colour_datasets -from colour.hints import Boolean from colour.utilities import message_box import inspect if not hasattr(inspect, "getargspec"): - inspect.getargspec = inspect.getfullargspec + inspect.getargspec = inspect.getfullargspec # pyright: ignore from invoke import Context, task @@ -68,10 +67,9 @@ @task def clean( ctx: Context, - docs: Boolean = True, - bytecode: Boolean = False, - mypy: Boolean = True, - pytest: Boolean = True, + docs: bool = True, + bytecode: bool = False, + pytest: bool = True, ): """ Clean the project. @@ -84,8 +82,6 @@ def clean( Whether to clean the *docs* directory. bytecode Whether to clean the bytecode files, e.g. *.pyc* files. - mypy - Whether to clean the *Mypy* cache directory. pytest Whether to clean the *Pytest* cache directory. """ @@ -102,9 +98,6 @@ def clean( patterns.append("**/__pycache__") patterns.append("**/*.pyc") - if mypy: - patterns.append(".mypy_cache") - if pytest: patterns.append(".pytest_cache") @@ -115,8 +108,8 @@ def clean( @task def formatting( ctx: Context, - asciify: Boolean = True, - bibtex: Boolean = True, + asciify: bool = True, + bibtex: bool = True, ): """ Convert unicode characters to ASCII and cleanup the *BibTeX* file. @@ -162,37 +155,26 @@ def formatting( @task def quality( ctx: Context, - mypy: Boolean = True, - rstlint: Boolean = True, + pyright: bool = True, + rstlint: bool = True, ): """ - Check the codebase with *Mypy* and lints various *restructuredText* + Check the codebase with *Pyright* and lints various *restructuredText* files with *rst-lint*. Parameters ---------- ctx Context. - flake8 - Whether to check the codebase with *Flake8*. - mypy - Whether to check the codebase with *Mypy*. + pyright + Whether to check the codebase with *Pyright*. rstlint Whether to lint various *restructuredText* files with *rst-lint*. """ - if mypy: - message_box('Checking codebase with "Mypy"...') - ctx.run( - f"mypy " - f"--install-types " - f"--non-interactive " - f"--show-error-codes " - f"--warn-unused-ignores " - f"--warn-redundant-casts " - f"{PYTHON_PACKAGE_NAME} " - f"|| true" - ) + if pyright: + message_box('Checking codebase with "Pyright"...') + ctx.run("pyright --skipunannotated") if rstlint: message_box('Linting "README.rst" file...') @@ -271,7 +253,7 @@ def preflight(ctx: Context): @task -def docs(ctx: Context, html: Boolean = True, pdf: Boolean = True): +def docs(ctx: Context, html: bool = True, pdf: bool = True): """ Build the documentation. @@ -407,7 +389,7 @@ def sub_callable(match): @task -def virtualise(ctx: Context, tests: Boolean = True): +def virtualise(ctx: Context, tests: bool = True): """ Create a virtual environment for the project build. @@ -458,17 +440,17 @@ def tag(ctx: Context): file_content = file_handle.read() major_version = re.search( '__major_version__\\s+=\\s+"(.*)"', file_content - ).group( # type: ignore[union-attr] + ).group( # pyright: ignore 1 ) minor_version = re.search( '__minor_version__\\s+=\\s+"(.*)"', file_content - ).group( # type: ignore[union-attr] + ).group( # pyright: ignore 1 ) change_version = re.search( '__change_version__\\s+=\\s+"(.*)"', file_content - ).group( # type: ignore[union-attr] + ).group( # pyright: ignore 1 ) From 898d86412b96452bd8236c20e95af40a7cd61f8c Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Wed, 1 Feb 2023 21:13:06 +1300 Subject: [PATCH 04/26] Update "tasks.py" file. --- tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks.py b/tasks.py index 44fa1c2..6a523f7 100644 --- a/tasks.py +++ b/tasks.py @@ -174,7 +174,7 @@ def quality( if pyright: message_box('Checking codebase with "Pyright"...') - ctx.run("pyright --skipunannotated") + ctx.run("pyright --skipunannotated --level warning") if rstlint: message_box('Linting "README.rst" file...') From 7369a284b897f9e2862a85fc196e332d25e6ef70 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Fri, 3 Feb 2023 20:33:28 +1300 Subject: [PATCH 05/26] Implement support for "Ruff". --- .flake8 | 3 - .pre-commit-config.yaml | 20 +- colour_datasets/__init__.py | 5 +- colour_datasets/loaders/__init__.py | 13 +- colour_datasets/loaders/abstract.py | 8 +- colour_datasets/loaders/asano2015.py | 26 +- colour_datasets/loaders/brendel2020.py | 6 +- colour_datasets/loaders/dyer2017.py | 582 ++++--- colour_datasets/loaders/ebner1998.py | 6 +- colour_datasets/loaders/hung1995.py | 43 +- colour_datasets/loaders/jakob2019.py | 8 +- colour_datasets/loaders/jiang2013.py | 6 +- colour_datasets/loaders/karge2015.py | 6 +- colour_datasets/loaders/kuopio.py | 11 +- colour_datasets/loaders/labsphere2019.py | 15 +- colour_datasets/loaders/luo1997.py | 1546 +++++++++--------- colour_datasets/loaders/luo1999.py | 494 +++--- colour_datasets/loaders/winquist2022.py | 6 +- colour_datasets/loaders/xrite2016.py | 6 +- colour_datasets/loaders/zhao2009.py | 6 +- colour_datasets/records/__init__.py | 3 +- colour_datasets/records/configuration.py | 6 +- colour_datasets/records/tests/test_zenodo.py | 4 +- colour_datasets/records/zenodo.py | 35 +- colour_datasets/utilities/common.py | 41 +- colour_datasets/utilities/spreadsheet.py | 15 +- docs/conf.py | 6 +- pyproject.toml | 106 +- requirements.txt | 81 +- tasks.py | 40 +- utilities/export_todo.py | 6 +- 31 files changed, 1539 insertions(+), 1620 deletions(-) delete mode 100644 .flake8 diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 8dd399a..0000000 --- a/.flake8 +++ /dev/null @@ -1,3 +0,0 @@ -[flake8] -max-line-length = 88 -extend-ignore = E203 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3743cf6..3345920 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,13 +1,12 @@ repos: -- repo: https://github.com/asottile/pyupgrade - rev: v3.2.2 - hooks: - - id: pyupgrade - args: [--py39-plus] - repo: https://github.com/ikamensh/flynt/ rev: '0.77' hooks: - id: flynt +- repo: https://github.com/charliermarsh/ruff-pre-commit + rev: 'v0.0.239' + hooks: + - id: ruff - repo: https://github.com/psf/black rev: 22.10.0 hooks: @@ -18,14 +17,3 @@ repos: hooks: - id: blackdoc language_version: python3.9 -- repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 - hooks: - - id: flake8 -- repo: https://github.com/pycqa/pydocstyle - rev: 6.1.1 - hooks: - - id: pydocstyle - args: - - --convention=numpy - - --add-ignore=D104,D200,D202,D205,D301,D400 diff --git a/colour_datasets/__init__.py b/colour_datasets/__init__.py index cac6cb8..9490326 100644 --- a/colour_datasets/__init__.py +++ b/colour_datasets/__init__.py @@ -15,6 +15,7 @@ - utilities: Various utilities. """ +import contextlib import numpy as np import os import subprocess # nosec @@ -77,7 +78,5 @@ del _version # TODO: Remove legacy printing support when deemed appropriate. -try: +with contextlib.suppress(TypeError): np.set_printoptions(legacy="1.13") -except TypeError: - pass diff --git a/colour_datasets/loaders/__init__.py b/colour_datasets/loaders/__init__.py index 2bc25e3..a766340 100644 --- a/colour_datasets/loaders/__init__.py +++ b/colour_datasets/loaders/__init__.py @@ -2,7 +2,7 @@ import sys -from colour.hints import Any, Union +from colour.hints import Any from colour.utilities import CanonicalMapping, warning from colour_datasets.records import datasets @@ -105,22 +105,19 @@ Dataset loaders ids and callables. """ -from .kuopio import DATASET_LOADERS_KUOPIO_UNIVERSITY # noqa +from .kuopio import DATASET_LOADERS_KUOPIO_UNIVERSITY # noqa: E402 DATASET_LOADERS.update(DATASET_LOADERS_KUOPIO_UNIVERSITY) -from . import kuopio # noqa +from . import kuopio # noqa: E402 _module = sys.modules["colour_datasets.loaders"] for _export in kuopio.__all__: if _export.startswith("DatasetLoader_") or _export.startswith("build_"): - setattr(_module, _export, getattr(kuopio, _export)) - __all__ += [ - _export, - ] + __all__ += [_export] # noqa: PLE0604 del _module, _export @@ -133,7 +130,7 @@ """ -def load(dataset: Union[int, str]) -> Any: +def load(dataset: int | str) -> Any: """ Load given dataset: The dataset is pulled locally, i.e. synced if required and then its data is loaded. diff --git a/colour_datasets/loaders/abstract.py b/colour_datasets/loaders/abstract.py index e800a21..5c14466 100644 --- a/colour_datasets/loaders/abstract.py +++ b/colour_datasets/loaders/abstract.py @@ -11,7 +11,7 @@ from abc import ABC, abstractmethod -from colour.hints import Any, Optional +from colour.hints import Any from colour_datasets.records import Record @@ -63,7 +63,7 @@ class AbstractDatasetLoader(ABC): def __init__(self, record: Record) -> None: self._record: Record = record - self._content: Optional[Any] = None + self._content: Any | None = None @property def record(self) -> Record: @@ -79,7 +79,7 @@ def record(self) -> Record: return self._record @property - def id(self) -> str: + def id(self) -> str: # noqa: A003 """ Getter property for the dataset id. @@ -122,8 +122,6 @@ def load(self) -> Any: when they implement it, e.g. ``super().sync()``. """ - pass - def sync(self): """ Sync the dataset content, i.e. checks whether it is synced and pulls diff --git a/colour_datasets/loaders/asano2015.py b/colour_datasets/loaders/asano2015.py index 0bb560a..ee5c472 100644 --- a/colour_datasets/loaders/asano2015.py +++ b/colour_datasets/loaders/asano2015.py @@ -26,7 +26,7 @@ XYZ_ColourMatchingFunctions, LMS_ConeFundamentals, ) -from colour.hints import Dict, NDArrayFloat, Optional +from colour.hints import Dict, NDArrayFloat from colour.utilities import as_float_array, tstack from colour_datasets.loaders import AbstractDatasetLoader @@ -52,7 +52,7 @@ class Specification_Asano2015( "Specification_Asano2015", ("XYZ_2", "XYZ_10", "LMS_2", "LMS_10", "parameters", "others"), ) -): # noqa: D405,D407,D410,D411 +): """ Define the *Asano (2015)* specification for an observer. @@ -74,7 +74,7 @@ class Specification_Asano2015( References ---------- :cite:`Asano2015` - """ + """ # noqa: D405, D407, D410, D411 def __new__( cls, @@ -83,7 +83,7 @@ def __new__( LMS_2: LMS_ConeFundamentals, LMS_10: LMS_ConeFundamentals, parameters: NDArrayFloat, - others: Optional[Dict] = None, + others: Dict | None = None, ): """ Return a new instance of the @@ -122,7 +122,7 @@ class DatasetLoader_Asano2015(AbstractDatasetLoader): def __init__(self) -> None: super().__init__(datasets()[DatasetLoader_Asano2015.ID]) - def load(self) -> Dict[str, Specification_Asano2015]: + def load(self) -> Dict[str, Dict[int, Specification_Asano2015]]: """ Sync, parse, convert and return the *Asano (2015)* *Observer Function Database* dataset content. @@ -145,12 +145,10 @@ def load(self) -> Dict[str, Specification_Asano2015]: super().sync() - self._content = dict( - [ - ("Categorical Observers", dict()), - ("Colour Normal Observers", dict()), - ] - ) + self._content = { + "Categorical Observers": {}, + "Colour Normal Observers": {}, + } # Categorical Observers workbook_path = os.path.join( @@ -247,7 +245,7 @@ def parse_workbook_Asano2015( shape = SpectralShape(390, 780, 5) wavelengths = shape.range() - data: Dict = dict() + data: Dict = {} for i, cmfs in enumerate( [ @@ -276,7 +274,7 @@ def parse_workbook_Asano2015( observer = k + 1 rgb = tstack([x[k], y[k], z[k]]) if data.get(observer) is None: - data[observer] = dict() + data[observer] = {} key = f"{cmfs[1]}_{degree[0]}" data[observer][key] = cmfs[0]( @@ -310,7 +308,7 @@ def parse_workbook_Asano2015( return data -_DATASET_LOADER_ASANO2015: Optional[DatasetLoader_Asano2015] = None +_DATASET_LOADER_ASANO2015: DatasetLoader_Asano2015 | None = None """ Singleton instance of the *Asano (2015)* *Observer Function Database* dataset loader. diff --git a/colour_datasets/loaders/brendel2020.py b/colour_datasets/loaders/brendel2020.py index 4c2f68a..7bea8b2 100644 --- a/colour_datasets/loaders/brendel2020.py +++ b/colour_datasets/loaders/brendel2020.py @@ -21,7 +21,7 @@ import os from colour import LinearInterpolator, SpectralShape, SpectralDistribution -from colour.hints import Dict, Optional +from colour.hints import Dict from colour.utilities import as_int from colour_datasets.loaders import AbstractDatasetLoader @@ -87,7 +87,7 @@ def load(self) -> Dict[str, SpectralDistribution]: super().sync() - self._content = dict() + self._content = {} wavelengths = SpectralShape(350, 700, 2).range() @@ -108,7 +108,7 @@ def load(self) -> Dict[str, SpectralDistribution]: return self._content -_DATASET_LOADER_BRENDEL2020: Optional[DatasetLoader_Brendel2020] = None +_DATASET_LOADER_BRENDEL2020: DatasetLoader_Brendel2020 | None = None """ Singleton instance of the *Brendel (2020)* *Measured Commercial LED Spectra* dataset loader. diff --git a/colour_datasets/loaders/dyer2017.py b/colour_datasets/loaders/dyer2017.py index 5bacda4..24db05f 100644 --- a/colour_datasets/loaders/dyer2017.py +++ b/colour_datasets/loaders/dyer2017.py @@ -26,7 +26,6 @@ Any, Dict, Literal, - Optional, Type, Union, cast, @@ -113,38 +112,37 @@ class SpectralDataHeader_AMPAS: def __init__( self, - schema_version: Optional[str] = None, - catalog_number: Optional[str] = None, - description: Optional[str] = None, - document_creator: Optional[str] = None, - unique_identifier: Optional[str] = None, - measurement_equipment: Optional[str] = None, - laboratory: Optional[str] = None, - document_creation_date: Optional[str] = None, - comments: Optional[str] = None, - license: Optional[str] = None, + schema_version: str | None = None, + catalog_number: str | None = None, + description: str | None = None, + document_creator: str | None = None, + unique_identifier: str | None = None, + measurement_equipment: str | None = None, + laboratory: str | None = None, + document_creation_date: str | None = None, + comments: str | None = None, + license: str | None = None, # noqa: A002 **kwargs: Any, ) -> None: - - self._schema_version: Optional[str] = None + self._schema_version: str | None = None self.schema_version = schema_version - self._catalog_number: Optional[str] = None + self._catalog_number: str | None = None self.catalog_number = catalog_number - self._description: Optional[str] = None + self._description: str | None = None self.description = description - self._document_creator: Optional[str] = None + self._document_creator: str | None = None self.document_creator = document_creator - self._unique_identifier: Optional[str] = None + self._unique_identifier: str | None = None self.unique_identifier = unique_identifier - self._measurement_equipment: Optional[str] = None + self._measurement_equipment: str | None = None self.measurement_equipment = measurement_equipment - self._laboratory: Optional[str] = None + self._laboratory: str | None = None self.laboratory = laboratory - self._document_creation_date: Optional[str] = None + self._document_creation_date: str | None = None self.document_creation_date = document_creation_date - self._comments: Optional[str] = None + self._comments: str | None = None self.comments = comments - self._license: Optional[str] = None + self._license: str | None = None self.license = license # TODO: Re-instate "manufacturer", "model", "illuminant" and "type" @@ -154,7 +152,7 @@ def __init__( self._kwargs: Any = kwargs @property - def schema_version(self) -> Optional[str]: + def schema_version(self) -> str | None: """ Getter and setter property for the schema version. @@ -172,7 +170,7 @@ def schema_version(self) -> Optional[str]: return self._schema_version @schema_version.setter - def schema_version(self, value: Optional[str]): + def schema_version(self, value: str | None): """Setter for the **self.schema_version** property.""" if value is not None: @@ -184,7 +182,7 @@ def schema_version(self, value: Optional[str]): self._schema_version = value @property - def catalog_number(self) -> Optional[str]: + def catalog_number(self) -> str | None: """ Getter and setter property for the catalog number. @@ -202,7 +200,7 @@ def catalog_number(self) -> Optional[str]: return self._catalog_number @catalog_number.setter - def catalog_number(self, value: Optional[str]): + def catalog_number(self, value: str | None): """Setter for the **self.catalog_number** property.""" if value is not None: @@ -214,7 +212,7 @@ def catalog_number(self, value: Optional[str]): self._catalog_number = value @property - def description(self) -> Optional[str]: + def description(self) -> str | None: """ Getter and setter property for the description. @@ -232,7 +230,7 @@ def description(self) -> Optional[str]: return self._description @description.setter - def description(self, value: Optional[str]): + def description(self, value: str | None): """Setter for the **self.description** property.""" if value is not None: @@ -244,7 +242,7 @@ def description(self, value: Optional[str]): self._description = value @property - def document_creator(self) -> Optional[str]: + def document_creator(self) -> str | None: """ Getter and setter property for the document creator. @@ -262,7 +260,7 @@ def document_creator(self) -> Optional[str]: return self._document_creator @document_creator.setter - def document_creator(self, value: Optional[str]): + def document_creator(self, value: str | None): """Setter for the **self.document_creator** property.""" if value is not None: @@ -274,7 +272,7 @@ def document_creator(self, value: Optional[str]): self._document_creator = value @property - def unique_identifier(self) -> Optional[str]: + def unique_identifier(self) -> str | None: """ Getter and setter property for the unique identifier. @@ -292,7 +290,7 @@ def unique_identifier(self) -> Optional[str]: return self._unique_identifier @unique_identifier.setter - def unique_identifier(self, value: Optional[str]): + def unique_identifier(self, value: str | None): """Setter for the **self.unique_identifier** property.""" if value is not None: @@ -304,7 +302,7 @@ def unique_identifier(self, value: Optional[str]): self._unique_identifier = value @property - def measurement_equipment(self) -> Optional[str]: + def measurement_equipment(self) -> str | None: """ Getter and setter property for the measurement equipment. @@ -322,7 +320,7 @@ def measurement_equipment(self) -> Optional[str]: return self._measurement_equipment @measurement_equipment.setter - def measurement_equipment(self, value: Optional[str]): + def measurement_equipment(self, value: str | None): """Setter for the **self.measurement_equipment** property.""" if value is not None: @@ -335,7 +333,7 @@ def measurement_equipment(self, value: Optional[str]): self._measurement_equipment = value @property - def laboratory(self) -> Optional[str]: + def laboratory(self) -> str | None: """ Getter and setter property for the laboratory. @@ -353,7 +351,7 @@ def laboratory(self) -> Optional[str]: return self._laboratory @laboratory.setter - def laboratory(self, value: Optional[str]): + def laboratory(self, value: str | None): """Setter for the **self.measurement_equipment** property.""" if value is not None: @@ -365,7 +363,7 @@ def laboratory(self, value: Optional[str]): self._laboratory = value @property - def document_creation_date(self) -> Optional[str]: + def document_creation_date(self) -> str | None: """ Getter and setter property for the document creation date. @@ -383,7 +381,7 @@ def document_creation_date(self) -> Optional[str]: return self._document_creation_date @document_creation_date.setter - def document_creation_date(self, value: Optional[str]): + def document_creation_date(self, value: str | None): """Setter for the **self.document_creation_date** property.""" if value is not None: @@ -396,7 +394,7 @@ def document_creation_date(self, value: Optional[str]): self._document_creation_date = value @property - def comments(self) -> Optional[str]: + def comments(self) -> str | None: """ Getter and setter property for the comments. @@ -414,7 +412,7 @@ def comments(self) -> Optional[str]: return self._comments @comments.setter - def comments(self, value: Optional[str]): + def comments(self, value: str | None): """Setter for the **self.comments** property.""" if value is not None: @@ -426,7 +424,7 @@ def comments(self, value: Optional[str]): self._comments = value @property - def license(self) -> Optional[str]: + def license(self) -> str | None: # noqa: A003 """ Getter and setter property for the license. @@ -444,7 +442,7 @@ def license(self) -> Optional[str]: return self._license @license.setter - def license(self, value: Optional[str]): + def license(self, value: str | None): # noqa: A003 """Setter for the **self.license** property.""" if value is not None: @@ -530,97 +528,92 @@ class SpectralDistribution_AMPAS(SpectralDistribution): def __init__( self, - path: Optional[str] = None, - header: Optional[SpectralDataHeader_AMPAS] = None, - units: Optional[ - Literal[ - "absorptance", - "exitance", - "flux", - "intensity", - "irradiance", - "radiance", - "reflectance", - "relative", - "transmittance", - "R-Factor", - "T-Factor", - "other", - ] - ] = None, - reflection_geometry: Optional[ - Literal[ - "di:8", - "de:8", - "8:di", - "8:de", - "d:d", - "d:0", - "45a:0", - "45c:0", - "0:45a", - "45x:0", - "0:45x", - "other", - ] - ] = None, - transmission_geometry: Optional[ - Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"] - ] = None, - bandwidth_FWHM: Optional[float] = None, - bandwidth_corrected: Optional[bool] = None, + path: str | None = None, + header: SpectralDataHeader_AMPAS | None = None, + units: Literal[ + "absorptance", + "exitance", + "flux", + "intensity", + "irradiance", + "radiance", + "reflectance", + "relative", + "transmittance", + "R-Factor", + "T-Factor", + "other", + ] + | None = None, + reflection_geometry: Literal[ + "di:8", + "de:8", + "8:di", + "8:de", + "d:d", + "d:0", + "45a:0", + "45c:0", + "0:45a", + "45x:0", + "0:45x", + "other", + ] + | None = None, + transmission_geometry: Literal[ + "0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other" + ] + | None = None, + bandwidth_FWHM: float | None = None, + bandwidth_corrected: bool | None = None, ) -> None: super().__init__() - self._path: Optional[str] = None + self._path: str | None = None self.path = path self._header: SpectralDataHeader_AMPAS = SpectralDataHeader_AMPAS() self.header = optional(header, self._header) - self._units: Optional[ - Literal[ - "absorptance", - "exitance", - "flux", - "intensity", - "irradiance", - "radiance", - "reflectance", - "relative", - "transmittance", - "R-Factor", - "T-Factor", - "other", - ] - ] = None + self._units: Literal[ + "absorptance", + "exitance", + "flux", + "intensity", + "irradiance", + "radiance", + "reflectance", + "relative", + "transmittance", + "R-Factor", + "T-Factor", + "other", + ] | None = None self.units = units - self._reflection_geometry: Optional[ - Literal[ - "di:8", - "de:8", - "8:di", - "8:de", - "d:d", - "d:0", - "45a:0", - "45c:0", - "0:45a", - "45x:0", - "0:45x", - "other", - ] - ] = None + self._reflection_geometry: Literal[ + "di:8", + "de:8", + "8:di", + "8:de", + "d:d", + "d:0", + "45a:0", + "45c:0", + "0:45a", + "45x:0", + "0:45x", + "other", + ] | None = None self.reflection_geometry = reflection_geometry - self._transmission_geometry: Optional[ - Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"] - ] = None + self._transmission_geometry: Literal[ + "0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other" + ] | None = None self.transmission_geometry = transmission_geometry - self._bandwidth_FWHM: Optional[float] = None + self._bandwidth_FWHM: float | None = None self.bandwidth_FWHM = bandwidth_FWHM - self._bandwidth_corrected: Optional[bool] = None + self._bandwidth_corrected: bool | None = None self.bandwidth_corrected = bandwidth_corrected @property - def path(self) -> Optional[str]: + def path(self) -> str | None: """ Getter and setter property for the path. @@ -638,7 +631,7 @@ def path(self) -> Optional[str]: return self._path @path.setter - def path(self, value: Optional[str]): + def path(self, value: str | None): """Setter for the **self.path** property.""" if value is not None: @@ -679,7 +672,7 @@ def header(self, value: SpectralDataHeader_AMPAS): @property def units( self, - ) -> Optional[ + ) -> ( Literal[ "absorptance", "exitance", @@ -694,7 +687,8 @@ def units( "T-Factor", "other", ] - ]: + | None + ): """ Getter and setter property for the units. @@ -714,22 +708,21 @@ def units( @units.setter def units( self, - value: Optional[ - Literal[ - "absorptance", - "exitance", - "flux", - "intensity", - "irradiance", - "radiance", - "reflectance", - "relative", - "transmittance", - "R-Factor", - "T-Factor", - "other", - ] - ], + value: Literal[ + "absorptance", + "exitance", + "flux", + "intensity", + "irradiance", + "radiance", + "reflectance", + "relative", + "transmittance", + "R-Factor", + "T-Factor", + "other", + ] + | None, ): """Setter for the **self.units** property.""" @@ -744,7 +737,7 @@ def units( @property def reflection_geometry( self, - ) -> Optional[ + ) -> ( Literal[ "di:8", "de:8", @@ -759,7 +752,8 @@ def reflection_geometry( "0:45x", "other", ] - ]: + | None + ): """ Getter and setter property for the reflection geometry. @@ -779,22 +773,21 @@ def reflection_geometry( @reflection_geometry.setter def reflection_geometry( self, - value: Optional[ - Literal[ - "di:8", - "de:8", - "8:di", - "8:de", - "d:d", - "d:0", - "45a:0", - "45c:0", - "0:45a", - "45x:0", - "0:45x", - "other", - ] - ], + value: Literal[ + "di:8", + "de:8", + "8:di", + "8:de", + "d:d", + "d:0", + "45a:0", + "45c:0", + "0:45a", + "45x:0", + "0:45x", + "other", + ] + | None, ): """Setter for the **self.reflection_geometry** property.""" @@ -809,9 +802,7 @@ def reflection_geometry( @property def transmission_geometry( self, - ) -> Optional[ - Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"] - ]: + ) -> Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"] | None: """ Getter and setter property for the transmission geometry. @@ -831,21 +822,21 @@ def transmission_geometry( @transmission_geometry.setter def transmission_geometry( self, - value: Optional[ - Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"] - ], + value: Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"] + | None, ): """Setter for the **self.transmission_geometry** property.""" if value is not None: - assert is_string(value), ( + attest( + is_string(value), f'"transmission_geometry" property: "{value}" type is not "str"!', ) self._transmission_geometry = value @property - def bandwidth_FWHM(self) -> Optional[float]: + def bandwidth_FWHM(self) -> float | None: """ Getter and setter property for the full-width half-maximum bandwidth. @@ -863,7 +854,7 @@ def bandwidth_FWHM(self) -> Optional[float]: return self._bandwidth_FWHM @bandwidth_FWHM.setter - def bandwidth_FWHM(self, value: Optional[float]): + def bandwidth_FWHM(self, value: float | None): """Setter for the **self.bandwidth_FWHM** property.""" if value is not None: @@ -875,7 +866,7 @@ def bandwidth_FWHM(self, value: Optional[float]): self._bandwidth_FWHM = value @property - def bandwidth_corrected(self) -> Optional[bool]: + def bandwidth_corrected(self) -> bool | None: """ Getter and setter property for whether bandwidth correction has been applied to the measured data. @@ -894,7 +885,7 @@ def bandwidth_corrected(self) -> Optional[bool]: return self._bandwidth_corrected @bandwidth_corrected.setter - def bandwidth_corrected(self, value: Optional[bool]): + def bandwidth_corrected(self, value: bool | None): """Setter for the **self.bandwidth_corrected** property.""" if value is not None: @@ -1038,97 +1029,92 @@ class MultiSpectralDistributions_AMPAS(MultiSpectralDistributions): def __init__( self, - path: Optional[str] = None, - header: Optional[SpectralDataHeader_AMPAS] = None, - units: Optional[ - Literal[ - "absorptance", - "exitance", - "flux", - "intensity", - "irradiance", - "radiance", - "reflectance", - "relative", - "transmittance", - "R-Factor", - "T-Factor", - "other", - ] - ] = None, - reflection_geometry: Optional[ - Literal[ - "di:8", - "de:8", - "8:di", - "8:de", - "d:d", - "d:0", - "45a:0", - "45c:0", - "0:45a", - "45x:0", - "0:45x", - "other", - ] - ] = None, - transmission_geometry: Optional[ - Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"] - ] = None, - bandwidth_FWHM: Optional[float] = None, - bandwidth_corrected: Optional[bool] = None, + path: str | None = None, + header: SpectralDataHeader_AMPAS | None = None, + units: Literal[ + "absorptance", + "exitance", + "flux", + "intensity", + "irradiance", + "radiance", + "reflectance", + "relative", + "transmittance", + "R-Factor", + "T-Factor", + "other", + ] + | None = None, + reflection_geometry: Literal[ + "di:8", + "de:8", + "8:di", + "8:de", + "d:d", + "d:0", + "45a:0", + "45c:0", + "0:45a", + "45x:0", + "0:45x", + "other", + ] + | None = None, + transmission_geometry: Literal[ + "0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other" + ] + | None = None, + bandwidth_FWHM: float | None = None, + bandwidth_corrected: bool | None = None, ) -> None: super().__init__() - self._path: Optional[str] = None + self._path: str | None = None self.path = path self._header: SpectralDataHeader_AMPAS = SpectralDataHeader_AMPAS() self.header = optional(header, self._header) - self._units: Optional[ - Literal[ - "absorptance", - "exitance", - "flux", - "intensity", - "irradiance", - "radiance", - "reflectance", - "relative", - "transmittance", - "R-Factor", - "T-Factor", - "other", - ] - ] = None + self._units: Literal[ + "absorptance", + "exitance", + "flux", + "intensity", + "irradiance", + "radiance", + "reflectance", + "relative", + "transmittance", + "R-Factor", + "T-Factor", + "other", + ] | None = None self.units = units - self._reflection_geometry: Optional[ - Literal[ - "di:8", - "de:8", - "8:di", - "8:de", - "d:d", - "d:0", - "45a:0", - "45c:0", - "0:45a", - "45x:0", - "0:45x", - "other", - ] - ] = None + self._reflection_geometry: Literal[ + "di:8", + "de:8", + "8:di", + "8:de", + "d:d", + "d:0", + "45a:0", + "45c:0", + "0:45a", + "45x:0", + "0:45x", + "other", + ] | None = None self.reflection_geometry = reflection_geometry - self._transmission_geometry: Optional[ - Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"] - ] = None + self._transmission_geometry: Literal[ + "0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other" + ] | None = None self.transmission_geometry = transmission_geometry - self._bandwidth_FWHM: Optional[float] = None + self._bandwidth_FWHM: float | None = None self.bandwidth_FWHM = bandwidth_FWHM - self._bandwidth_corrected: Optional[bool] = None + self._bandwidth_corrected: bool | None = None self.bandwidth_corrected = bandwidth_corrected @property - def path(self) -> Optional[str]: + def path(self) -> str | None: """ Getter and setter property for the path. @@ -1146,7 +1132,7 @@ def path(self) -> Optional[str]: return self._path @path.setter - def path(self, value: Optional[str]): + def path(self, value: str | None): """Setter for the **self.path** property.""" if value is not None: @@ -1187,7 +1173,7 @@ def header(self, value: SpectralDataHeader_AMPAS): @property def units( self, - ) -> Optional[ + ) -> ( Literal[ "absorptance", "exitance", @@ -1202,7 +1188,8 @@ def units( "T-Factor", "other", ] - ]: + | None + ): """ Getter and setter property for the units. @@ -1222,22 +1209,21 @@ def units( @units.setter def units( self, - value: Optional[ - Literal[ - "absorptance", - "exitance", - "flux", - "intensity", - "irradiance", - "radiance", - "reflectance", - "relative", - "transmittance", - "R-Factor", - "T-Factor", - "other", - ] - ], + value: Literal[ + "absorptance", + "exitance", + "flux", + "intensity", + "irradiance", + "radiance", + "reflectance", + "relative", + "transmittance", + "R-Factor", + "T-Factor", + "other", + ] + | None, ): """Setter for the **self.units** property.""" @@ -1252,7 +1238,7 @@ def units( @property def reflection_geometry( self, - ) -> Optional[ + ) -> ( Literal[ "di:8", "de:8", @@ -1267,7 +1253,8 @@ def reflection_geometry( "0:45x", "other", ] - ]: + | None + ): """ Getter and setter property for the reflection geometry. @@ -1287,22 +1274,21 @@ def reflection_geometry( @reflection_geometry.setter def reflection_geometry( self, - value: Optional[ - Literal[ - "di:8", - "de:8", - "8:di", - "8:de", - "d:d", - "d:0", - "45a:0", - "45c:0", - "0:45a", - "45x:0", - "0:45x", - "other", - ] - ], + value: Literal[ + "di:8", + "de:8", + "8:di", + "8:de", + "d:d", + "d:0", + "45a:0", + "45c:0", + "0:45a", + "45x:0", + "0:45x", + "other", + ] + | None, ): """Setter for the **self.reflection_geometry** property.""" @@ -1317,9 +1303,7 @@ def reflection_geometry( @property def transmission_geometry( self, - ) -> Optional[ - Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"] - ]: + ) -> Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"] | None: """ Getter and setter property for the transmission geometry. @@ -1339,21 +1323,21 @@ def transmission_geometry( @transmission_geometry.setter def transmission_geometry( self, - value: Optional[ - Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"] - ], + value: Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"] + | None, ): """Setter for the **self.transmission_geometry** property.""" if value is not None: - assert is_string(value), ( + attest( + is_string(value), f'"transmission_geometry" property: "{value}" type is not "str"!', ) self._transmission_geometry = value @property - def bandwidth_FWHM(self) -> Optional[float]: + def bandwidth_FWHM(self) -> float | None: """ Getter and setter property for the full-width half-maximum bandwidth. @@ -1371,7 +1355,7 @@ def bandwidth_FWHM(self) -> Optional[float]: return self._bandwidth_FWHM @bandwidth_FWHM.setter - def bandwidth_FWHM(self, value: Optional[float]): + def bandwidth_FWHM(self, value: float | None): """Setter for the **self.bandwidth_FWHM** property.""" if value is not None: @@ -1383,7 +1367,7 @@ def bandwidth_FWHM(self, value: Optional[float]): self._bandwidth_FWHM = value @property - def bandwidth_corrected(self) -> Optional[bool]: + def bandwidth_corrected(self) -> bool | None: """ Getter and setter property for whether bandwidth correction has been applied to the measured data. @@ -1402,7 +1386,7 @@ def bandwidth_corrected(self) -> Optional[bool]: return self._bandwidth_corrected @bandwidth_corrected.setter - def bandwidth_corrected(self, value: Optional[bool]): + def bandwidth_corrected(self, value: bool | None): """Setter for the **self.bandwidth_corrected** property.""" if value is not None: @@ -1507,9 +1491,7 @@ def load( str, Dict[ str, - Union[ - SpectralDistribution_AMPAS, MultiSpectralDistributions_AMPAS - ], + SpectralDistribution_AMPAS | MultiSpectralDistributions_AMPAS, ], ]: """ @@ -1534,10 +1516,10 @@ def load( super().sync() - self._content = dict() + self._content = {} for directory in ("camera", "cmf", "illuminant", "training"): - self._content[directory] = dict() + self._content[directory] = {} factory = cast( Union[ Type[SpectralDistribution_AMPAS], @@ -1557,7 +1539,7 @@ def load( return self._content -_DATASET_LOADER_DYER2017: Optional[DatasetLoader_Dyer2017] = None +_DATASET_LOADER_DYER2017: DatasetLoader_Dyer2017 | None = None """ Singleton instance of the *Dyer et al. (2017)* *RAW to ACES Utility Data* dataset loader. diff --git a/colour_datasets/loaders/ebner1998.py b/colour_datasets/loaders/ebner1998.py index 833a239..978752c 100644 --- a/colour_datasets/loaders/ebner1998.py +++ b/colour_datasets/loaders/ebner1998.py @@ -23,7 +23,7 @@ import os from collections import namedtuple -from colour.hints import Dict, NDArrayFloat, Optional +from colour.hints import Dict, NDArrayFloat from colour.utilities import as_float_array from colour_datasets.loaders import AbstractDatasetLoader @@ -122,7 +122,7 @@ def load( super().sync() - self._content = dict([("Constant Perceived-Hue Data", dict())]) + self._content = {"Constant Perceived-Hue Data": {}} datafile_path = os.path.join( self.record.repository, "dataset", "Ebner_Constant_Hue_Data.txt" @@ -166,7 +166,7 @@ def _parse_float_values(data: str) -> NDArrayFloat: return self._content -_DATASET_LOADER_EBNER1998: Optional[DatasetLoader_Ebner1998] = None +_DATASET_LOADER_EBNER1998: DatasetLoader_Ebner1998 | None = None """ Singleton instance of the *Ebner and Fairchild (1998)* *Constant Perceived-Hue Data* dataset loader. diff --git a/colour_datasets/loaders/hung1995.py b/colour_datasets/loaders/hung1995.py index f46d87d..fb1b571 100644 --- a/colour_datasets/loaders/hung1995.py +++ b/colour_datasets/loaders/hung1995.py @@ -23,7 +23,7 @@ from collections import namedtuple from colour import CCS_ILLUMINANTS, xy_to_XYZ, xyY_to_XYZ -from colour.hints import Dict, Optional +from colour.hints import Dict from colour_datasets.loaders import AbstractDatasetLoader from colour_datasets.records import datasets @@ -120,29 +120,18 @@ def load( super().sync() - self._content = dict() - - filenames = dict( - [ - ("Table I.csv", "Reference colors."), - ( - "Table II.csv", - "Intra- and interobserver variances for each " - "reference hue expressed in circumferential " - "hue-angle difference.", - ), - ( - "Table III.csv", - "Weight-averaged constant hue loci for the CL " - "experiment.", - ), - ( - "Table IV.csv", - "Weight-averaged constant hue loci for the VL " - "experiment.", - ), - ] - ) + self._content = {} + + filenames = { + "Table I.csv": "Reference colors.", + "Table II.csv": "Intra- and interobserver variances for each " + "reference hue expressed in circumferential " + "hue-angle difference.", + "Table III.csv": "Weight-averaged constant hue loci for the CL " + "experiment.", + "Table IV.csv": "Weight-averaged constant hue loci for the VL " + "experiment.", + } for filename in filenames: datafile_path = os.path.join( @@ -178,7 +167,7 @@ def load( for table, experiment in [("Table III", "CL"), ("Table IV", "VL")]: key = f"Constant Hue Loci Data - {experiment}" - self._content[key] = dict() + self._content[key] = {} for hue in hues: for sample_r in self._content["Table I"]: sample_r = sample_r.tolist() @@ -193,7 +182,7 @@ def load( } for sample_t in self._content[table]: sample_t = sample_t.tolist() - if not sample_t[0] == hue: + if sample_t[0] != hue: continue XYZ_ct.append(sample_t[2:]) @@ -209,7 +198,7 @@ def load( return self._content -_DATASET_LOADER_HUNG1995: Optional[DatasetLoader_Hung1995] = None +_DATASET_LOADER_HUNG1995: DatasetLoader_Hung1995 | None = None """ Singleton instance of the *Hung and Berns (1995)* *Constant Hue Loci Data* dataset loader. diff --git a/colour_datasets/loaders/jakob2019.py b/colour_datasets/loaders/jakob2019.py index 0b15994..5cf68c6 100644 --- a/colour_datasets/loaders/jakob2019.py +++ b/colour_datasets/loaders/jakob2019.py @@ -10,7 +10,7 @@ References ---------- -- :cite:`Jakob2019` : Jakob, W., & Hanika, J. (2019). A Low‐Dimensional +- :cite:`Jakob2019` : Jakob, W., & Hanika, J. (2019). A Low-Dimensional Function Space for Efficient Spectral Upsampling. Computer Graphics Forum, 38(2), 147-155. doi:10.1111/cgf.13626 """ @@ -20,7 +20,7 @@ import glob import os -from colour.hints import Dict, Optional +from colour.hints import Dict from colour.recovery import LUT3D_Jakob2019 from colour_datasets.loaders import AbstractDatasetLoader @@ -88,7 +88,7 @@ def load(self) -> Dict[str, LUT3D_Jakob2019]: super().sync() - self._content = dict() + self._content = {} tables_path = os.path.join( self.record.repository, @@ -117,7 +117,7 @@ def load(self) -> Dict[str, LUT3D_Jakob2019]: return self._content -_DATASET_LOADER_JAKOB2019: Optional[DatasetLoader_Jakob2019] = None +_DATASET_LOADER_JAKOB2019: DatasetLoader_Jakob2019 | None = None """ Singleton instance of the *Jakob and Hanika (2019)* *Spectral Upsampling Coefficient Tables* dataset loader. diff --git a/colour_datasets/loaders/jiang2013.py b/colour_datasets/loaders/jiang2013.py index 80752e4..5a81afc 100644 --- a/colour_datasets/loaders/jiang2013.py +++ b/colour_datasets/loaders/jiang2013.py @@ -25,7 +25,7 @@ from colour import SpectralShape from colour.characterisation import RGB_CameraSensitivities -from colour.hints import Dict, Optional +from colour.hints import Dict from colour.utilities import as_float_array from colour_datasets.loaders import AbstractDatasetLoader @@ -95,7 +95,7 @@ def load(self) -> Dict[str, RGB_CameraSensitivities]: shape = SpectralShape(400, 720, 10) - self._content = dict() + self._content = {} database_path = os.path.join( self.record.repository, "dataset", "camspec_database.txt" ) @@ -124,7 +124,7 @@ def load(self) -> Dict[str, RGB_CameraSensitivities]: return self._content -_DATASET_LOADER_JIANG2013: Optional[DatasetLoader_Jiang2013] = None +_DATASET_LOADER_JIANG2013: DatasetLoader_Jiang2013 | None = None """ Singleton instance of the *Jiang et al. (2013)* *Camera Spectral Sensitivity Database* dataset loader. diff --git a/colour_datasets/loaders/karge2015.py b/colour_datasets/loaders/karge2015.py index 7c09d83..1aa7b37 100644 --- a/colour_datasets/loaders/karge2015.py +++ b/colour_datasets/loaders/karge2015.py @@ -23,7 +23,7 @@ from collections import defaultdict from colour.algebra import LinearInterpolator -from colour.hints import Dict, Optional +from colour.hints import Dict from colour.io import read_sds_from_csv_file from colour_datasets.loaders import AbstractDatasetLoader @@ -109,7 +109,7 @@ def load(self) -> Dict[str, Dict[str, Dict]]: category = "Normalised" if "normalized" in path else "Raw" path = os.path.join(database_root, path) - sds = dict() + sds = {} for name, sd in read_sds_from_csv_file( path, transpose=True, delimiter=";" ).items(): @@ -124,7 +124,7 @@ def load(self) -> Dict[str, Dict[str, Dict]]: return dict(self._content) -_DATASET_LOADER_KARGE2015: Optional[DatasetLoader_Karge2015] = None +_DATASET_LOADER_KARGE2015: DatasetLoader_Karge2015 | None = None """ Singleton instance of the *Karge et al. (2015)* *Spectral Database of Commonly Used Cine Lighting* dataset loader. diff --git a/colour_datasets/loaders/kuopio.py b/colour_datasets/loaders/kuopio.py index 585565d..6b011b3 100644 --- a/colour_datasets/loaders/kuopio.py +++ b/colour_datasets/loaders/kuopio.py @@ -35,6 +35,7 @@ from __future__ import annotations +import contextlib import functools import numpy as np import os @@ -112,7 +113,7 @@ def read_sds_from_mat_file_KuopioUniversity( matlab_data = scipy.io.loadmat(mat_file) - sds = dict() + sds = {} table = matlab_data[metadata.key] wavelengths = metadata.shape.range() @@ -177,7 +178,7 @@ def load(self) -> Dict[str, Dict[str, SpectralDistribution]]: super().sync() - self._content = dict() + self._content = {} for path, metadata in self.METADATA.items(): mat_path = os.path.join(self.record.repository, "dataset", *path) @@ -263,10 +264,8 @@ class instances. ) dataset_loader_class.__doc__ = class_docstring - try: + with contextlib.suppress(AttributeError): dataset_loader_class.load.__doc__ = load_method_docstring - except AttributeError: - pass setattr(module, class_attribute, dataset_loader_class) @@ -516,7 +515,7 @@ def build_KuopioUniversity( DATASET_LOADERS_KUOPIO_UNIVERSITY[_id] = _partial_function - __all__ += [ + __all__ += [ # noqa: PLE0604 _dataset_loader_class.__name__, _build_function_name, ] diff --git a/colour_datasets/loaders/labsphere2019.py b/colour_datasets/loaders/labsphere2019.py index ff26c65..e25e3aa 100644 --- a/colour_datasets/loaders/labsphere2019.py +++ b/colour_datasets/loaders/labsphere2019.py @@ -89,16 +89,11 @@ def load(self) -> Dict[str, SpectralDistribution]: ) values = tsplit(np.loadtxt(sd_path, delimiter="\t", skiprows=2)) - self._content = dict( - [ - ( - "Labsphere SRS-99-020", - SpectralDistribution( - values[1], values[0], name="Labsphere SRS-99-020" - ), - ), - ] - ) + self._content = { + "Labsphere SRS-99-020": SpectralDistribution( + values[1], values[0], name="Labsphere SRS-99-020" + ), + } return self._content diff --git a/colour_datasets/loaders/luo1997.py b/colour_datasets/loaders/luo1997.py index 5590637..387f14e 100644 --- a/colour_datasets/loaders/luo1997.py +++ b/colour_datasets/loaders/luo1997.py @@ -13,16 +13,16 @@ - :cite:`Luo1991` : Luo, M. R., Clarke, A. A., Rhodes, P. A., Schappo, A., Scrivener, S. A. R., & Tait, C. J. (1991b). Quantifying colour appearance. Part I. Lutchi colour appearance data. Color Research & Application, 16(3), - 166–180. doi:10.1002/col.5080160307 + 166-180. doi:10.1002/col.5080160307 - :cite:`Luo1991a` : Luo, M. R., Clarke, A. A., Rhodes, P. A., Schappo, A., Scrivener, S. A. R., & Tait, C. J. (1991a). Quantifying colour appearance. Part II. Testing colour models performance using lutchi colour appearance - data. Color Research & Application, 16(3), 181–197. + data. Color Research & Application, 16(3), 181-197. doi:10.1002/col.5080160308 - :cite:`Luo1993` : Luo, M. R., Gao, X. W., Rhodes, P. A., Xin, H. J., Clarke, A. A., & Scrivener, S. A. R. (1993). Quantifying colour appearance. part III. Supplementary LUTCHI colour appearance data. Color Research & - Application, 18(2), 98–113. doi:10.1002/col.5080180207 + Application, 18(2), 98-113. doi:10.1002/col.5080180207 - :cite:`Luo1997` : Luo, M. R., & Rhodes, P. A. (1997). Using the LUTCHI Colour Appearance Data. Retrieved September 10, 2019, from https://web.archive.org/web/20040212195937/\ @@ -35,7 +35,7 @@ import os from collections import namedtuple -from colour.hints import Dict, Optional, Tuple +from colour.hints import Dict, Tuple from colour.utilities import as_float_array, usage_warning from colour_datasets.loaders import AbstractDatasetLoader @@ -209,835 +209,783 @@ def load(self) -> Dict[str, ExperimentalGroupLuo1997]: "Neutrals", ) - experimental_groups_summary: Dict[str, Tuple] = dict( - [ + experimental_groups_summary: Dict[str, Tuple] = { + "R-HL": ( + 6, + "Reflective media with luminances ranging 364-232 cd/m2", + 1, + ), + "R-LL": ( + 6, + "Reflective media with luminances ranging 44-41 cd/m2", + 1, + ), + "R-VL": ( + 12, + "Reflective media with luminances ranging 843-0.4 cd/m2", + 2, + ), + "R-textile": ( + 3, + "Large textile samples with luminances ranging 730-340 cd/m2", + 4, + ), + "CRT": ( + 11, + "Monitor colours with luminances ranging 45-20 cd/m2", + 1, + ), + "35mm": ( + 6, + "35mm transparency with luminances ranging 113-45 cd/m2", + 3, + ), + "LT": ( + 10, ( - "R-HL", - ( - 6, - "Reflective media with luminances ranging 364-232 cd/m2", - 1, - ), + "Cut-sheet transparency with luminances ranging " + "2100-320 cd/m2" ), + 3, + ), + "BIT": ( + 5, + "Isolated viewing field with luminances ranging 90-3.6 cd/m2", + 5, + ), + } + + experimental_groups: Dict[str, Tuple] = { + "R-HL": ( ( - "R-LL", - ( - 6, - "Reflective media with luminances ranging 44-41 cd/m2", - 1, - ), + 1, + "nlmean.wh", + "cold50wnl", + 105, + 41, + 46, + 0.88, + 100, + 264, + np.array([97.13, 100, 76.62]), ), ( - "R-VL", - ( - 12, - "Reflective media with luminances ranging 843-0.4 cd/m2", - 2, - ), + 2, + "nlmean.bh", + "cold50gb", + 105, + 41, + 46, + 0.84, + 6.2, + 252, + np.array([97.09, 100, 83.1]), ), ( - "R-textile", - ( - 3, - "Large textile samples with luminances ranging 730-340 cd/m2", - 4, - ), + 3, + "nlmean.gh", + "cold50gb", + 105, + 41, + 46, + 0.84, + 21.5, + 252, + np.array([97.09, 100, 83.1]), ), ( - "CRT", - ( - 11, - "Monitor colours with luminances ranging 45-20 cd/m2", - 1, - ), + 4, + "nld65.gh", + "cold65", + 105, + 41, + 46, + 0.81, + 21.5, + 243, + np.array([94.52, 100, 114.98]), ), ( - "35mm", - ( - 6, - "35mm transparency with luminances ranging 113-45 cd/m2", - 3, - ), + 5, + "nlwf.gh", + "colwf", + 105, + 41, + 46, + 0.84, + 21.5, + 252, + np.array([102.5, 100, 47.93]), ), ( - "LT", - ( - 10, - ( - "Cut-sheet transparency with luminances ranging " - "2100-320 cd/m2" - ), - 3, - ), + 6, + "nla.gh", + "colah", + 105, + 41, + 46, + 0.84, + 21.5, + 232, + np.array([112.92, 100, 28.62]), ), + ), + "R-LL": ( ( - "BIT", - ( - 5, - "Isolated viewing field with luminances ranging 90-3.6 cd/m2", - 5, - ), + 1, + "nlmean.wl", + "cold50wnl", + 105, + 41, + 46, + 0.88, + 100, + 44, + np.array([97.13, 100, 76.62]), ), - ] - ) - - experimental_groups: Dict[str, Tuple] = dict( - [ ( - "R-HL", - ( - ( - 1, - "nlmean.wh", - "cold50wnl", - 105, - 41, - 46, - 0.88, - 100, - 264, - np.array([97.13, 100, 76.62]), - ), - ( - 2, - "nlmean.bh", - "cold50gb", - 105, - 41, - 46, - 0.84, - 6.2, - 252, - np.array([97.09, 100, 83.1]), - ), - ( - 3, - "nlmean.gh", - "cold50gb", - 105, - 41, - 46, - 0.84, - 21.5, - 252, - np.array([97.09, 100, 83.1]), - ), - ( - 4, - "nld65.gh", - "cold65", - 105, - 41, - 46, - 0.81, - 21.5, - 243, - np.array([94.52, 100, 114.98]), - ), - ( - 5, - "nlwf.gh", - "colwf", - 105, - 41, - 46, - 0.84, - 21.5, - 252, - np.array([102.5, 100, 47.93]), - ), - ( - 6, - "nla.gh", - "colah", - 105, - 41, - 46, - 0.84, - 21.5, - 232, - np.array([112.92, 100, 28.62]), - ), - ), + 2, + "nlmean.bl", + "cold50gb", + 105, + 41, + 46, + 0.84, + 6.2, + 42, + np.array([97.09, 100, 83.1]), ), ( - "R-LL", - ( - ( - 1, - "nlmean.wl", - "cold50wnl", - 105, - 41, - 46, - 0.88, - 100, - 44, - np.array([97.13, 100, 76.62]), - ), - ( - 2, - "nlmean.bl", - "cold50gb", - 105, - 41, - 46, - 0.84, - 6.2, - 42, - np.array([97.09, 100, 83.1]), - ), - ( - 3, - "nlmean.gl", - "cold50gb", - 105, - 41, - 46, - 0.84, - 21.5, - 42, - np.array([97.09, 100, 83.1]), - ), - ( - 4, - "nld65.gl", - "cold65", - 105, - 41, - 46, - 0.81, - 21.5, - 40.5, - np.array([94.52, 100, 114.98]), - ), - ( - 5, - "nlwf.gl", - "colwf", - 105, - 41, - 46, - 0.84, - 21.5, - 42, - np.array([102.5, 100, 47.93]), - ), - ( - 6, - "nla.gl", - "colal", - 105, - 41, - 46, - 0.84, - 21.4, - 42, - np.array([117.26, 100, 22.44]), - ), - ), + 3, + "nlmean.gl", + "cold50gb", + 105, + 41, + 46, + 0.84, + 21.5, + 42, + np.array([97.09, 100, 83.1]), ), ( - "R-VL", - ( - ( - 1, - "mean4.p1", - "col.rf.p1", - 40, - 37, - 40, - 1, - 21.5, - 843, - np.array([94.04, 100, 76.29]), - ), - ( - 2, - "mean4.p2", - "col.rf.p2", - 40, - 37, - 40, - 1, - 21.5, - 200, - np.array([93.04, 100, 72.24]), - ), - ( - 3, - "mean4.p3", - "col.rf.p3", - 40, - 37, - 40, - 1, - 21.5, - 62, - np.array([93.94, 100, 73.51]), - ), - ( - 4, - "mean4.p4", - "col.rf.p4", - 40, - 37, - 40, - 1, - 21.5, - 17, - np.array([93.44, 100, 72.49]), - ), - ( - 5, - "mean4.p5", - "col.rf.p5", - 40, - 37, - 40, - 1, - 21.5, - 6, - np.array([92.22, 100, 70.12]), - ), - ( - 6, - "mean4.p6", - "col.rf.p6", - 40, - 37, - 40, - 1, - 21.5, - 0.4, - np.array([90.56, 100, 58.59]), - ), - ( - 7, - "mean4.p7", - "col.rf.p1", - 40, - 37, - 40, - 1, - 21.5, - 843, - np.array([94.04, 100, 76.29]), - ), - ( - 8, - "mean4.p8", - "col.rf.p2", - 40, - 37, - 40, - 1, - 21.5, - 200, - np.array([93.04, 100, 72.24]), - ), - ( - 9, - "mean4.p9", - "col.rf.p3", - 40, - 37, - 40, - 1, - 21.5, - 62, - np.array([93.94, 100, 73.51]), - ), - ( - 10, - "mean4.p10", - "col.rf.p4", - 40, - 37, - 40, - 1, - 21.5, - 17, - np.array([93.44, 100, 72.49]), - ), - ( - 11, - "mean4.p11", - "col.rf.p5", - 40, - 37, - 40, - 1, - 21.5, - 6, - np.array([92.22, 100, 70.12]), - ), - ( - 12, - "mean4.p12", - "col.rf.p6", - 40, - 37, - 40, - 1, - 21.5, - 0.4, - np.array([90.56, 100, 58.59]), - ), - ), + 4, + "nld65.gl", + "cold65", + 105, + 41, + 46, + 0.81, + 21.5, + 40.5, + np.array([94.52, 100, 114.98]), ), ( - "R-textile", - ( - ( - 1, - "kuo.d65.vis", - "kuo.d65.col", - 240, - 1, - 12, - 0.74, - 16, - 250, - np.array([96.46, 100, 108.62]), - ), - ( - 2, - "kuo.tl84.vis", - "kuo.tl84.col", - 239, - 1, - 10, - 0.74, - 16, - 540, - np.array([103.07, 100, 64.29]), - ), - ( - 3, - "kuo.a.vis", - "kuo.a.col", - 239, - 1, - 11, - 0.74, - 16, - 250, - np.array([115.19, 100, 23.75]), - ), - ), + 5, + "nlwf.gl", + "colwf", + 105, + 41, + 46, + 0.84, + 21.5, + 42, + np.array([102.5, 100, 47.93]), ), ( - "CRT", - ( - ( - 1, - "lmean.ww", - "cold50wl", - 94, - 39, - 44, - 0.89, - 100, - 40, - np.array([97.13, 100, 76.62]), - ), - ( - 2, - "lmean.bb", - "cold50gbl", - 100, - 39, - 44, - 0.89, - 5, - 44.5, - np.array([97.13, 100, 76.62]), - ), - ( - 3, - "lmean.gg", - "cold50gbl", - 100, - 39, - 44, - 0.89, - 20, - 44.5, - np.array([97.13, 100, 76.62]), - ), - ( - 4, - "lmean.gw", - "cold50gbl", - 100, - 39, - 44, - 0.89, - 20, - 44.5, - np.array([97.13, 100, 76.62]), - ), - ( - 5, - "lmean.gb", - "cold50gbl", - 100, - 39, - 44, - 0.89, - 20, - 44.5, - np.array([97.13, 100, 76.62]), - ), - ( - 6, - "ld65.gg", - "cold65.l", - 103, - 39, - 44, - 0.81, - 21.5, - 40.5, - np.array([94.52, 100, 114.98]), - ), - ( - 7, - "ld65.gw", - "cold65.l", - 103, - 39, - 44, - 0.81, - 21.5, - 40.5, - np.array([94.52, 100, 114.98]), - ), - ( - 8, - "lwf.gg", - "colwf.l", - 103, - 39, - 44, - 0.84, - 21.5, - 28.4, - np.array([102.5, 100, 47.93]), - ), - ( - 9, - "lwf.gw", - "colwf.l", - 103, - 39, - 44, - 0.84, - 21.5, - 28.4, - np.array([102.5, 100, 47.93]), - ), - ( - 10, - "la.gg", - "colal.l", - 61, - 29, - 34, - 0.84, - 21.5, - 20.3, - np.array([117.26, 100, 22.44]), - ), - ( - 11, - "la.gw", - "colal.l", - 61, - 29, - 34, - 0.84, - 21.5, - 20.3, - np.array([117.26, 100, 22.44]), - ), - ), + 6, + "nla.gl", + "colal", + 105, + 41, + 46, + 0.84, + 21.4, + 42, + np.array([117.26, 100, 22.44]), ), + ), + "R-VL": ( ( - "35mm", - ( - ( - 1, - "mean.35.p1", - "col.35.p1", - 99, - 93, - 99, - 1, - 15.6, - 75, - np.array([92.9, 100, 46.1]), - ), - ( - 2, - "mean.35.p2", - "col.35.p2", - 99, - 93, - 98, - 1, - 14.7, - 75, - np.array([86.71, 100, 75.49]), - ), - ( - 3, - "mean.35.p3", - "col.35.p3", - 99, - 93, - 99, - 1, - 18.9, - 113, - np.array([92.57, 100, 45.47]), - ), - ( - 4, - "mean.35.p4", - "col.35.p1", - 99, - 93, - 99, - 1, - 18.9, - 45, - np.array([92.9, 100, 46.1]), - ), - ( - 5, - "mean.35.p5", - "col.35.p5", - 95, - 89, - 95, - 1, - 19.2, - 47, - np.array([93.8, 100, 52.39]), - ), - ( - 6, - "mean.35.p6", - "col.35.p6", - 36, - 26, - 30, - 1, - 18.9, - 113, - np.array([95.32, 100, 53.37]), - ), - ), + 1, + "mean4.p1", + "col.rf.p1", + 40, + 37, + 40, + 1, + 21.5, + 843, + np.array([94.04, 100, 76.29]), ), ( - "LT", - ( - ( - 1, - "mean.p1", - "col.p1", - 98, - 94, - 98, - 1, - 15.9, - 2259, - np.array([93.09, 100, 62.02]), - ), - ( - 2, - "mean.p2", - "col.p2", - 98, - 94, - 98, - 1, - 17.1, - 689, - np.array([93.23, 100, 61.15]), - ), - ( - 3, - "mean.p3", - "col.p3", - 98, - 94, - 98, - 1, - 16.9, - 325, - np.array([92.36, 100, 59.91]), - ), - ( - 4, - "mean.p4", - "col.p4", - 98, - 94, - 98, - 1, - 17.4, - 670, - np.array([93.05, 100, 58.58]), - ), - ( - 5, - "mean.p5t", - "col.p5t", - 97, - 93, - 97, - 1, - 9.6, - 1954, - np.array([93.3, 100, 59.54]), - ), - ( - 6, - "mean.p6t", - "col.p6t", - 94, - 90, - 94, - 1, - 9.5, - 619, - np.array([93.2, 100, 60.48]), - ), - ( - 7, - "mean.p7t", - "col.p7t", - 93, - 89, - 93, - 1, - 9.8, - 319, - np.array([92.43, 100, 59.21]), - ), - ( - 8, - "mean.p8", - "col.p8", - 98, - 94, - 98, - 1, - 9.4, - 642, - np.array([93.34, 100, 57.98]), - ), - ( - 9, - "mean.p10", - "col.p10", - 98, - 94, - 98, - 1, - 9.6, - 658, - np.array([93.34, 100, 57.98]), - ), - ( - 10, - "mean.p1t", - "col.p1t", - 94, - 90, - 94, - 1, - 17.5, - 680, - np.array([93.34, 100, 57.98]), - ), - ), + 2, + "mean4.p2", + "col.rf.p2", + 40, + 37, + 40, + 1, + 21.5, + 200, + np.array([93.04, 100, 72.24]), ), ( - "BIT", - ( - ( - 1, - "bit_p1.vis", - "bit_p1.col", - 120, - 1, - 16, - 1, - 0.6, - 90, - np.array([100.6, 100, 113.2]), - ), - ( - 2, - "bit_p2.vis", - "bit_p2.col", - 120, - 1, - 18, - 1, - 0.6, - 3.6, - np.array([100.6, 100, 113.2]), - ), - ( - 3, - "bit_p3.vis", - "bit_p3.col", - 120, - 1, - 15, - 1, - 0.6, - 90, - np.array([100.6, 100, 113.2]), - ), - ( - 4, - "bit_p4.vis", - "bit_p4.col", - 90, - 1, - 18, - 1, - 0.6, - 90, - np.array([100.6, 100, 113.2]), - ), - ( - 5, - "bit_p5.vis", - "bit_p5.col", - 90, - 1, - 12, - 1, - 0.6, - 3.6, - np.array([100.6, 100, 113.2]), - ), - ), + 3, + "mean4.p3", + "col.rf.p3", + 40, + 37, + 40, + 1, + 21.5, + 62, + np.array([93.94, 100, 73.51]), ), - ] - ) + ( + 4, + "mean4.p4", + "col.rf.p4", + 40, + 37, + 40, + 1, + 21.5, + 17, + np.array([93.44, 100, 72.49]), + ), + ( + 5, + "mean4.p5", + "col.rf.p5", + 40, + 37, + 40, + 1, + 21.5, + 6, + np.array([92.22, 100, 70.12]), + ), + ( + 6, + "mean4.p6", + "col.rf.p6", + 40, + 37, + 40, + 1, + 21.5, + 0.4, + np.array([90.56, 100, 58.59]), + ), + ( + 7, + "mean4.p7", + "col.rf.p1", + 40, + 37, + 40, + 1, + 21.5, + 843, + np.array([94.04, 100, 76.29]), + ), + ( + 8, + "mean4.p8", + "col.rf.p2", + 40, + 37, + 40, + 1, + 21.5, + 200, + np.array([93.04, 100, 72.24]), + ), + ( + 9, + "mean4.p9", + "col.rf.p3", + 40, + 37, + 40, + 1, + 21.5, + 62, + np.array([93.94, 100, 73.51]), + ), + ( + 10, + "mean4.p10", + "col.rf.p4", + 40, + 37, + 40, + 1, + 21.5, + 17, + np.array([93.44, 100, 72.49]), + ), + ( + 11, + "mean4.p11", + "col.rf.p5", + 40, + 37, + 40, + 1, + 21.5, + 6, + np.array([92.22, 100, 70.12]), + ), + ( + 12, + "mean4.p12", + "col.rf.p6", + 40, + 37, + 40, + 1, + 21.5, + 0.4, + np.array([90.56, 100, 58.59]), + ), + ), + "R-textile": ( + ( + 1, + "kuo.d65.vis", + "kuo.d65.col", + 240, + 1, + 12, + 0.74, + 16, + 250, + np.array([96.46, 100, 108.62]), + ), + ( + 2, + "kuo.tl84.vis", + "kuo.tl84.col", + 239, + 1, + 10, + 0.74, + 16, + 540, + np.array([103.07, 100, 64.29]), + ), + ( + 3, + "kuo.a.vis", + "kuo.a.col", + 239, + 1, + 11, + 0.74, + 16, + 250, + np.array([115.19, 100, 23.75]), + ), + ), + "CRT": ( + ( + 1, + "lmean.ww", + "cold50wl", + 94, + 39, + 44, + 0.89, + 100, + 40, + np.array([97.13, 100, 76.62]), + ), + ( + 2, + "lmean.bb", + "cold50gbl", + 100, + 39, + 44, + 0.89, + 5, + 44.5, + np.array([97.13, 100, 76.62]), + ), + ( + 3, + "lmean.gg", + "cold50gbl", + 100, + 39, + 44, + 0.89, + 20, + 44.5, + np.array([97.13, 100, 76.62]), + ), + ( + 4, + "lmean.gw", + "cold50gbl", + 100, + 39, + 44, + 0.89, + 20, + 44.5, + np.array([97.13, 100, 76.62]), + ), + ( + 5, + "lmean.gb", + "cold50gbl", + 100, + 39, + 44, + 0.89, + 20, + 44.5, + np.array([97.13, 100, 76.62]), + ), + ( + 6, + "ld65.gg", + "cold65.l", + 103, + 39, + 44, + 0.81, + 21.5, + 40.5, + np.array([94.52, 100, 114.98]), + ), + ( + 7, + "ld65.gw", + "cold65.l", + 103, + 39, + 44, + 0.81, + 21.5, + 40.5, + np.array([94.52, 100, 114.98]), + ), + ( + 8, + "lwf.gg", + "colwf.l", + 103, + 39, + 44, + 0.84, + 21.5, + 28.4, + np.array([102.5, 100, 47.93]), + ), + ( + 9, + "lwf.gw", + "colwf.l", + 103, + 39, + 44, + 0.84, + 21.5, + 28.4, + np.array([102.5, 100, 47.93]), + ), + ( + 10, + "la.gg", + "colal.l", + 61, + 29, + 34, + 0.84, + 21.5, + 20.3, + np.array([117.26, 100, 22.44]), + ), + ( + 11, + "la.gw", + "colal.l", + 61, + 29, + 34, + 0.84, + 21.5, + 20.3, + np.array([117.26, 100, 22.44]), + ), + ), + "35mm": ( + ( + 1, + "mean.35.p1", + "col.35.p1", + 99, + 93, + 99, + 1, + 15.6, + 75, + np.array([92.9, 100, 46.1]), + ), + ( + 2, + "mean.35.p2", + "col.35.p2", + 99, + 93, + 98, + 1, + 14.7, + 75, + np.array([86.71, 100, 75.49]), + ), + ( + 3, + "mean.35.p3", + "col.35.p3", + 99, + 93, + 99, + 1, + 18.9, + 113, + np.array([92.57, 100, 45.47]), + ), + ( + 4, + "mean.35.p4", + "col.35.p1", + 99, + 93, + 99, + 1, + 18.9, + 45, + np.array([92.9, 100, 46.1]), + ), + ( + 5, + "mean.35.p5", + "col.35.p5", + 95, + 89, + 95, + 1, + 19.2, + 47, + np.array([93.8, 100, 52.39]), + ), + ( + 6, + "mean.35.p6", + "col.35.p6", + 36, + 26, + 30, + 1, + 18.9, + 113, + np.array([95.32, 100, 53.37]), + ), + ), + "LT": ( + ( + 1, + "mean.p1", + "col.p1", + 98, + 94, + 98, + 1, + 15.9, + 2259, + np.array([93.09, 100, 62.02]), + ), + ( + 2, + "mean.p2", + "col.p2", + 98, + 94, + 98, + 1, + 17.1, + 689, + np.array([93.23, 100, 61.15]), + ), + ( + 3, + "mean.p3", + "col.p3", + 98, + 94, + 98, + 1, + 16.9, + 325, + np.array([92.36, 100, 59.91]), + ), + ( + 4, + "mean.p4", + "col.p4", + 98, + 94, + 98, + 1, + 17.4, + 670, + np.array([93.05, 100, 58.58]), + ), + ( + 5, + "mean.p5t", + "col.p5t", + 97, + 93, + 97, + 1, + 9.6, + 1954, + np.array([93.3, 100, 59.54]), + ), + ( + 6, + "mean.p6t", + "col.p6t", + 94, + 90, + 94, + 1, + 9.5, + 619, + np.array([93.2, 100, 60.48]), + ), + ( + 7, + "mean.p7t", + "col.p7t", + 93, + 89, + 93, + 1, + 9.8, + 319, + np.array([92.43, 100, 59.21]), + ), + ( + 8, + "mean.p8", + "col.p8", + 98, + 94, + 98, + 1, + 9.4, + 642, + np.array([93.34, 100, 57.98]), + ), + ( + 9, + "mean.p10", + "col.p10", + 98, + 94, + 98, + 1, + 9.6, + 658, + np.array([93.34, 100, 57.98]), + ), + ( + 10, + "mean.p1t", + "col.p1t", + 94, + 90, + 94, + 1, + 17.5, + 680, + np.array([93.34, 100, 57.98]), + ), + ), + "BIT": ( + ( + 1, + "bit_p1.vis", + "bit_p1.col", + 120, + 1, + 16, + 1, + 0.6, + 90, + np.array([100.6, 100, 113.2]), + ), + ( + 2, + "bit_p2.vis", + "bit_p2.col", + 120, + 1, + 18, + 1, + 0.6, + 3.6, + np.array([100.6, 100, 113.2]), + ), + ( + 3, + "bit_p3.vis", + "bit_p3.col", + 120, + 1, + 15, + 1, + 0.6, + 90, + np.array([100.6, 100, 113.2]), + ), + ( + 4, + "bit_p4.vis", + "bit_p4.col", + 90, + 1, + 18, + 1, + 0.6, + 90, + np.array([100.6, 100, 113.2]), + ), + ( + 5, + "bit_p5.vis", + "bit_p5.col", + 90, + 1, + 12, + 1, + 0.6, + 3.6, + np.array([100.6, 100, 113.2]), + ), + ), + } filenames = set() - self._content = dict() + self._content = {} for group, phases in experimental_groups.items(): - experimental_phases = dict() + experimental_phases = {} for ( phase, visual_filename, @@ -1105,7 +1053,7 @@ def load(self) -> Dict[str, ExperimentalGroupLuo1997]: return self._content -_DATASET_LOADER_LUO1997: Optional[DatasetLoader_Luo1997] = None +_DATASET_LOADER_LUO1997: DatasetLoader_Luo1997 | None = None """ Singleton instance of the *Luo and Rhodes (1997)* *LUTCHI Colour Appearance Data* dataset loader. diff --git a/colour_datasets/loaders/luo1999.py b/colour_datasets/loaders/luo1999.py index 8d9d6a8..aefefa9 100644 --- a/colour_datasets/loaders/luo1999.py +++ b/colour_datasets/loaders/luo1999.py @@ -30,7 +30,7 @@ import os from collections import namedtuple -from colour.hints import Dict, Optional, Tuple, cast +from colour.hints import Dict, Tuple, cast from colour.utilities import as_float_array from colour_datasets.loaders import AbstractDatasetLoader @@ -173,306 +173,258 @@ def load(self) -> Dict[str, CorrespondingColourDataset_Luo1999]: "Experimental Method", ) - corresponding_colour_datasets: Dict[str, Tuple] = dict( - [ + corresponding_colour_datasets: Dict[str, Tuple] = { + "CSAJ-C": ( + ("CSAJ.da.dat",), ( - "CSAJ-C", - ( - ("CSAJ.da.dat",), - ( - 1, - 87, - "D65", - "A", - np.tile(1000, [1, 2]), - np.tile(20, [1, 2]), - "S", - "Refl.", - "Haploscopic", - ), - ), + 1, + 87, + "D65", + "A", + np.tile(1000, [1, 2]), + np.tile(20, [1, 2]), + "S", + "Refl.", + "Haploscopic", ), + ), + "CSAJ-Hunt": ( ( - "CSAJ-Hunt", - ( - ( - "CSAJ.10.dat", - "CSAJ.50.dat", - "CSAJ.1000.dat", - "CSAJ.3000.dat", - ), - ( - 4, - 20, - "D65", - "D65", - np.repeat([10, 50, 1000, 3000], 2, -1).reshape( - -1, 2 - ), - np.tile(20, [4, 2]), - "S", - "Refl.", - "Haploscopic", - ), - ), + "CSAJ.10.dat", + "CSAJ.50.dat", + "CSAJ.1000.dat", + "CSAJ.3000.dat", ), ( - "CSAJ-Stevens", - ( - ( - "Steve.10.dat", - "Steve.50.dat", - "Steve.1000.dat", - "Steve.3000.dat", - ), - ( - 4, - 19, - "D65", - "D65", - np.repeat([10, 50, 1000, 3000], 2, -1).reshape( - -1, 2 - ), - np.tile(20, [4, 2]), - "S", - "Refl.", - "Haploscopic", - ), - ), + 4, + 20, + "D65", + "D65", + np.repeat([10, 50, 1000, 3000], 2, -1).reshape(-1, 2), + np.tile(20, [4, 2]), + "S", + "Refl.", + "Haploscopic", ), + ), + "CSAJ-Stevens": ( ( - "Helson", - ( - ("helson.ca.dat",), - ( - 1, - 59, - "D65", - "A", - np.tile(1000, [1, 2]), - np.tile(20, [1, 2]), - "S", - "Refl.", - "Memory", - ), - ), + "Steve.10.dat", + "Steve.50.dat", + "Steve.1000.dat", + "Steve.3000.dat", ), ( - "Lam & Rigg", - ( - ("lam.da.dat",), - ( - 1, - 58, - "D65", - "A", - np.tile(1000, [1, 2]), - np.tile(20, [1, 2]), - "L", - "Refl.", - "Memory", - ), - ), + 4, + 19, + "D65", + "D65", + np.repeat([10, 50, 1000, 3000], 2, -1).reshape(-1, 2), + np.tile(20, [4, 2]), + "S", + "Refl.", + "Haploscopic", ), + ), + "Helson": ( + ("helson.ca.dat",), ( - "Lutchi (A)", - ( - ("lutchi.da.dat",), - ( - 1, - 43, - "D65", - "A", - np.tile(1000, [1, 2]), - np.tile(20, [1, 2]), - "S", - "Refl.", - "Magnitude", - ), - ), + 1, + 59, + "D65", + "A", + np.tile(1000, [1, 2]), + np.tile(20, [1, 2]), + "S", + "Refl.", + "Memory", ), + ), + "Lam & Rigg": ( + ("lam.da.dat",), ( - "Lutchi (D50)", - ( - ("lutchi.dd.dat",), - ( - 1, - 44, - "D65", - "D50", - np.tile(1000, [1, 2]), - np.tile(20, [1, 2]), - "S", - "Refl.", - "Magnitude", - ), - ), + 1, + 58, + "D65", + "A", + np.tile(1000, [1, 2]), + np.tile(20, [1, 2]), + "L", + "Refl.", + "Memory", ), + ), + "Lutchi (A)": ( + ("lutchi.da.dat",), ( - "Lutchi (WF)", - ( - ("lutchi.dw.dat",), - ( - 1, - 41, - "D65", - "WF", - np.tile(1000, [1, 2]), - np.tile(20, [1, 2]), - "S", - "Refl.", - "Magnitude", - ), - ), + 1, + 43, + "D65", + "A", + np.tile(1000, [1, 2]), + np.tile(20, [1, 2]), + "S", + "Refl.", + "Magnitude", ), + ), + "Lutchi (D50)": ( + ("lutchi.dd.dat",), ( - "Kuo & Luo (A)", - ( - ("Kuo.da.dat",), - ( - 1, - 40, - "D65", - "A", - np.tile(1000, [1, 2]), - np.tile(20, [1, 2]), - "L", - "Refl.", - "Magnitude", - ), - ), + 1, + 44, + "D65", + "D50", + np.tile(1000, [1, 2]), + np.tile(20, [1, 2]), + "S", + "Refl.", + "Magnitude", ), + ), + "Lutchi (WF)": ( + ("lutchi.dw.dat",), ( - "Kuo & Luo (TL84)", - ( - ("Kuo.dt.dat",), - ( - 1, - 41, - "D65", - "TL84", - np.tile(1000, [1, 2]), - np.tile(20, [1, 2]), - "S", - "Refl.", - "Magnitude", - ), - ), + 1, + 41, + "D65", + "WF", + np.tile(1000, [1, 2]), + np.tile(20, [1, 2]), + "S", + "Refl.", + "Magnitude", ), + ), + "Kuo & Luo (A)": ( + ("Kuo.da.dat",), ( - "Breneman-C", - ( - ( - "Brene.p1.dat", - "Brene.p2.dat", - "Brene.p3.dat", - "Brene.p4.dat", - "Brene.p6.dat", - "Brene.p8.dat", - "Brene.p9.dat", - "Brene.p11.dat", - "Brene.p12.dat", - ), - ( - 9, - 107, - "D65, 55", - "A, P, G", - np.reshape( - np.repeat( - [ - 1500, - 1500, - 75, - 75, - 11100, - 350, - 15, - 1560, - 75, - ], - 2, - -1, - ), - (-1, 2), - ), - np.tile(30, [9, 2]), - "S", - "Trans.", - "Magnitude", - ), - ), + 1, + 40, + "D65", + "A", + np.tile(1000, [1, 2]), + np.tile(20, [1, 2]), + "L", + "Refl.", + "Magnitude", ), + ), + "Kuo & Luo (TL84)": ( + ("Kuo.dt.dat",), ( - "Breneman-L", - ( - ( - "Brene.p5.dat", - "Brene.p7.dat", - "Brene.p10.dat", - ), - ( - 3, - 36, - "D55", - "D55", - np.array([[130, 2120], [850, 11100], [15, 270]]), - np.tile(30, [3, 2]), - "S", - "Trans.", - "Haploscopic", - ), - ), + 1, + 41, + "D65", + "TL84", + np.tile(1000, [1, 2]), + np.tile(20, [1, 2]), + "S", + "Refl.", + "Magnitude", ), + ), + "Breneman-C": ( ( - "Braun & Fairchild", - ( - ( - "RIT.1.dat", - "RIT.2.dat", - "RIT.3.dat", - "RIT.4.dat", - ), - ( - 4, - 66, - "D65", - "D30, 65, 95", - np.tile(129, [4, 2]), - np.tile(20, [4, 2]), - "S", - "Mon., Refl.", - "Matching", - ), - ), + "Brene.p1.dat", + "Brene.p2.dat", + "Brene.p3.dat", + "Brene.p4.dat", + "Brene.p6.dat", + "Brene.p8.dat", + "Brene.p9.dat", + "Brene.p11.dat", + "Brene.p12.dat", ), ( - "McCann", - ( - ( - "mcan.b.dat", - "mcan.g.dat", - "mcan.grey.dat", - "mcan.r.dat", - "mcan.y.dat", - ), - ( - 5, - 85, - "D65", - "R, Y, G, B", - np.tile((14 + 40) / 2, [5, 2]), - np.tile(30, [5, 2]), - "S", - "Refl.", - "Haploscopic", + 9, + 107, + "D65, 55", + "A, P, G", + np.reshape( + np.repeat( + [ + 1500, + 1500, + 75, + 75, + 11100, + 350, + 15, + 1560, + 75, + ], + 2, + -1, ), + (-1, 2), ), + np.tile(30, [9, 2]), + "S", + "Trans.", + "Magnitude", ), - ] - ) + ), + "Breneman-L": ( + ( + "Brene.p5.dat", + "Brene.p7.dat", + "Brene.p10.dat", + ), + ( + 3, + 36, + "D55", + "D55", + np.array([[130, 2120], [850, 11100], [15, 270]]), + np.tile(30, [3, 2]), + "S", + "Trans.", + "Haploscopic", + ), + ), + "Braun & Fairchild": ( + ( + "RIT.1.dat", + "RIT.2.dat", + "RIT.3.dat", + "RIT.4.dat", + ), + ( + 4, + 66, + "D65", + "D30, 65, 95", + np.tile(129, [4, 2]), + np.tile(20, [4, 2]), + "S", + "Mon., Refl.", + "Matching", + ), + ), + "McCann": ( + ( + "mcan.b.dat", + "mcan.g.dat", + "mcan.grey.dat", + "mcan.r.dat", + "mcan.y.dat", + ), + ( + 5, + 85, + "D65", + "R, Y, G, B", + np.tile((14 + 40) / 2, [5, 2]), + np.tile(30, [5, 2]), + "S", + "Refl.", + "Haploscopic", + ), + ), + } - self._content = dict() + self._content = {} for key, ( filenames, metadata, @@ -549,7 +501,7 @@ def load(self) -> Dict[str, CorrespondingColourDataset_Luo1999]: return self._content -_DATASET_LOADER_LUO1999: Optional[DatasetLoader_Luo1999] = None +_DATASET_LOADER_LUO1999: DatasetLoader_Luo1999 | None = None """ Singleton instance of the *Luo and Rhodes (1999)* *Corresponding-Colour Datasets* dataset loader. diff --git a/colour_datasets/loaders/winquist2022.py b/colour_datasets/loaders/winquist2022.py index aa8a462..6c3f836 100644 --- a/colour_datasets/loaders/winquist2022.py +++ b/colour_datasets/loaders/winquist2022.py @@ -21,7 +21,7 @@ import glob import os -from colour.hints import Dict, Optional +from colour.hints import Dict from colour_datasets.loaders import AbstractDatasetLoader from colour_datasets.loaders.dyer2017 import MultiSpectralDistributions_AMPAS @@ -88,7 +88,7 @@ def load(self) -> Dict[str, MultiSpectralDistributions_AMPAS]: super().sync() - self._content = dict() + self._content = {} glob_pattern = os.path.join( self.record.repository, "dataset", "*.json" @@ -100,7 +100,7 @@ def load(self) -> Dict[str, MultiSpectralDistributions_AMPAS]: return self._content -_DATASET_LOADER_WINQUIST2022: Optional[DatasetLoader_Winquist2022] = None +_DATASET_LOADER_WINQUIST2022: DatasetLoader_Winquist2022 | None = None """ Singleton instance of the *Winquist et al. (2022)* *Physlight - Camera Spectral Sensitivity Curves* dataset loader. diff --git a/colour_datasets/loaders/xrite2016.py b/colour_datasets/loaders/xrite2016.py index d2995ff..38c2045 100644 --- a/colour_datasets/loaders/xrite2016.py +++ b/colour_datasets/loaders/xrite2016.py @@ -24,7 +24,7 @@ from colour import CCS_ILLUMINANTS, Lab_to_XYZ, XYZ_to_xyY from colour.characterisation import ColourChecker -from colour.hints import Dict, Optional +from colour.hints import Dict from colour_datasets.loaders import AbstractDatasetLoader from colour_datasets.records import datasets @@ -112,7 +112,7 @@ def load(self) -> Dict[str, ColourChecker]: "ICC D50" ] - self._content = dict() + self._content = {} for key, filename in zip(keys, filenames): directory = os.path.splitext(filename)[0] path = os.path.join( @@ -157,7 +157,7 @@ def load(self) -> Dict[str, ColourChecker]: return self._content -_DATASET_LOADER_XRITE2016: Optional[DatasetLoader_XRite2016] = None +_DATASET_LOADER_XRITE2016: DatasetLoader_XRite2016 | None = None """ Singleton instance of the *X-Rite (2016)* *New Color Specifications for ColorChecker SG and Classic Charts* dataset diff --git a/colour_datasets/loaders/zhao2009.py b/colour_datasets/loaders/zhao2009.py index c22713b..14b6e07 100644 --- a/colour_datasets/loaders/zhao2009.py +++ b/colour_datasets/loaders/zhao2009.py @@ -21,7 +21,7 @@ import os from colour.characterisation import RGB_CameraSensitivities -from colour.hints import Dict, Optional +from colour.hints import Dict from colour_datasets.loaders import AbstractDatasetLoader from colour_datasets.records import datasets @@ -103,7 +103,7 @@ def load(self) -> Dict[str, RGB_CameraSensitivities]: "KODAK DCS 200", ] - self._content = dict() + self._content = {} for i, camera in enumerate(cameras): data = np.loadtxt( @@ -118,7 +118,7 @@ def load(self) -> Dict[str, RGB_CameraSensitivities]: return self._content -_DATASET_LOADER_JIANG2009: Optional[DatasetLoader_Zhao2009] = None +_DATASET_LOADER_JIANG2009: DatasetLoader_Zhao2009 | None = None """ Singleton instance of the *Zhao et al. (2009)* *Spectral Sensitivity Database* dataset loader. diff --git a/colour_datasets/records/__init__.py b/colour_datasets/records/__init__.py index 554bb05..0e53eb2 100644 --- a/colour_datasets/records/__init__.py +++ b/colour_datasets/records/__init__.py @@ -1,6 +1,5 @@ from __future__ import annotations -from colour.hints import Optional from .configuration import Configuration, sandbox, use_sandbox from .zenodo import Community, Record @@ -15,7 +14,7 @@ "Record", ] -_COMMUNITY: Optional[Community] = None +_COMMUNITY: Community | None = None """ Singleton instance of the *Zenodo* community that holds the datasets information. diff --git a/colour_datasets/records/configuration.py b/colour_datasets/records/configuration.py index 821a347..38c8389 100644 --- a/colour_datasets/records/configuration.py +++ b/colour_datasets/records/configuration.py @@ -10,7 +10,7 @@ import functools import os -from colour.hints import Any, Callable, Dict, Optional +from colour.hints import Any, Callable, Dict from colour.utilities import Structure from colour.utilities.documentation import ( DocstringDict, @@ -65,7 +65,7 @@ class Configuration(Structure): Configuration to use instead of the default one. """ - def __init__(self, configuration: Optional[Dict] = None) -> None: + def __init__(self, configuration: Dict | None = None) -> None: super().__init__( DEFAULT_CONFIGURATION if configuration is None else configuration ) @@ -89,7 +89,7 @@ def use_sandbox( *Zenodo* community. """ - global DEFAULT_CONFIGURATION + global DEFAULT_CONFIGURATION # noqa: PLW0602 if state: DEFAULT_CONFIGURATION["api_url"] = api_url diff --git a/colour_datasets/records/tests/test_zenodo.py b/colour_datasets/records/tests/test_zenodo.py index 0ae91e0..02ca604 100644 --- a/colour_datasets/records/tests/test_zenodo.py +++ b/colour_datasets/records/tests/test_zenodo.py @@ -167,7 +167,7 @@ def test__repr__(self): """Test :func:`colour_datasets.records.zenodo.Record.__repr__` method.""" self.assertIsInstance( - eval( + eval( # noqa: PGH001 repr(self._record), {}, {"Record": Record, "Configuration": Configuration}, @@ -335,7 +335,7 @@ def test__repr__(self): """Test :func:`colour_datasets.records.zenodo.Community.__repr__` method.""" self.assertIsInstance( - eval( + eval( # noqa: PGH001 repr(self._community), {}, {"Community": Community, "Configuration": Configuration}, diff --git a/colour_datasets/records/zenodo.py b/colour_datasets/records/zenodo.py index c867360..4028442 100644 --- a/colour_datasets/records/zenodo.py +++ b/colour_datasets/records/zenodo.py @@ -30,8 +30,6 @@ Dict, Generator, List, - Optional, - Union, ) from colour.utilities import optional, warning @@ -93,9 +91,8 @@ class Record: """ def __init__( - self, data: dict, configuration: Optional[Configuration] = None + self, data: dict, configuration: Configuration | None = None ) -> None: - self._data: dict = data self._configuration: Configuration = optional( configuration, Configuration() @@ -141,7 +138,7 @@ def repository(self) -> str: return os.path.join(self._configuration.repository, self.id) @property - def id(self) -> str: + def id(self) -> str: # noqa: A003 """ Getter property for the *Zenodo* record id. @@ -277,7 +274,7 @@ def __repr__(self) -> str: @staticmethod def from_id( id_: str, - configuration: Optional[Configuration] = None, + configuration: Configuration | None = None, retries: int = 3, ) -> Record: """ @@ -382,7 +379,7 @@ def pull(self, use_urls_txt_file: bool = True, retries: int = 3): True """ - print(f'Pulling "{self.title}" record content...') + print(f'Pulling "{self.title}" record content...') # noqa: T201 if not os.path.exists(self._configuration.repository): os.makedirs(self._configuration.repository) @@ -407,9 +404,9 @@ def urls_download(urls: Dict): for url, md5 in urls.items(): filename = os.path.join( downloads_directory, - urllib.parse.unquote( + urllib.parse.unquote( # pyright: ignore url.split("/")[-1] - ), # pyright: ignore + ), ) url_download(url, filename, md5.split(":")[-1], retries) @@ -438,7 +435,7 @@ def urls_download(urls: Dict): urls_download(urls) else: - raise ValueError( + raise ValueError( # noqa: TRY301 f'"{self._configuration.urls_txt_file}" file was not ' f"found in record data!" ) @@ -482,7 +479,7 @@ def urls_download(urls: Dict): basename = basename.replace(".", "_") unpacking_directory = os.path.join(deflate_directory, basename) - print(f'Unpacking "{filename}" archive...') + print(f'Unpacking "{filename}" archive...') # noqa: T201 setuptools.archive_util.unpack_archive( filename, unpacking_directory ) @@ -566,7 +563,7 @@ class Community(Mapping): """ def __init__( - self, data: Dict, configuration: Optional[Configuration] = None + self, data: Dict, configuration: Configuration | None = None ) -> None: self._data: Dict = data self._configuration: Configuration = optional( @@ -721,7 +718,7 @@ def __repr__(self) -> str: return f"{self.__class__.__name__}(\n{data},\n{configuration}\n)" - def __getitem__(self, item: Union[str, Any]) -> Any: + def __getitem__(self, item: str | Any) -> Any: """ Return the *Zenodo* record at given id. @@ -787,7 +784,7 @@ def __len__(self) -> int: @staticmethod def from_id( id_: str, - configuration: Optional[Configuration] = None, + configuration: Configuration | None = None, retries: int = 3, ) -> Community: """ @@ -855,7 +852,7 @@ def from_id( }.items(): with open(key, "w") as json_file: json.dump(value, json_file, indent=4, sort_keys=True) - except (urllib.error.URLError, ValueError): + except (urllib.error.URLError, ValueError) as error: warning( 'Retrieving the "{0}" community data failed ' "after {1} attempts, " @@ -867,7 +864,9 @@ def from_id( os.path.exists(records_json_filename), ] ): - raise RuntimeError("Local files were not found, aborting!") + raise RuntimeError( + "Local files were not found, aborting!" + ) from error with open(community_json_filename) as json_file: community_data = json.loads(json_file.read()) @@ -962,7 +961,9 @@ def remove(self): shutil.rmtree(self.repository, onerror=_remove_readonly) -def _remove_readonly(function: Callable, path: str, excinfo: Any): +def _remove_readonly( + function: Callable, path: str, excinfo: Any # noqa: ARG001 +): """ Error handler for :func:`shutil.rmtree` definition that removes read-only files. diff --git a/colour_datasets/utilities/common.py b/colour_datasets/utilities/common.py index 2e0bcde..6e172c1 100644 --- a/colour_datasets/utilities/common.py +++ b/colour_datasets/utilities/common.py @@ -20,7 +20,7 @@ from tqdm import tqdm from cachetools import cached, TTLCache -from colour.hints import Any, Callable, Dict, Optional +from colour.hints import Any, Callable, Dict __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" @@ -46,7 +46,7 @@ def __enter__(self) -> suppress_stdout: """Redirect the standard output upon entering the context manager.""" self._stdout = sys.stdout - sys.stdout = open(os.devnull, "w") + sys.stdout = open(os.devnull, "w") # noqa: SIM115 return self @@ -74,7 +74,7 @@ def update_to( self, chunks_count: int = 1, chunk_size: int = 1, - total_size: Optional[int] = None, + total_size: int | None = None, ): """ Report the progress of an action. @@ -112,7 +112,7 @@ def hash_md5(filename: str, chunk_size: int = 2**16) -> str: *MD5* hash of given file. """ - md5 = hashlib.md5() + md5 = hashlib.md5() # noqa: S324 with open(filename, "rb") as file_object: while True: @@ -126,7 +126,7 @@ def hash_md5(filename: str, chunk_size: int = 2**16) -> str: def url_download( - url: str, filename: str, md5: Optional[str] = None, retries: int = 3 + url: str, filename: str, md5: str | None = None, retries: int = 3 ): """ Download given url and saves its content at given file. @@ -168,22 +168,21 @@ def url_download( data=None, ) - if md5 is not None: - if md5.lower() != hash_md5(filename): - raise ValueError( - f'"MD5" hash of "{filename}" file does not match the ' - f"expected hash!" - ) + if md5 is not None and md5.lower() != hash_md5(filename): + raise ValueError( # noqa: TRY301 + f'"MD5" hash of "{filename}" file does not match the ' + f"expected hash!" + ) attempt = retries - except (urllib.error.URLError, OSError, ValueError) as error: + except (urllib.error.URLError, OSError, ValueError): attempt += 1 - print( + print( # noqa: T201 f'An error occurred while downloading "{filename}" file ' f"during attempt {attempt}, retrying..." ) if attempt == retries: - raise error + raise @cached(cache=TTLCache(maxsize=256, ttl=300)) @@ -226,20 +225,20 @@ def json_open(url: str, retries: int = 3) -> Dict: while attempt != retries: try: return json.loads(urllib.request.urlopen(url).read()) - except (urllib.error.URLError, ValueError) as error: + except (urllib.error.URLError, ValueError): attempt += 1 - print( + print( # noqa: T201 f'An error occurred while opening "{url}" url during attempt ' f"{attempt}, retrying..." ) if attempt == retries: - raise error + raise return data def unpack_gzipfile( - filename: str, extraction_directory: str, *args: Any + filename: str, extraction_directory: str, *args: Any # noqa: ARG001 ) -> bool: """ Unpack given *GZIP* file to given extraction directory. @@ -279,11 +278,11 @@ def unpack_gzipfile( extraction_path, "wb" ) as output_file: shutil.copyfileobj(gzip_file, output_file) - except Exception as e: - print(e) + except Exception as error: + print(error) # noqa: T201 raise setuptools.archive_util.UnrecognizedFormat( f'{filename} is not a "GZIP" file!' - ) + ) from error return True diff --git a/colour_datasets/utilities/spreadsheet.py b/colour_datasets/utilities/spreadsheet.py index e5dda64..7a24dd2 100644 --- a/colour_datasets/utilities/spreadsheet.py +++ b/colour_datasets/utilities/spreadsheet.py @@ -15,8 +15,8 @@ import re import xlrd -from colour.hints import Dict, List, Union -from colour.utilities import CanonicalMapping +from colour.hints import Dict, List +from colour.utilities import CanonicalMapping, attest __author__ = "Colour Developers, Openpyxl Developers" __copyright__ = "Copyright 2019 Colour Developers" @@ -67,9 +67,10 @@ def _column_number_to_letters(number: int) -> str: 'DX' """ - assert ( - 1 <= number <= 18278 - ), f"Column number {number} must be in range [1, 18278]!" + attest( + 1 <= number <= 18278, + f"Column number {number} must be in range [1, 18278]!", + ) letters = [] while number > 0: @@ -94,7 +95,7 @@ def _column_number_to_letters(number: int) -> str: _LETTERS_TO_NUMBER_CACHE[letter] = i -def row_to_index(row: Union[int, str]) -> int: +def row_to_index(row: int | str) -> int: """ Return the 0-based index of given row name. @@ -116,7 +117,7 @@ def row_to_index(row: Union[int, str]) -> int: row = int(row) - assert row > 0, "Row must be greater than 0!" + attest(row > 0, "Row must be greater than 0!") return row - 1 diff --git a/docs/conf.py b/docs/conf.py index 9e2d6fd..f3d9133 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -68,7 +68,7 @@ master_doc = "index" project = package.__application_name__ -copyright = package.__copyright__.replace("Copyright (C)", "") +copyright = package.__copyright__.replace("Copyright (C)", "") # noqa: A001 version = f"{package.__major_version__}.{package.__minor_version__}" release = package.__version__ @@ -179,7 +179,9 @@ epub_exclude_files = ["search.html"] -def autodoc_process_docstring(app, what, name, obj, options, lines): +def autodoc_process_docstring( + app, what, name, obj, options, lines # noqa: ARG001 +): """Process the docstrings to remove the *# noqa* *flake8* pragma.""" for i, line in enumerate(lines): diff --git a/pyproject.toml b/pyproject.toml index 525de88..16b2c96 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,18 +59,16 @@ black = { version = "*", optional = true } # Development dependency. blackdoc = { version = "*", optional = true } # Development dependency. coverage = { version = "!= 6.3", optional = true } # Development dependency. coveralls = { version = "*", optional = true } # Development dependency. -flake8 = { version = "*", optional = true } # Development dependency. flynt = { version = "*", optional = true } # Development dependency. invoke = { version = "*", optional = true } # Development dependency. pre-commit = { version = "*", optional = true } # Development dependency. pydata-sphinx-theme = { version = "*", optional = true } # Development dependency. -pydocstyle = { version = "*", optional = true } # Development dependency. pyright = { version = "*", optional = true } # Development dependency. pytest = { version = "*", optional = true } # Development dependency. pytest-cov = { version = "*", optional = true } # Development dependency. pytest-xdist = { version = "*", optional = true} #Development dependency -pyupgrade = { version = "*", optional = true } # Development dependency. restructuredtext-lint = { version = "*", optional = true } # Development dependency. +ruff = { version = "*", optional = true } # Development dependency. sphinx = { version = ">= 4, < 5", optional = true } # Development dependency. sphinxcontrib-bibtex = { version = "*", optional = true } # Development dependency. toml = { version = "*", optional = true } # Development dependency. @@ -82,18 +80,16 @@ black = "*" blackdoc = "*" coverage = "!= 6.3" coveralls = "*" -flake8 = "*" flynt = "*" invoke = "*" pre-commit = "*" pytest = "*" pydata-sphinx-theme = "*" -pydocstyle = "*" pyright = "*" pytest-cov = "*" pytest-xdist = "*" -pyupgrade = "*" restructuredtext-lint = "*" +ruff = "*" sphinx = ">= 4, < 5" sphinxcontrib-bibtex = "*" toml = "*" @@ -106,18 +102,16 @@ development = [ "blackdoc", "coverage", "coveralls", - "flake8", "flynt", "invoke", "pre-commit", "pydata-sphinx-theme", - "pydocstyle", "pyright", "pytest", "pytest-cov", "pytest-xdist", - "pyupgrade", "restructuredtext-lint", + "ruff", "sphinx", "sphinxcontrib-bibtex", "toml", @@ -138,10 +132,6 @@ exclude = ''' [tool.flynt] line_length=999 -[tool.pydocstyle] -convention = "numpy" -add-ignore = "D104,D200,D202,D205,D301,D400" - [tool.pyright] reportMissingImports = false reportMissingModuleSource = false @@ -154,6 +144,96 @@ reportUnusedExpression = false [tool.pytest.ini_options] addopts = "--durations=5" + +[tool.ruff] +target-version = "py39" +line-length = 88 +select = [ + "A", # flake8-builtins + "ARG", # flake8-unused-arguments + # "ANN", # flake8-annotations + "B", # flake8-bugbear + # "BLE", # flake8-blind-except + "C4", # flake8-comprehensions + # "C90", # mccabe + # "COM", # flake8-commas + "DTZ", # flake8-datetimez + "D", # pydocstyle + "E", # pydocstyle + # "ERA", # eradicate + # "EM", # flake8-errmsg + "EXE", # flake8-executable + "F", # flake8 + # "FBT", # flake8-boolean-trap + "G", # flake8-logging-format + "I", # isort + "ICN", # flake8-import-conventions + "INP", # flake8-no-pep420 + "ISC", # flake8-implicit-str-concat + "N", # pep8-naming + # "PD", # pandas-vet + "PIE", # flake8-pie + "PGH", # pygrep-hooks + "PL", # pylint + # "PT", # flake8-pytest-style + # "PTH", # flake8-use-pathlib [Enable] + "Q", # flake8-quotes + "RET", # flake8-return + "RUF", # Ruff + "S", # flake8-bandit + "SIM", # flake8-simplify + "T10", # flake8-debugger + "T20", # flake8-print + # "TCH", # flake8-type-checking + "TID", # flake8-tidy-imports + "TRY", # tryceratops + "UP", # pyupgrade + "W", # pydocstyle + "YTT" # flake8-2020 +] +ignore = [ + "B008", + "B905", + "D104", + "D200", + "D202", + "D205", + "D301", + "D400", + "I001", + "N801", + "N802", + "N803", + "N806", + "N813", + "N815", + "N816", + "PIE804", + "PLE0605", + "PLR0913", + "PLR2004", + "RET504", + "RET505", + "RET506", + "RET507", + "RET508", + "TRY003", + "TRY300", +] +typing-modules = ["colour.hints"] +fixable = ["B", "C", "E", "F", "PIE", "RUF", "SIM", "UP", "W"] + +[tool.ruff.pydocstyle] +convention = "numpy" + +[tool.ruff.per-file-ignores] +"colour_datasets/examples/*" = ["INP", "T201", "T203"] +"docs/*" = ["INP"] +"setup.py" = ["INP"] +"tasks.py" = ["INP"] +"utilities/*" = ["EXE001", "INP"] +"utilities/unicode_to_ascii.py" = ["RUF001"] + [build-system] requires = [ "poetry_core>=1.0.0" ] build-backend = "poetry.core.masonry.api" diff --git a/requirements.txt b/requirements.txt index dcad26f..09afd51 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,88 +1,83 @@ -alabaster==0.7.12 +alabaster==0.7.13 astor==0.8.1 -attrs==22.1.0 +attrs==22.2.0 Babel==2.11.0 -beautifulsoup4==4.11.1 +beautifulsoup4==4.11.2 biblib-simple==0.1.2 -black==22.12.0 +black==23.1.0 blackdoc==0.3.8 -bleach==5.0.1 -cachetools==5.2.0 +bleach==6.0.0 +cachetools==5.3.0 certifi==2022.12.7 cfgv==3.3.1 -charset-normalizer==2.1.1 +charset-normalizer==3.0.1 click==8.1.3 colour-science==0.4.2 -commonmark==0.9.1 coverage==6.5.0 coveralls==3.3.1 distlib==0.3.6 docopt==0.6.2 docutils==0.17.1 execnet==1.9.0 -filelock==3.8.2 -flake8==6.0.0 +filelock==3.9.0 flynt==0.77 -identify==2.5.9 +identify==2.5.17 idna==3.4 -imageio==2.22.4 +imageio==2.25.0 imagesize==1.4.1 -importlib-metadata==5.1.0 -iniconfig==1.1.1 -invoke==1.7.3 +importlib-metadata==6.0.0 +iniconfig==2.0.0 +invoke==2.0.0 jaraco.classes==3.2.3 Jinja2==3.1.2 -keyring==23.11.0 +keyring==23.13.1 latexcodec==2.0.1 -MarkupSafe==2.1.1 -mccabe==0.7.0 +markdown-it-py==2.1.0 +MarkupSafe==2.1.2 +mdurl==0.1.2 more-itertools==9.0.0 mypy-extensions==0.4.3 nodeenv==1.7.0 -numpy==1.23.5 -opencv-python==4.6.0.66 -packaging==22.0 -pathspec==0.10.3 -Pillow==9.3.0 +numpy==1.24.1 +opencv-python==4.7.0.68 +packaging==23.0 +pathspec==0.11.0 +Pillow==9.4.0 pip==22.3.1 -pkginfo==1.9.2 -platformdirs==2.6.0 +pkginfo==1.9.6 +platformdirs==2.6.2 pluggy==1.0.0 -pre-commit==2.20.0 +pre-commit==3.0.3 pybtex==0.24.0 pybtex-docutils==1.0.2 -pycodestyle==2.10.0 pydata-sphinx-theme==0.12.0 -pydocstyle==6.1.1 -pyflakes==3.0.1 -Pygments==2.13.0 -pyright==1.1.283 -pytest==7.2.0 +Pygments==2.14.0 +pyright==1.1.292 +pytest==7.2.1 pytest-cov==4.0.0 pytest-xdist==3.1.0 -pytz==2022.6 -pyupgrade==3.3.1 +pytz==2022.7.1 PyYAML==6.0 readme-renderer==37.3 -requests==2.28.1 +requests==2.28.2 requests-toolbelt==0.10.1 restructuredtext-lint==1.4.0 rfc3986==2.0.0 -rich==12.6.0 -scipy==1.9.3 -setuptools==65.6.3 +rich==13.3.1 +ruff==0.0.240 +scipy==1.10.0 +setuptools==67.1.0 six==1.16.0 snowballstemmer==2.2.0 soupsieve==2.3.2.post1 Sphinx==4.5.0 -sphinxcontrib-applehelp==1.0.2 +sphinxcontrib-applehelp==1.0.4 sphinxcontrib-bibtex==2.5.0 sphinxcontrib-devhelp==1.0.2 -sphinxcontrib-htmlhelp==2.0.0 +sphinxcontrib-htmlhelp==2.0.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -tokenize-rt==5.0.0 toml==0.10.2 tomli==2.0.1 tqdm==4.64.1 @@ -90,9 +85,9 @@ twine==4.0.2 types-cachetools==5.2.1 types-setuptools==65.6.0.1 typing_extensions==4.4.0 -urllib3==1.26.13 +urllib3==1.26.14 virtualenv==20.17.1 webencodings==0.5.1 wheel==0.38.4 xlrd==1.2.0 -zipp==3.11.0 +zipp==3.12.0 diff --git a/tasks.py b/tasks.py index 6a523f7..17940bd 100644 --- a/tasks.py +++ b/tasks.py @@ -6,6 +6,7 @@ from __future__ import annotations import biblib.bib +import contextlib import fnmatch import os import re @@ -138,10 +139,8 @@ def formatting( ) for entry in sorted(entries.values(), key=lambda x: x.key): - try: + with contextlib.suppress(KeyError): del entry["file"] - except KeyError: - pass for key, value in entry.items(): entry[key] = re.sub("(?`__ | This software is released under terms of New BSD License: \ https://opensource.org/licenses/BSD-3-Clause @@ -108,9 +108,9 @@ def export_todo_items(todo_items: dict, file_path: str): """ todo_rst = [] - for module, todo_items in todo_items.items(): + for module, module_todo_items in todo_items.items(): todo_rst.append(f"- {module}\n") - for line_numer, todo_item in todo_items: + for line_numer, todo_item in module_todo_items: todo_rst.append(f" - Line {line_numer} : {todo_item}") todo_rst.append("\n") From 56fd2f76cf6537a718169e4bb8bdc6da0d8ca45e Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Fri, 3 Feb 2023 22:11:07 +1300 Subject: [PATCH 06/26] Update "pyproject.toml" file. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 16b2c96..434c43f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ pydata-sphinx-theme = { version = "*", optional = true } # Development dependen pyright = { version = "*", optional = true } # Development dependency. pytest = { version = "*", optional = true } # Development dependency. pytest-cov = { version = "*", optional = true } # Development dependency. -pytest-xdist = { version = "*", optional = true} #Development dependency +pytest-xdist = { version = "*", optional = true} # Development dependency restructuredtext-lint = { version = "*", optional = true } # Development dependency. ruff = { version = "*", optional = true } # Development dependency. sphinx = { version = ">= 4, < 5", optional = true } # Development dependency. From 4193646b367d115d7e264ff9702f90d6d1b46989 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Sun, 12 Feb 2023 08:08:21 +1300 Subject: [PATCH 07/26] Update various docstrings. --- docs/conf.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index f3d9133..81a0fa3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -177,21 +177,3 @@ epub_publisher = package.__author__ epub_copyright = package.__copyright__.replace("Copyright (C)", "") epub_exclude_files = ["search.html"] - - -def autodoc_process_docstring( - app, what, name, obj, options, lines # noqa: ARG001 -): - """Process the docstrings to remove the *# noqa* *flake8* pragma.""" - - for i, line in enumerate(lines): - lines[i] = line.replace("# noqa", "") - - -def setup(app): - """ - Prepare the extension and linking resources that Sphinx uses in the - build process. - """ - - app.connect("autodoc-process-docstring", autodoc_process_docstring) From dd6be7a3a5deebd93863748adb8d2a3c38fd12c4 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Thu, 23 Feb 2023 21:08:45 +1300 Subject: [PATCH 08/26] Re-enable warnings in unit-tests. --- .github/workflows/continuous-integration-quality-unit-tests.yml | 2 +- tasks.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/continuous-integration-quality-unit-tests.yml b/.github/workflows/continuous-integration-quality-unit-tests.yml index f7e514a..7e59ddd 100644 --- a/.github/workflows/continuous-integration-quality-unit-tests.yml +++ b/.github/workflows/continuous-integration-quality-unit-tests.yml @@ -48,7 +48,7 @@ jobs: shell: bash - name: Test with Pytest run: | - poetry run python -W ignore -m pytest --disable-warnings --doctest-modules --ignore=$CI_PACKAGE/examples --cov=$CI_PACKAGE $CI_PACKAGE + poetry run python -W ignore -m pytest --doctest-modules --ignore=$CI_PACKAGE/examples --cov=$CI_PACKAGE $CI_PACKAGE shell: bash - name: Upload Coverage to coveralls.io run: | diff --git a/tasks.py b/tasks.py index 17940bd..cc9ce52 100644 --- a/tasks.py +++ b/tasks.py @@ -209,7 +209,6 @@ def tests(ctx: Context): message_box('Running "Pytest"...') ctx.run( "pytest " - "--disable-warnings " "--doctest-modules " f"--ignore={PYTHON_PACKAGE_NAME}/examples " f"{PYTHON_PACKAGE_NAME}" @@ -411,7 +410,6 @@ def virtualise(ctx: Context, tests: bool = True): if tests: ctx.run( "poetry run pytest " - "--disable-warnings " "--doctest-modules " f"--ignore={PYTHON_PACKAGE_NAME}/examples " f"{PYTHON_PACKAGE_NAME}", From f23a35dff766fea8ad1d8c74003dd38efd8fe6d6 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Thu, 23 Feb 2023 21:12:42 +1300 Subject: [PATCH 09/26] Update minimum version of "Numpy" to 1.21. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 434c43f..84d0d77 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,7 @@ python = ">= 3.9, < 3.12" cachetools = "*" colour-science = ">= 0.4.2" imageio = ">= 2, < 3" -numpy = ">= 1.20, < 2" +numpy = ">= 1.21, < 2" opencv-python = ">= 4, < 5" scipy = ">= 1.7, < 2" tqdm = "*" From 4c5b0356b085b8e49d3b65e2450be638352dadf4 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Thu, 9 Mar 2023 22:26:25 +1300 Subject: [PATCH 10/26] Ensure that coverage data is properly captured with distributed unit tests. --- .coveragerc | 1 + tasks.py | 1 + 2 files changed, 2 insertions(+) diff --git a/.coveragerc b/.coveragerc index 366a5ea..171cfe5 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,5 +1,6 @@ [run] source = colour_datasets +sigterm = True [report] exclude_lines = pragma: no cover diff --git a/tasks.py b/tasks.py index cc9ce52..998f798 100644 --- a/tasks.py +++ b/tasks.py @@ -211,6 +211,7 @@ def tests(ctx: Context): "pytest " "--doctest-modules " f"--ignore={PYTHON_PACKAGE_NAME}/examples " + f"--cov={PYTHON_PACKAGE_NAME} " f"{PYTHON_PACKAGE_NAME}" ) From be289bd2730af54596cf50784a5a264112132fd2 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Fri, 31 Mar 2023 22:14:00 +1300 Subject: [PATCH 11/26] Pin "Poetry" version to 1.4.0. --- .github/workflows/continuous-integration-documentation.yml | 2 ++ .github/workflows/continuous-integration-quality-unit-tests.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/continuous-integration-documentation.yml b/.github/workflows/continuous-integration-documentation.yml index 2165290..d1130ff 100644 --- a/.github/workflows/continuous-integration-documentation.yml +++ b/.github/workflows/continuous-integration-documentation.yml @@ -30,6 +30,8 @@ jobs: sudo apt-get update sudo apt-get --yes install latexmk texlive-full - name: Install Poetry + env: + POETRY_VERSION: 1.4.0 run: | curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 - echo "$HOME/.poetry/bin" >> $GITHUB_PATH diff --git a/.github/workflows/continuous-integration-quality-unit-tests.yml b/.github/workflows/continuous-integration-quality-unit-tests.yml index 7e59ddd..3e20fce 100644 --- a/.github/workflows/continuous-integration-quality-unit-tests.yml +++ b/.github/workflows/continuous-integration-quality-unit-tests.yml @@ -29,6 +29,8 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install Poetry + env: + POETRY_VERSION: 1.4.0 run: | curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 - echo "$HOME/.poetry/bin" >> $GITHUB_PATH From 615c1e1e2b969833047df1eec13aebc83cb43994 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Fri, 4 Aug 2023 22:00:08 +1200 Subject: [PATCH 12/26] Update ".gitignore" file. --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 278475e..8c55073 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ *.pyc *.pyo .DS_Store -.coverage +.coverage* .fleet .idea .ipynb_checkpoints From 4507b23fce137352f6df86720f977b4bf10cdc8a Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Fri, 4 Aug 2023 22:15:08 +1200 Subject: [PATCH 13/26] Remove "# nosec" pragma. --- colour_datasets/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/colour_datasets/__init__.py b/colour_datasets/__init__.py index 9490326..f382b85 100644 --- a/colour_datasets/__init__.py +++ b/colour_datasets/__init__.py @@ -18,7 +18,7 @@ import contextlib import numpy as np import os -import subprocess # nosec +import subprocess import colour @@ -60,7 +60,7 @@ try: _version = ( - subprocess.check_output( # nosec + subprocess.check_output( ["git", "describe"], cwd=os.path.dirname(__file__), stderr=subprocess.STDOUT, From 8f4a6d86e6b8bc7372a04547f8a7af588c53890a Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Fri, 4 Aug 2023 22:15:21 +1200 Subject: [PATCH 14/26] Update "tasks.py" file. --- tasks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks.py b/tasks.py index 998f798..88f506b 100644 --- a/tasks.py +++ b/tasks.py @@ -20,7 +20,8 @@ if not hasattr(inspect, "getargspec"): inspect.getargspec = inspect.getfullargspec # pyright: ignore -from invoke import Context, task +from invoke.tasks import task +from invoke.context import Context __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" From 8448b60f9353012d65973de25032113c0d5af798 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Fri, 4 Aug 2023 22:15:57 +1200 Subject: [PATCH 15/26] Update various utilities. --- utilities/export_todo.py | 2 ++ utilities/unicode_to_ascii.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/utilities/export_todo.py b/utilities/export_todo.py index e4cd76a..f286201 100755 --- a/utilities/export_todo.py +++ b/utilities/export_todo.py @@ -120,6 +120,8 @@ def export_todo_items(todo_items: dict, file_path: str): if __name__ == "__main__": + os.chdir(os.path.dirname(__file__)) + export_todo_items( extract_todo_items(os.path.join("..", "colour_checker_detection")), os.path.join("..", "TODO.rst"), diff --git a/utilities/unicode_to_ascii.py b/utilities/unicode_to_ascii.py index 072163f..c3e5450 100755 --- a/utilities/unicode_to_ascii.py +++ b/utilities/unicode_to_ascii.py @@ -66,4 +66,6 @@ def unicode_to_ascii(root_directory: str): if __name__ == "__main__": + os.chdir(os.path.dirname(__file__)) + unicode_to_ascii(os.path.join("..", "colour_checker_detection")) From 12ce3403d18e806ffeea448e94360690035aa40f Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Fri, 4 Aug 2023 22:17:54 +1200 Subject: [PATCH 16/26] Improve license reference consistency. --- CONTRIBUTORS.rst | 2 +- LICENSE | 30 +++++-------------- README.rst | 4 +-- TODO.rst | 2 +- colour_datasets/__init__.py | 2 +- colour_datasets/loaders/abstract.py | 2 +- colour_datasets/loaders/asano2015.py | 2 +- colour_datasets/loaders/brendel2020.py | 2 +- colour_datasets/loaders/dyer2017.py | 2 +- colour_datasets/loaders/ebner1998.py | 2 +- colour_datasets/loaders/hung1995.py | 2 +- colour_datasets/loaders/jakob2019.py | 2 +- colour_datasets/loaders/jiang2013.py | 2 +- colour_datasets/loaders/karge2015.py | 2 +- colour_datasets/loaders/kuopio.py | 2 +- colour_datasets/loaders/labsphere2019.py | 2 +- colour_datasets/loaders/luo1997.py | 2 +- colour_datasets/loaders/luo1999.py | 2 +- .../loaders/tests/test_abstract.py | 2 +- .../loaders/tests/test_asano2015.py | 2 +- .../loaders/tests/test_brendel2020.py | 2 +- .../loaders/tests/test_dyer2017.py | 2 +- .../loaders/tests/test_ebner1998.py | 2 +- .../loaders/tests/test_hung1995.py | 2 +- .../loaders/tests/test_jakob2019.py | 2 +- .../loaders/tests/test_jiang2013.py | 2 +- .../loaders/tests/test_karge2015.py | 2 +- colour_datasets/loaders/tests/test_kuopio.py | 2 +- .../loaders/tests/test_labsphere2019.py | 2 +- colour_datasets/loaders/tests/test_luo1997.py | 2 +- colour_datasets/loaders/tests/test_luo1999.py | 2 +- .../loaders/tests/test_winquist2022.py | 2 +- .../loaders/tests/test_xrite2016.py | 2 +- .../loaders/tests/test_zhao2009.py | 2 +- colour_datasets/loaders/winquist2022.py | 2 +- colour_datasets/loaders/xrite2016.py | 2 +- colour_datasets/loaders/zhao2009.py | 2 +- colour_datasets/records/configuration.py | 2 +- .../records/tests/test_configuration.py | 2 +- colour_datasets/records/tests/test_zenodo.py | 2 +- colour_datasets/records/zenodo.py | 2 +- colour_datasets/utilities/common.py | 2 +- colour_datasets/utilities/spreadsheet.py | 2 +- .../utilities/tests/test_common.py | 2 +- .../utilities/tests/test_spreadsheet.py | 2 +- docs/index.rst | 4 +-- tasks.py | 2 +- utilities/export_todo.py | 4 +-- utilities/unicode_to_ascii.py | 2 +- 49 files changed, 58 insertions(+), 74 deletions(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index e7c90b9..33a5b49 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -13,5 +13,5 @@ About | **Colour - Datasets** by Colour Developers | Copyright 2019 Colour Developers – `colour-developers@colour-science.org `__ -| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause +| This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause | `https://github.com/colour-science/colour-datasets `__ diff --git a/LICENSE b/LICENSE index b03bcb9..49605b2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,27 +1,11 @@ Copyright 2019 Colour Developers -All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the Colour Developers nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL COLOUR DEVELOPERS BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -Copyright for portions of project openpyxl are held by Openpyxl Developers, -2010 as part of project openpyxl distributed under the MIT Licence. +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE diff --git a/README.rst b/README.rst index 30e0b24..d01b602 100644 --- a/README.rst +++ b/README.rst @@ -28,7 +28,7 @@ under the community. It is open source and freely available under the -`New BSD License `__ terms. +`BSD-3-Clause `__ terms. .. contents:: **Table of Contents** :backlinks: none @@ -220,5 +220,5 @@ About | **Colour - Datasets** by Colour Developers | Copyright 2019 Colour Developers – `colour-developers@colour-science.org `__ -| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause +| This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause | `https://github.com/colour-science/colour-datasets `__ diff --git a/TODO.rst b/TODO.rst index 9e502a0..9ff2fa4 100644 --- a/TODO.rst +++ b/TODO.rst @@ -11,5 +11,5 @@ About | **Colour - Datasets** by Colour Developers | Copyright 2019 Colour Developers – `colour-developers@colour-science.org `__ -| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause +| This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause | `https://github.com/colour-science/colour-datasets `__ diff --git a/colour_datasets/__init__.py b/colour_datasets/__init__.py index f382b85..200195b 100644 --- a/colour_datasets/__init__.py +++ b/colour_datasets/__init__.py @@ -29,7 +29,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/abstract.py b/colour_datasets/loaders/abstract.py index 5c14466..61c2215 100644 --- a/colour_datasets/loaders/abstract.py +++ b/colour_datasets/loaders/abstract.py @@ -17,7 +17,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/asano2015.py b/colour_datasets/loaders/asano2015.py index ee5c472..e36859d 100644 --- a/colour_datasets/loaders/asano2015.py +++ b/colour_datasets/loaders/asano2015.py @@ -35,7 +35,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/brendel2020.py b/colour_datasets/loaders/brendel2020.py index 7bea8b2..cb6a6db 100644 --- a/colour_datasets/loaders/brendel2020.py +++ b/colour_datasets/loaders/brendel2020.py @@ -29,7 +29,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/dyer2017.py b/colour_datasets/loaders/dyer2017.py index 24db05f..05866b4 100644 --- a/colour_datasets/loaders/dyer2017.py +++ b/colour_datasets/loaders/dyer2017.py @@ -37,7 +37,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/ebner1998.py b/colour_datasets/loaders/ebner1998.py index 978752c..bb1ef03 100644 --- a/colour_datasets/loaders/ebner1998.py +++ b/colour_datasets/loaders/ebner1998.py @@ -31,7 +31,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/hung1995.py b/colour_datasets/loaders/hung1995.py index fb1b571..f22d0cc 100644 --- a/colour_datasets/loaders/hung1995.py +++ b/colour_datasets/loaders/hung1995.py @@ -30,7 +30,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/jakob2019.py b/colour_datasets/loaders/jakob2019.py index 5cf68c6..3374a3d 100644 --- a/colour_datasets/loaders/jakob2019.py +++ b/colour_datasets/loaders/jakob2019.py @@ -28,7 +28,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/jiang2013.py b/colour_datasets/loaders/jiang2013.py index 5a81afc..cd1a9a8 100644 --- a/colour_datasets/loaders/jiang2013.py +++ b/colour_datasets/loaders/jiang2013.py @@ -33,7 +33,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/karge2015.py b/colour_datasets/loaders/karge2015.py index 1aa7b37..7c8b0e6 100644 --- a/colour_datasets/loaders/karge2015.py +++ b/colour_datasets/loaders/karge2015.py @@ -31,7 +31,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/kuopio.py b/colour_datasets/loaders/kuopio.py index 6b011b3..7553364 100644 --- a/colour_datasets/loaders/kuopio.py +++ b/colour_datasets/loaders/kuopio.py @@ -52,7 +52,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/labsphere2019.py b/colour_datasets/loaders/labsphere2019.py index e25e3aa..2ad66c7 100644 --- a/colour_datasets/loaders/labsphere2019.py +++ b/colour_datasets/loaders/labsphere2019.py @@ -26,7 +26,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/luo1997.py b/colour_datasets/loaders/luo1997.py index 387f14e..e080316 100644 --- a/colour_datasets/loaders/luo1997.py +++ b/colour_datasets/loaders/luo1997.py @@ -43,7 +43,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright (C) 2019 - Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-science@googlegroups.com" __status__ = "Production" diff --git a/colour_datasets/loaders/luo1999.py b/colour_datasets/loaders/luo1999.py index aefefa9..1c816f2 100644 --- a/colour_datasets/loaders/luo1999.py +++ b/colour_datasets/loaders/luo1999.py @@ -38,7 +38,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/tests/test_abstract.py b/colour_datasets/loaders/tests/test_abstract.py index 20a8bcb..ea028b8 100644 --- a/colour_datasets/loaders/tests/test_abstract.py +++ b/colour_datasets/loaders/tests/test_abstract.py @@ -7,7 +7,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/tests/test_asano2015.py b/colour_datasets/loaders/tests/test_asano2015.py index 0c75810..8a4bebc 100644 --- a/colour_datasets/loaders/tests/test_asano2015.py +++ b/colour_datasets/loaders/tests/test_asano2015.py @@ -10,7 +10,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/tests/test_brendel2020.py b/colour_datasets/loaders/tests/test_brendel2020.py index 8f09b6a..aeaeefd 100644 --- a/colour_datasets/loaders/tests/test_brendel2020.py +++ b/colour_datasets/loaders/tests/test_brendel2020.py @@ -14,7 +14,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/tests/test_dyer2017.py b/colour_datasets/loaders/tests/test_dyer2017.py index 2486392..5773cf8 100644 --- a/colour_datasets/loaders/tests/test_dyer2017.py +++ b/colour_datasets/loaders/tests/test_dyer2017.py @@ -8,7 +8,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/tests/test_ebner1998.py b/colour_datasets/loaders/tests/test_ebner1998.py index 2124515..7ddd238 100644 --- a/colour_datasets/loaders/tests/test_ebner1998.py +++ b/colour_datasets/loaders/tests/test_ebner1998.py @@ -8,7 +8,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/tests/test_hung1995.py b/colour_datasets/loaders/tests/test_hung1995.py index f2570e8..7a650cd 100644 --- a/colour_datasets/loaders/tests/test_hung1995.py +++ b/colour_datasets/loaders/tests/test_hung1995.py @@ -8,7 +8,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/tests/test_jakob2019.py b/colour_datasets/loaders/tests/test_jakob2019.py index c2f2218..8719546 100644 --- a/colour_datasets/loaders/tests/test_jakob2019.py +++ b/colour_datasets/loaders/tests/test_jakob2019.py @@ -7,7 +7,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/tests/test_jiang2013.py b/colour_datasets/loaders/tests/test_jiang2013.py index 41bdc09..da0f79c 100644 --- a/colour_datasets/loaders/tests/test_jiang2013.py +++ b/colour_datasets/loaders/tests/test_jiang2013.py @@ -9,7 +9,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/tests/test_karge2015.py b/colour_datasets/loaders/tests/test_karge2015.py index 6a96db9..bb30c94 100644 --- a/colour_datasets/loaders/tests/test_karge2015.py +++ b/colour_datasets/loaders/tests/test_karge2015.py @@ -9,7 +9,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/tests/test_kuopio.py b/colour_datasets/loaders/tests/test_kuopio.py index 1422cf8..2138897 100644 --- a/colour_datasets/loaders/tests/test_kuopio.py +++ b/colour_datasets/loaders/tests/test_kuopio.py @@ -24,7 +24,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/tests/test_labsphere2019.py b/colour_datasets/loaders/tests/test_labsphere2019.py index c57086c..ed6eee6 100644 --- a/colour_datasets/loaders/tests/test_labsphere2019.py +++ b/colour_datasets/loaders/tests/test_labsphere2019.py @@ -14,7 +14,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/tests/test_luo1997.py b/colour_datasets/loaders/tests/test_luo1997.py index c56cc23..4362ff4 100644 --- a/colour_datasets/loaders/tests/test_luo1997.py +++ b/colour_datasets/loaders/tests/test_luo1997.py @@ -8,7 +8,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/tests/test_luo1999.py b/colour_datasets/loaders/tests/test_luo1999.py index 67c92f0..69fd488 100644 --- a/colour_datasets/loaders/tests/test_luo1999.py +++ b/colour_datasets/loaders/tests/test_luo1999.py @@ -8,7 +8,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/tests/test_winquist2022.py b/colour_datasets/loaders/tests/test_winquist2022.py index 38b9fc7..f63a7ce 100644 --- a/colour_datasets/loaders/tests/test_winquist2022.py +++ b/colour_datasets/loaders/tests/test_winquist2022.py @@ -14,7 +14,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/tests/test_xrite2016.py b/colour_datasets/loaders/tests/test_xrite2016.py index 6809a12..b7bebfc 100644 --- a/colour_datasets/loaders/tests/test_xrite2016.py +++ b/colour_datasets/loaders/tests/test_xrite2016.py @@ -9,7 +9,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/tests/test_zhao2009.py b/colour_datasets/loaders/tests/test_zhao2009.py index 09e789c..f90cba6 100644 --- a/colour_datasets/loaders/tests/test_zhao2009.py +++ b/colour_datasets/loaders/tests/test_zhao2009.py @@ -9,7 +9,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/winquist2022.py b/colour_datasets/loaders/winquist2022.py index 6c3f836..9ba94b9 100644 --- a/colour_datasets/loaders/winquist2022.py +++ b/colour_datasets/loaders/winquist2022.py @@ -29,7 +29,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/xrite2016.py b/colour_datasets/loaders/xrite2016.py index 38c2045..7dc70ea 100644 --- a/colour_datasets/loaders/xrite2016.py +++ b/colour_datasets/loaders/xrite2016.py @@ -31,7 +31,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/loaders/zhao2009.py b/colour_datasets/loaders/zhao2009.py index 14b6e07..c890cf7 100644 --- a/colour_datasets/loaders/zhao2009.py +++ b/colour_datasets/loaders/zhao2009.py @@ -28,7 +28,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/records/configuration.py b/colour_datasets/records/configuration.py index 38c8389..74172b2 100644 --- a/colour_datasets/records/configuration.py +++ b/colour_datasets/records/configuration.py @@ -19,7 +19,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/records/tests/test_configuration.py b/colour_datasets/records/tests/test_configuration.py index a5e2185..a1e49d8 100644 --- a/colour_datasets/records/tests/test_configuration.py +++ b/colour_datasets/records/tests/test_configuration.py @@ -9,7 +9,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/records/tests/test_zenodo.py b/colour_datasets/records/tests/test_zenodo.py index 02ca604..61bff51 100644 --- a/colour_datasets/records/tests/test_zenodo.py +++ b/colour_datasets/records/tests/test_zenodo.py @@ -12,7 +12,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/records/zenodo.py b/colour_datasets/records/zenodo.py index 4028442..c268d49 100644 --- a/colour_datasets/records/zenodo.py +++ b/colour_datasets/records/zenodo.py @@ -38,7 +38,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/utilities/common.py b/colour_datasets/utilities/common.py index 6e172c1..a88a1ae 100644 --- a/colour_datasets/utilities/common.py +++ b/colour_datasets/utilities/common.py @@ -24,7 +24,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/utilities/spreadsheet.py b/colour_datasets/utilities/spreadsheet.py index 7a24dd2..fb7bfbc 100644 --- a/colour_datasets/utilities/spreadsheet.py +++ b/colour_datasets/utilities/spreadsheet.py @@ -22,7 +22,7 @@ __copyright__ = "Copyright 2019 Colour Developers" __copyright__ += ", " __copyright__ = "Copyright (C) 2010 openpyxl" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __license__ += ", " __license__ += "MIT Licence - https://opensource.org/licenses/MIT" __maintainer__ = "Colour Developers" diff --git a/colour_datasets/utilities/tests/test_common.py b/colour_datasets/utilities/tests/test_common.py index c950fe2..5c824d1 100644 --- a/colour_datasets/utilities/tests/test_common.py +++ b/colour_datasets/utilities/tests/test_common.py @@ -16,7 +16,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/colour_datasets/utilities/tests/test_spreadsheet.py b/colour_datasets/utilities/tests/test_spreadsheet.py index 292c7d6..a1b7c0a 100644 --- a/colour_datasets/utilities/tests/test_spreadsheet.py +++ b/colour_datasets/utilities/tests/test_spreadsheet.py @@ -17,7 +17,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/docs/index.rst b/docs/index.rst index 4934a2f..9da6c1e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -9,7 +9,7 @@ under the community. It is open source and freely available under the -`New BSD License `__ terms. +`BSD-3-Clause `__ terms. .. sectnum:: @@ -160,5 +160,5 @@ About | **Colour - Datasets** by Colour Developers | Copyright 2019 Colour Developers – `colour-developers@colour-science.org `__ -| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause +| This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause | `https://github.com/colour-science/colour-datasets `__ diff --git a/tasks.py b/tasks.py index 88f506b..c92c11e 100644 --- a/tasks.py +++ b/tasks.py @@ -25,7 +25,7 @@ __author__ = "Colour Developers" __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" diff --git a/utilities/export_todo.py b/utilities/export_todo.py index f286201..181c259 100755 --- a/utilities/export_todo.py +++ b/utilities/export_todo.py @@ -10,7 +10,7 @@ import os __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" @@ -36,7 +36,7 @@ | **Colour - Datasets** by Colour Developers | Copyright 2019 Colour Developers - \ `colour-developers@colour-science.org `__ -| This software is released under terms of New BSD License: \ +| This software is released under terms of BSD-3-Clause: \ https://opensource.org/licenses/BSD-3-Clause | `https://github.com/colour-science/colour-datasets \ `__ diff --git a/utilities/unicode_to_ascii.py b/utilities/unicode_to_ascii.py index c3e5450..7a2050c 100755 --- a/utilities/unicode_to_ascii.py +++ b/utilities/unicode_to_ascii.py @@ -11,7 +11,7 @@ import unicodedata __copyright__ = "Copyright 2019 Colour Developers" -__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" +__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" __maintainer__ = "Colour Developers" __email__ = "colour-developers@colour-science.org" __status__ = "Production" From 66f41d0cec41c728b808aa7ffaee29fe78942b52 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Mon, 28 Aug 2023 17:23:36 +1200 Subject: [PATCH 17/26] Update various urls. --- README.rst | 24 ++++++++++++------------ colour_datasets/__init__.py | 2 +- docs/index.rst | 6 +++--- docs/installation.rst | 16 ++++++++-------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/README.rst b/README.rst index d01b602..470d622 100644 --- a/README.rst +++ b/README.rst @@ -24,7 +24,7 @@ Colour science datasets for use with `Colour `__ or any Python package manipulating colours. The datasets are hosted in `Zenodo `__ under the -`Colour Science - Datasets `__ +`Colour Science - Datasets `__ community. It is open source and freely available under the @@ -50,7 +50,7 @@ when trying to access or use colour science datasets: **Colour - Datasets** offers all the above: it allows users to ingest and load colour science datasets with a single function call. The datasets information -is hosted on `Zenodo `__ +is hosted on `Zenodo `__ where the record for a dataset typically contain: - An *urls.txt* file describing the urls to source the dataset files from. @@ -156,14 +156,14 @@ Primary Dependencies **Colour - Datasets** requires various dependencies in order to run: -- `python >= 3.8, < 4 `__ -- `cachetools `__ -- `colour-science >= 4 `__ -- `imageio >= 2, < 3 `__ -- `numpy >= 1.19, < 2 `__ -- `scipy >= 1.5, < 2 `__ -- `tqdm `__ -- `xlrd `__ +- `python >= 3.8, < 4 `__ +- `cachetools `__ +- `colour-science >= 4 `__ +- `imageio >= 2, < 3 `__ +- `numpy >= 1.19, < 2 `__ +- `scipy >= 1.5, < 2 `__ +- `tqdm `__ +- `xlrd `__ Pypi ~~~~ @@ -182,7 +182,7 @@ Contributing ^^^^^^^^^^^^ If you would like to contribute to `Colour - Datasets `__, -please refer to the following `Contributing `__ +please refer to the following `Contributing `__ guide for `Colour `__. Bibliography @@ -202,7 +202,7 @@ Code of Conduct --------------- The *Code of Conduct*, adapted from the `Contributor Covenant 1.4 `__, -is available on the `Code of Conduct `__ page. +is available on the `Code of Conduct `__ page. Contact & Social ---------------- diff --git a/colour_datasets/__init__.py b/colour_datasets/__init__.py index 200195b..12a8acd 100644 --- a/colour_datasets/__init__.py +++ b/colour_datasets/__init__.py @@ -6,7 +6,7 @@ `Colour `__ or any Python package manipulating colours. The datasets are hosted in `Zenodo `__ under the `Colour Science - Datasets \ -`__ community. +`__ community. Subpackages ----------- diff --git a/docs/index.rst b/docs/index.rst index 9da6c1e..9bad645 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -5,7 +5,7 @@ Colour science datasets for use with `Colour `__ or any Python package manipulating colours. The datasets are hosted in `Zenodo `__ under the -`Colour Science - Datasets `__ +`Colour Science - Datasets `__ community. It is open source and freely available under the @@ -27,7 +27,7 @@ when trying to access or use colour science datasets: **Colour - Datasets** offers all the above: it allows users to ingest and load colour science datasets with a single function call. The datasets information -is hosted on `Zenodo `__ +is hosted on `Zenodo `__ where the record for a dataset typically contain: - An *urls.txt* file describing the urls to source the dataset files from. @@ -142,7 +142,7 @@ Code of Conduct --------------- The *Code of Conduct*, adapted from the `Contributor Covenant 1.4 `__, -is available on the `Code of Conduct `__ page. +is available on the `Code of Conduct `__ page. Contact & Social ---------------- diff --git a/docs/installation.rst b/docs/installation.rst index dda4a14..c2c4203 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -6,14 +6,14 @@ Primary Dependencies **Colour - Datasets** requires various dependencies in order to run: -- `python >= 3.8, < 4 `__ -- `cachetools `__ -- `colour-science >= 4 `__ -- `imageio >= 2, < 3 `__ -- `numpy >= 1.19, < 2 `__ -- `scipy >= 1.5, < 2 `__ -- `tqdm `__ -- `xlrd `__ +- `python >= 3.8, < 4 `__ +- `cachetools `__ +- `colour-science >= 4 `__ +- `imageio >= 2, < 3 `__ +- `numpy >= 1.19, < 2 `__ +- `scipy >= 1.5, < 2 `__ +- `tqdm `__ +- `xlrd `__ Pypi ---- From 0c0e768235216ec2dcc8fe0e5ca771e77fef7200 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Wed, 30 Aug 2023 17:06:20 +1200 Subject: [PATCH 18/26] Overhaul "Poetry" dependencies. --- .../continuous-integration-documentation.yml | 2 +- .pre-commit-config.yaml | 6 +- .readthedocs.yaml | 7 +- docs/requirements.txt | 46 +++ pyproject.toml | 153 ++++------ requirements.txt | 270 ++++++++++++------ setup.py | 79 ----- tasks.py | 74 +---- 8 files changed, 299 insertions(+), 338 deletions(-) create mode 100644 docs/requirements.txt delete mode 100644 setup.py diff --git a/.github/workflows/continuous-integration-documentation.yml b/.github/workflows/continuous-integration-documentation.yml index d1130ff..cc10aa0 100644 --- a/.github/workflows/continuous-integration-documentation.yml +++ b/.github/workflows/continuous-integration-documentation.yml @@ -39,7 +39,7 @@ jobs: - name: Install Package Dependencies run: | poetry run python -m pip install --upgrade pip - poetry install --extras "read-the-docs" + poetry install poetry run python -c "import imageio;imageio.plugins.freeimage.download()" shell: bash - name: Build Documentation diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3345920..b527df6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,14 +1,14 @@ repos: - repo: https://github.com/ikamensh/flynt/ - rev: '0.77' + rev: '1.0.1' hooks: - id: flynt - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.239' + rev: 'v0.0.285' hooks: - id: ruff - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 23.7.0 hooks: - id: black language_version: python3.9 diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 2834365..c93eb8a 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -13,8 +13,5 @@ formats: - pdf python: - install: - - method: pip - path: . - extra_requirements: - - read-the-docs \ No newline at end of file + install: + - requirements: docs/requirements.txt \ No newline at end of file diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..a533574 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,46 @@ +accessible-pygments==0.0.4 ; python_version >= "3.9" and python_version < "3.12" +alabaster==0.7.13 ; python_version >= "3.9" and python_version < "3.12" +babel==2.12.1 ; python_version >= "3.9" and python_version < "3.12" +beautifulsoup4==4.12.2 ; python_version >= "3.9" and python_version < "3.12" +biblib-simple==0.1.2 ; python_version >= "3.9" and python_version < "3.12" +cachetools==5.3.1 ; python_version >= "3.9" and python_version < "3.12" +certifi==2023.7.22 ; python_version >= "3.9" and python_version < "3.12" +charset-normalizer==3.2.0 ; python_version >= "3.9" and python_version < "3.12" +colorama==0.4.6 ; python_version >= "3.9" and python_version < "3.12" and (platform_system == "Windows" or sys_platform == "win32") +colour-science==0.4.3 ; python_version >= "3.9" and python_version < "3.12" +docutils==0.17.1 ; python_version >= "3.9" and python_version < "3.12" +idna==3.4 ; python_version >= "3.9" and python_version < "3.12" +imageio==2.31.2 ; python_version >= "3.9" and python_version < "3.12" +imagesize==1.4.1 ; python_version >= "3.9" and python_version < "3.12" +importlib-metadata==6.8.0 ; python_version >= "3.9" and python_version < "3.10" +jinja2==3.1.2 ; python_version >= "3.9" and python_version < "3.12" +latexcodec==2.0.1 ; python_version >= "3.9" and python_version < "3.12" +markupsafe==2.1.3 ; python_version >= "3.9" and python_version < "3.12" +numpy==1.25.2 ; python_version >= "3.9" and python_version < "3.12" +opencv-python==4.8.0.76 ; python_version >= "3.9" and python_version < "3.12" +packaging==23.1 ; python_version >= "3.9" and python_version < "3.12" +pillow==10.0.0 ; python_version >= "3.9" and python_version < "3.12" +pybtex-docutils==1.0.3 ; python_version >= "3.9" and python_version < "3.12" +pybtex==0.24.0 ; python_version >= "3.9" and python_version < "3.12" +pydata-sphinx-theme==0.13.3 ; python_version >= "3.9" and python_version < "3.12" +pygments==2.16.1 ; python_version >= "3.9" and python_version < "3.12" +pyyaml==6.0.1 ; python_version >= "3.9" and python_version < "3.12" +requests==2.31.0 ; python_version >= "3.9" and python_version < "3.12" +restructuredtext-lint==1.4.0 ; python_version >= "3.9" and python_version < "3.12" +scipy==1.11.2 ; python_version >= "3.9" and python_version < "3.12" +six==1.16.0 ; python_version >= "3.9" and python_version < "3.12" +snowballstemmer==2.2.0 ; python_version >= "3.9" and python_version < "3.12" +soupsieve==2.4.1 ; python_version >= "3.9" and python_version < "3.12" +sphinx==4.5.0 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-applehelp==1.0.4 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-bibtex==2.6.1 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-devhelp==1.0.2 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-htmlhelp==2.0.1 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-jsmath==1.0.1 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-qthelp==1.0.3 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-serializinghtml==1.1.5 ; python_version >= "3.9" and python_version < "3.12" +tqdm==4.66.1 ; python_version >= "3.9" and python_version < "3.12" +typing-extensions==4.7.1 ; python_version >= "3.9" and python_version < "3.12" +urllib3==2.0.4 ; python_version >= "3.9" and python_version < "3.12" +xlrd==1.2.0 ; python_version >= "3.9" and python_version < "3.12" +zipp==3.16.2 ; python_version >= "3.9" and python_version < "3.10" diff --git a/pyproject.toml b/pyproject.toml index 84d0d77..43f69ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,79 +45,38 @@ classifiers = [ [tool.poetry.dependencies] python = ">= 3.9, < 3.12" cachetools = "*" -colour-science = ">= 0.4.2" +colour-science = ">= 0.4.3" imageio = ">= 2, < 3" -numpy = ">= 1.21, < 2" +numpy = ">= 1.22, < 2" opencv-python = ">= 4, < 5" -scipy = ">= 1.7, < 2" +scipy = ">= 1.8, < 2" tqdm = "*" typing-extensions = ">= 4, < 5" xlrd = ">= 1.2, < 2" -biblib-simple = { version = "*", optional = true } # Development dependency. -black = { version = "*", optional = true } # Development dependency. -blackdoc = { version = "*", optional = true } # Development dependency. -coverage = { version = "!= 6.3", optional = true } # Development dependency. -coveralls = { version = "*", optional = true } # Development dependency. -flynt = { version = "*", optional = true } # Development dependency. -invoke = { version = "*", optional = true } # Development dependency. -pre-commit = { version = "*", optional = true } # Development dependency. -pydata-sphinx-theme = { version = "*", optional = true } # Development dependency. -pyright = { version = "*", optional = true } # Development dependency. -pytest = { version = "*", optional = true } # Development dependency. -pytest-cov = { version = "*", optional = true } # Development dependency. -pytest-xdist = { version = "*", optional = true} # Development dependency -restructuredtext-lint = { version = "*", optional = true } # Development dependency. -ruff = { version = "*", optional = true } # Development dependency. -sphinx = { version = ">= 4, < 5", optional = true } # Development dependency. -sphinxcontrib-bibtex = { version = "*", optional = true } # Development dependency. -toml = { version = "*", optional = true } # Development dependency. -twine = { version = "*", optional = true } # Development dependency. - -[tool.poetry.dev-dependencies] -biblib-simple = "*" +[tool.poetry.group.dev.dependencies] black = "*" blackdoc = "*" coverage = "!= 6.3" coveralls = "*" flynt = "*" invoke = "*" +jupyter = "*" pre-commit = "*" -pytest = "*" -pydata-sphinx-theme = "*" pyright = "*" +pytest = "*" pytest-cov = "*" pytest-xdist = "*" -restructuredtext-lint = "*" ruff = "*" -sphinx = ">= 4, < 5" -sphinxcontrib-bibtex = "*" toml = "*" twine = "*" -[tool.poetry.extras] -development = [ - "biblib-simple", - "black", - "blackdoc", - "coverage", - "coveralls", - "flynt", - "invoke", - "pre-commit", - "pydata-sphinx-theme", - "pyright", - "pytest", - "pytest-cov", - "pytest-xdist", - "restructuredtext-lint", - "ruff", - "sphinx", - "sphinxcontrib-bibtex", - "toml", - "twine", -] -read-the-docs = [ "pydata-sphinx-theme", "sphinxcontrib-bibtex" ] +[tool.poetry.group.docs.dependencies] +biblib-simple = "*" +pydata-sphinx-theme = "*" +restructuredtext-lint = "*" +sphinx = ">= 4, < 5" +sphinxcontrib-bibtex = "*" [tool.black] line-length = 79 @@ -144,52 +103,51 @@ reportUnusedExpression = false [tool.pytest.ini_options] addopts = "--durations=5" - [tool.ruff] target-version = "py39" line-length = 88 select = [ - "A", # flake8-builtins - "ARG", # flake8-unused-arguments - # "ANN", # flake8-annotations - "B", # flake8-bugbear - # "BLE", # flake8-blind-except - "C4", # flake8-comprehensions - # "C90", # mccabe - # "COM", # flake8-commas - "DTZ", # flake8-datetimez - "D", # pydocstyle - "E", # pydocstyle - # "ERA", # eradicate - # "EM", # flake8-errmsg - "EXE", # flake8-executable - "F", # flake8 - # "FBT", # flake8-boolean-trap - "G", # flake8-logging-format - "I", # isort - "ICN", # flake8-import-conventions - "INP", # flake8-no-pep420 - "ISC", # flake8-implicit-str-concat - "N", # pep8-naming - # "PD", # pandas-vet - "PIE", # flake8-pie - "PGH", # pygrep-hooks - "PL", # pylint - # "PT", # flake8-pytest-style - # "PTH", # flake8-use-pathlib [Enable] - "Q", # flake8-quotes - "RET", # flake8-return - "RUF", # Ruff - "S", # flake8-bandit - "SIM", # flake8-simplify - "T10", # flake8-debugger - "T20", # flake8-print - # "TCH", # flake8-type-checking - "TID", # flake8-tidy-imports - "TRY", # tryceratops - "UP", # pyupgrade - "W", # pydocstyle - "YTT" # flake8-2020 + "A", # flake8-builtins + "ARG", # flake8-unused-arguments + # "ANN", # flake8-annotations + "B", # flake8-bugbear + # "BLE", # flake8-blind-except + "C4", # flake8-comprehensions + # "C90", # mccabe + # "COM", # flake8-commas + "DTZ", # flake8-datetimez + "D", # pydocstyle + "E", # pydocstyle + # "ERA", # eradicate + # "EM", # flake8-errmsg + "EXE", # flake8-executable + "F", # flake8 + # "FBT", # flake8-boolean-trap + "G", # flake8-logging-format + "I", # isort + "ICN", # flake8-import-conventions + "INP", # flake8-no-pep420 + "ISC", # flake8-implicit-str-concat + "N", # pep8-naming + # "PD", # pandas-vet + "PIE", # flake8-pie + "PGH", # pygrep-hooks + "PL", # pylint + # "PT", # flake8-pytest-style + # "PTH", # flake8-use-pathlib [Enable] + "Q", # flake8-quotes + "RET", # flake8-return + "RUF", # Ruff + "S", # flake8-bandit + "SIM", # flake8-simplify + "T10", # flake8-debugger + "T20", # flake8-print + # "TCH", # flake8-type-checking + "TID", # flake8-tidy-imports + "TRY", # tryceratops + "UP", # pyupgrade + "W", # pydocstyle + "YTT" # flake8-2020 ] ignore = [ "B008", @@ -208,9 +166,13 @@ ignore = [ "N813", "N815", "N816", + "PGH003", "PIE804", "PLE0605", + "PLR0911", + "PLR0912", "PLR0913", + "PLR0915", "PLR2004", "RET504", "RET505", @@ -229,7 +191,6 @@ convention = "numpy" [tool.ruff.per-file-ignores] "colour_datasets/examples/*" = ["INP", "T201", "T203"] "docs/*" = ["INP"] -"setup.py" = ["INP"] "tasks.py" = ["INP"] "utilities/*" = ["EXE001", "INP"] "utilities/unicode_to_ascii.py" = ["RUF001"] diff --git a/requirements.txt b/requirements.txt index 09afd51..cf5a179 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,93 +1,177 @@ -alabaster==0.7.13 -astor==0.8.1 -attrs==22.2.0 -Babel==2.11.0 -beautifulsoup4==4.11.2 -biblib-simple==0.1.2 -black==23.1.0 -blackdoc==0.3.8 -bleach==6.0.0 -cachetools==5.3.0 -certifi==2022.12.7 -cfgv==3.3.1 -charset-normalizer==3.0.1 -click==8.1.3 -colour-science==0.4.2 -coverage==6.5.0 -coveralls==3.3.1 -distlib==0.3.6 -docopt==0.6.2 -docutils==0.17.1 -execnet==1.9.0 -filelock==3.9.0 -flynt==0.77 -identify==2.5.17 -idna==3.4 -imageio==2.25.0 -imagesize==1.4.1 -importlib-metadata==6.0.0 -iniconfig==2.0.0 -invoke==2.0.0 -jaraco.classes==3.2.3 -Jinja2==3.1.2 -keyring==23.13.1 -latexcodec==2.0.1 -markdown-it-py==2.1.0 -MarkupSafe==2.1.2 -mdurl==0.1.2 -more-itertools==9.0.0 -mypy-extensions==0.4.3 -nodeenv==1.7.0 -numpy==1.24.1 -opencv-python==4.7.0.68 -packaging==23.0 -pathspec==0.11.0 -Pillow==9.4.0 -pip==22.3.1 -pkginfo==1.9.6 -platformdirs==2.6.2 -pluggy==1.0.0 -pre-commit==3.0.3 -pybtex==0.24.0 -pybtex-docutils==1.0.2 -pydata-sphinx-theme==0.12.0 -Pygments==2.14.0 -pyright==1.1.292 -pytest==7.2.1 -pytest-cov==4.0.0 -pytest-xdist==3.1.0 -pytz==2022.7.1 -PyYAML==6.0 -readme-renderer==37.3 -requests==2.28.2 -requests-toolbelt==0.10.1 -restructuredtext-lint==1.4.0 -rfc3986==2.0.0 -rich==13.3.1 -ruff==0.0.240 -scipy==1.10.0 -setuptools==67.1.0 -six==1.16.0 -snowballstemmer==2.2.0 -soupsieve==2.3.2.post1 -Sphinx==4.5.0 -sphinxcontrib-applehelp==1.0.4 -sphinxcontrib-bibtex==2.5.0 -sphinxcontrib-devhelp==1.0.2 -sphinxcontrib-htmlhelp==2.0.1 -sphinxcontrib-jsmath==1.0.1 -sphinxcontrib-qthelp==1.0.3 -sphinxcontrib-serializinghtml==1.1.5 -toml==0.10.2 -tomli==2.0.1 -tqdm==4.64.1 -twine==4.0.2 -types-cachetools==5.2.1 -types-setuptools==65.6.0.1 -typing_extensions==4.4.0 -urllib3==1.26.14 -virtualenv==20.17.1 -webencodings==0.5.1 -wheel==0.38.4 -xlrd==1.2.0 -zipp==3.12.0 +accessible-pygments==0.0.4 ; python_version >= "3.9" and python_version < "3.12" +alabaster==0.7.13 ; python_version >= "3.9" and python_version < "3.12" +anyio==3.7.1 ; python_version >= "3.9" and python_version < "3.12" +appnope==0.1.3 ; python_version >= "3.9" and python_version < "3.12" and (platform_system == "Darwin" or sys_platform == "darwin") +argon2-cffi-bindings==21.2.0 ; python_version >= "3.9" and python_version < "3.12" +argon2-cffi==23.1.0 ; python_version >= "3.9" and python_version < "3.12" +arrow==1.2.3 ; python_version >= "3.9" and python_version < "3.12" +astor==0.8.1 ; python_version >= "3.9" and python_version < "3.12" +asttokens==2.2.1 ; python_version >= "3.9" and python_version < "3.12" +async-lru==2.0.4 ; python_version >= "3.9" and python_version < "3.12" +attrs==23.1.0 ; python_version >= "3.9" and python_version < "3.12" +babel==2.12.1 ; python_version >= "3.9" and python_version < "3.12" +backcall==0.2.0 ; python_version >= "3.9" and python_version < "3.12" +beautifulsoup4==4.12.2 ; python_version >= "3.9" and python_version < "3.12" +biblib-simple==0.1.2 ; python_version >= "3.9" and python_version < "3.12" +black==23.7.0 ; python_version >= "3.9" and python_version < "3.12" +blackdoc==0.3.8 ; python_version >= "3.9" and python_version < "3.12" +bleach==6.0.0 ; python_version >= "3.9" and python_version < "3.12" +cachetools==5.3.1 ; python_version >= "3.9" and python_version < "3.12" +certifi==2023.7.22 ; python_version >= "3.9" and python_version < "3.12" +cffi==1.15.1 ; python_version >= "3.9" and python_version < "3.12" +cfgv==3.4.0 ; python_version >= "3.9" and python_version < "3.12" +charset-normalizer==3.2.0 ; python_version >= "3.9" and python_version < "3.12" +click==8.1.7 ; python_version >= "3.9" and python_version < "3.12" +colorama==0.4.6 ; python_version >= "3.9" and python_version < "3.12" and (platform_system == "Windows" or sys_platform == "win32") +colour-science==0.4.3 ; python_version >= "3.9" and python_version < "3.12" +comm==0.1.4 ; python_version >= "3.9" and python_version < "3.12" +coverage==6.5.0 ; python_version >= "3.9" and python_version < "3.12" +coverage[toml]==6.5.0 ; python_version >= "3.9" and python_version < "3.12" +coveralls==3.3.1 ; python_version >= "3.9" and python_version < "3.12" +cryptography==41.0.3 ; python_version >= "3.9" and python_version < "3.12" and sys_platform == "linux" +debugpy==1.6.7.post1 ; python_version >= "3.9" and python_version < "3.12" +decorator==5.1.1 ; python_version >= "3.9" and python_version < "3.12" +defusedxml==0.7.1 ; python_version >= "3.9" and python_version < "3.12" +distlib==0.3.7 ; python_version >= "3.9" and python_version < "3.12" +docopt==0.6.2 ; python_version >= "3.9" and python_version < "3.12" +docutils==0.17.1 ; python_version >= "3.9" and python_version < "3.12" +exceptiongroup==1.1.3 ; python_version >= "3.9" and python_version < "3.11" +execnet==2.0.2 ; python_version >= "3.9" and python_version < "3.12" +executing==1.2.0 ; python_version >= "3.9" and python_version < "3.12" +fastjsonschema==2.18.0 ; python_version >= "3.9" and python_version < "3.12" +filelock==3.12.3 ; python_version >= "3.9" and python_version < "3.12" +flynt==1.0.1 ; python_version >= "3.9" and python_version < "3.12" +fqdn==1.5.1 ; python_version >= "3.9" and python_version < "3.12" +identify==2.5.27 ; python_version >= "3.9" and python_version < "3.12" +idna==3.4 ; python_version >= "3.9" and python_version < "3.12" +imageio==2.31.2 ; python_version >= "3.9" and python_version < "3.12" +imagesize==1.4.1 ; python_version >= "3.9" and python_version < "3.12" +importlib-metadata==6.8.0 ; python_version >= "3.9" and python_version < "3.12" +iniconfig==2.0.0 ; python_version >= "3.9" and python_version < "3.12" +invoke==2.2.0 ; python_version >= "3.9" and python_version < "3.12" +ipykernel==6.25.1 ; python_version >= "3.9" and python_version < "3.12" +ipython-genutils==0.2.0 ; python_version >= "3.9" and python_version < "3.12" +ipython==8.14.0 ; python_version >= "3.9" and python_version < "3.12" +ipywidgets==8.1.0 ; python_version >= "3.9" and python_version < "3.12" +isoduration==20.11.0 ; python_version >= "3.9" and python_version < "3.12" +jaraco-classes==3.3.0 ; python_version >= "3.9" and python_version < "3.12" +jedi==0.19.0 ; python_version >= "3.9" and python_version < "3.12" +jeepney==0.8.0 ; python_version >= "3.9" and python_version < "3.12" and sys_platform == "linux" +jinja2==3.1.2 ; python_version >= "3.9" and python_version < "3.12" +json5==0.9.14 ; python_version >= "3.9" and python_version < "3.12" +jsonpointer==2.4 ; python_version >= "3.9" and python_version < "3.12" +jsonschema-specifications==2023.7.1 ; python_version >= "3.9" and python_version < "3.12" +jsonschema==4.19.0 ; python_version >= "3.9" and python_version < "3.12" +jsonschema[format-nongpl]==4.19.0 ; python_version >= "3.9" and python_version < "3.12" +jupyter-client==8.3.1 ; python_version >= "3.9" and python_version < "3.12" +jupyter-console==6.6.3 ; python_version >= "3.9" and python_version < "3.12" +jupyter-core==5.3.1 ; python_version >= "3.9" and python_version < "3.12" +jupyter-events==0.7.0 ; python_version >= "3.9" and python_version < "3.12" +jupyter-lsp==2.2.0 ; python_version >= "3.9" and python_version < "3.12" +jupyter-server-terminals==0.4.4 ; python_version >= "3.9" and python_version < "3.12" +jupyter-server==2.7.2 ; python_version >= "3.9" and python_version < "3.12" +jupyter==1.0.0 ; python_version >= "3.9" and python_version < "3.12" +jupyterlab-pygments==0.2.2 ; python_version >= "3.9" and python_version < "3.12" +jupyterlab-server==2.24.0 ; python_version >= "3.9" and python_version < "3.12" +jupyterlab-widgets==3.0.8 ; python_version >= "3.9" and python_version < "3.12" +jupyterlab==4.0.5 ; python_version >= "3.9" and python_version < "3.12" +keyring==24.2.0 ; python_version >= "3.9" and python_version < "3.12" +latexcodec==2.0.1 ; python_version >= "3.9" and python_version < "3.12" +markdown-it-py==3.0.0 ; python_version >= "3.9" and python_version < "3.12" +markupsafe==2.1.3 ; python_version >= "3.9" and python_version < "3.12" +matplotlib-inline==0.1.6 ; python_version >= "3.9" and python_version < "3.12" +mdurl==0.1.2 ; python_version >= "3.9" and python_version < "3.12" +mistune==3.0.1 ; python_version >= "3.9" and python_version < "3.12" +more-itertools==10.1.0 ; python_version >= "3.9" and python_version < "3.12" +mypy-extensions==1.0.0 ; python_version >= "3.9" and python_version < "3.12" +nbclient==0.8.0 ; python_version >= "3.9" and python_version < "3.12" +nbconvert==7.8.0 ; python_version >= "3.9" and python_version < "3.12" +nbformat==5.9.2 ; python_version >= "3.9" and python_version < "3.12" +nest-asyncio==1.5.7 ; python_version >= "3.9" and python_version < "3.12" +nodeenv==1.8.0 ; python_version >= "3.9" and python_version < "3.12" +notebook-shim==0.2.3 ; python_version >= "3.9" and python_version < "3.12" +notebook==7.0.2 ; python_version >= "3.9" and python_version < "3.12" +numpy==1.25.2 ; python_version >= "3.9" and python_version < "3.12" +opencv-python==4.8.0.76 ; python_version >= "3.9" and python_version < "3.12" +overrides==7.4.0 ; python_version >= "3.9" and python_version < "3.12" +packaging==23.1 ; python_version >= "3.9" and python_version < "3.12" +pandocfilters==1.5.0 ; python_version >= "3.9" and python_version < "3.12" +parso==0.8.3 ; python_version >= "3.9" and python_version < "3.12" +pathspec==0.11.2 ; python_version >= "3.9" and python_version < "3.12" +pexpect==4.8.0 ; python_version >= "3.9" and python_version < "3.12" and sys_platform != "win32" +pickleshare==0.7.5 ; python_version >= "3.9" and python_version < "3.12" +pillow==10.0.0 ; python_version >= "3.9" and python_version < "3.12" +pkginfo==1.9.6 ; python_version >= "3.9" and python_version < "3.12" +platformdirs==3.10.0 ; python_version >= "3.9" and python_version < "3.12" +pluggy==1.3.0 ; python_version >= "3.9" and python_version < "3.12" +pre-commit==3.3.3 ; python_version >= "3.9" and python_version < "3.12" +prometheus-client==0.17.1 ; python_version >= "3.9" and python_version < "3.12" +prompt-toolkit==3.0.39 ; python_version >= "3.9" and python_version < "3.12" +psutil==5.9.5 ; python_version >= "3.9" and python_version < "3.12" +ptyprocess==0.7.0 ; python_version >= "3.9" and python_version < "3.12" and (sys_platform != "win32" or os_name != "nt") +pure-eval==0.2.2 ; python_version >= "3.9" and python_version < "3.12" +pybtex-docutils==1.0.3 ; python_version >= "3.9" and python_version < "3.12" +pybtex==0.24.0 ; python_version >= "3.9" and python_version < "3.12" +pycparser==2.21 ; python_version >= "3.9" and python_version < "3.12" +pydata-sphinx-theme==0.13.3 ; python_version >= "3.9" and python_version < "3.12" +pygments==2.16.1 ; python_version >= "3.9" and python_version < "3.12" +pyright==1.1.324 ; python_version >= "3.9" and python_version < "3.12" +pytest-cov==4.1.0 ; python_version >= "3.9" and python_version < "3.12" +pytest-xdist==3.3.1 ; python_version >= "3.9" and python_version < "3.12" +pytest==7.4.0 ; python_version >= "3.9" and python_version < "3.12" +python-dateutil==2.8.2 ; python_version >= "3.9" and python_version < "3.12" +python-json-logger==2.0.7 ; python_version >= "3.9" and python_version < "3.12" +pywin32-ctypes==0.2.2 ; python_version >= "3.9" and python_version < "3.12" and sys_platform == "win32" +pywin32==306 ; sys_platform == "win32" and platform_python_implementation != "PyPy" and python_version >= "3.9" and python_version < "3.12" +pywinpty==2.0.11 ; python_version >= "3.9" and python_version < "3.12" and os_name == "nt" +pyyaml==6.0.1 ; python_version >= "3.9" and python_version < "3.12" +pyzmq==25.1.1 ; python_version >= "3.9" and python_version < "3.12" +qtconsole==5.4.3 ; python_version >= "3.9" and python_version < "3.12" +qtpy==2.4.0 ; python_version >= "3.9" and python_version < "3.12" +readme-renderer==41.0 ; python_version >= "3.9" and python_version < "3.12" +referencing==0.30.2 ; python_version >= "3.9" and python_version < "3.12" +requests-toolbelt==1.0.0 ; python_version >= "3.9" and python_version < "3.12" +requests==2.31.0 ; python_version >= "3.9" and python_version < "3.12" +restructuredtext-lint==1.4.0 ; python_version >= "3.9" and python_version < "3.12" +rfc3339-validator==0.1.4 ; python_version >= "3.9" and python_version < "3.12" +rfc3986-validator==0.1.1 ; python_version >= "3.9" and python_version < "3.12" +rfc3986==2.0.0 ; python_version >= "3.9" and python_version < "3.12" +rich==13.5.2 ; python_version >= "3.9" and python_version < "3.12" +rpds-py==0.10.0 ; python_version >= "3.9" and python_version < "3.12" +ruff==0.0.286 ; python_version >= "3.9" and python_version < "3.12" +scipy==1.11.2 ; python_version >= "3.9" and python_version < "3.12" +secretstorage==3.3.3 ; python_version >= "3.9" and python_version < "3.12" and sys_platform == "linux" +send2trash==1.8.2 ; python_version >= "3.9" and python_version < "3.12" +setuptools==68.1.2 ; python_version >= "3.9" and python_version < "3.12" +six==1.16.0 ; python_version >= "3.9" and python_version < "3.12" +sniffio==1.3.0 ; python_version >= "3.9" and python_version < "3.12" +snowballstemmer==2.2.0 ; python_version >= "3.9" and python_version < "3.12" +soupsieve==2.4.1 ; python_version >= "3.9" and python_version < "3.12" +sphinx==4.5.0 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-applehelp==1.0.4 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-bibtex==2.6.1 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-devhelp==1.0.2 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-htmlhelp==2.0.1 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-jsmath==1.0.1 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-qthelp==1.0.3 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-serializinghtml==1.1.5 ; python_version >= "3.9" and python_version < "3.12" +stack-data==0.6.2 ; python_version >= "3.9" and python_version < "3.12" +terminado==0.17.1 ; python_version >= "3.9" and python_version < "3.12" +tinycss2==1.2.1 ; python_version >= "3.9" and python_version < "3.12" +toml==0.10.2 ; python_version >= "3.9" and python_version < "3.12" +tomli==2.0.1 ; python_version >= "3.9" and python_version < "3.12" +tornado==6.3.3 ; python_version >= "3.9" and python_version < "3.12" +tqdm==4.66.1 ; python_version >= "3.9" and python_version < "3.12" +traitlets==5.9.0 ; python_version >= "3.9" and python_version < "3.12" +twine==4.0.2 ; python_version >= "3.9" and python_version < "3.12" +typing-extensions==4.7.1 ; python_version >= "3.9" and python_version < "3.12" +uri-template==1.3.0 ; python_version >= "3.9" and python_version < "3.12" +urllib3==2.0.4 ; python_version >= "3.9" and python_version < "3.12" +virtualenv==20.24.3 ; python_version >= "3.9" and python_version < "3.12" +wcwidth==0.2.6 ; python_version >= "3.9" and python_version < "3.12" +webcolors==1.13 ; python_version >= "3.9" and python_version < "3.12" +webencodings==0.5.1 ; python_version >= "3.9" and python_version < "3.12" +websocket-client==1.6.2 ; python_version >= "3.9" and python_version < "3.12" +widgetsnbextension==4.0.8 ; python_version >= "3.9" and python_version < "3.12" +xlrd==1.2.0 ; python_version >= "3.9" and python_version < "3.12" +zipp==3.16.2 ; python_version >= "3.9" and python_version < "3.12" diff --git a/setup.py b/setup.py deleted file mode 100644 index 37ed046..0000000 --- a/setup.py +++ /dev/null @@ -1,79 +0,0 @@ -""" -Colour - Datasets - Setup -========================= -""" - -import codecs -from setuptools import setup - -packages = [ - "colour_datasets", - "colour_datasets.examples", - "colour_datasets.loaders", - "colour_datasets.loaders.tests", - "colour_datasets.records", - "colour_datasets.records.tests", - "colour_datasets.utilities", - "colour_datasets.utilities.tests", -] - -package_data = { - "": ["*"], - "colour_datasets.loaders.tests": ["resources/*"], - "colour_datasets.utilities.tests": ["resources/*"], -} - -install_requires = [ - "cachetools", - "colour-science>=0.4.2", - "imageio>=2,<3", - "numpy>=1.20,<2", - "opencv-python>=4,<5", - "scipy>=1.7,<2", - "tqdm", - "typing-extensions>=4,<5", - "xlrd>=1.2,<2", -] - -extras_require = { - "development": [ - "biblib-simple", - "black", - "blackdoc", - "coverage!=6.3", - "coveralls", - "flake8", - "flynt", - "invoke", - "mypy", - "pre-commit", - "pydata-sphinx-theme", - "pydocstyle", - "pytest", - "pytest-cov", - "pyupgrade", - "restructuredtext-lint", - "sphinx>=4,<5", - "sphinxcontrib-bibtex", - "toml", - "twine", - ], - "read-the-docs": ["pydata-sphinx-theme", "sphinxcontrib-bibtex"], -} - -setup( - name="colour-datasets", - version="0.2.1", - description="Colour science datasets for use with Colour", - long_description=codecs.open("README.rst", encoding="utf8").read(), - author="Colour Developers", - author_email="colour-developers@colour-science.org", - maintainer="Colour Developers", - maintainer_email="colour-developers@colour-science.org", - url="https://www.colour-science.org/", - packages=packages, - package_data=package_data, - install_requires=install_requires, - extras_require=extras_require, - python_requires=">=3.9,<3.12", -) diff --git a/tasks.py b/tasks.py index c92c11e..7adbde7 100644 --- a/tasks.py +++ b/tasks.py @@ -309,9 +309,18 @@ def requirements(ctx: Context): message_box('Exporting "requirements.txt" file...') ctx.run( - "poetry run pip list --format=freeze | " - 'egrep -v "colour-datasets=" ' - "> requirements.txt" + "poetry export -f requirements.txt " + "--without-hashes " + "--with dev,docs " + "--output requirements.txt" + ) + + message_box('Exporting "docs/requirements.txt" file...') + ctx.run( + "poetry export -f requirements.txt " + "--without-hashes " + "--with docs " + "--output docs/requirements.txt" ) @@ -329,63 +338,6 @@ def build(ctx: Context): message_box("Building...") ctx.run("poetry build") - - with ctx.cd("dist"): - ctx.run(f"tar -xvf {PYPI_ARCHIVE_NAME}-{APPLICATION_VERSION}.tar.gz") - ctx.run(f"cp {PYPI_ARCHIVE_NAME}-{APPLICATION_VERSION}/setup.py ../") - - ctx.run(f"rm -rf {PYPI_ARCHIVE_NAME}-{APPLICATION_VERSION}") - - with open("setup.py") as setup_file: - source = setup_file.read() - - setup_kwargs = [] - - def sub_callable(match): - setup_kwargs.append(match) - - return "" - - template = """ -setup({0} -) -""" - - source = re.sub( - "from setuptools import setup", - ( - '"""\n' - "Colour - Datasets - Setup\n" - "=========================\n" - '"""\n\n' - "import codecs\n" - "from setuptools import setup" - ), - source, - ) - source = re.sub( - "setup_kwargs = {(.*)}.*setup\\(\\*\\*setup_kwargs\\)", - sub_callable, - source, - flags=re.DOTALL, - )[:-2] - setup_kwargs = setup_kwargs[0].group(1).splitlines() - for i, line in enumerate(setup_kwargs): - setup_kwargs[i] = re.sub("^\\s*('(\\w+)':\\s?)", " \\2=", line) - if setup_kwargs[i].strip().startswith("long_description"): - setup_kwargs[i] = ( - " long_description=" - "codecs.open('README.rst', encoding='utf8')" - ".read()," - ) - - source += template.format("\n".join(setup_kwargs)) - - with open("setup.py", "w") as setup_file: - setup_file.write(source) - - ctx.run("poetry run pre-commit run --files setup.py || true") - ctx.run("twine check dist/*") @@ -463,7 +415,7 @@ def tag(ctx: Context): remote_tag.split("refs/tags/")[1].replace("refs/tags/", "^{}") ) version_tags = sorted(tags) - if f"v{version}" not in version_tags: + if f"v{version}" in version_tags: raise RuntimeError( f'A "{PYTHON_PACKAGE_NAME}" "v{version}" tag already exists in ' f"remote repository!" From 2e4e33bf58a58cfef43c95db21002dac6fd270e8 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Wed, 30 Aug 2023 16:58:35 +1200 Subject: [PATCH 19/26] Fix various static typing issues. --- colour_datasets/loaders/dyer2017.py | 17 ++--------- colour_datasets/loaders/kuopio.py | 5 ++-- colour_datasets/loaders/luo1999.py | 38 +++++++----------------- colour_datasets/records/configuration.py | 1 - tasks.py | 4 +-- 5 files changed, 18 insertions(+), 47 deletions(-) diff --git a/colour_datasets/loaders/dyer2017.py b/colour_datasets/loaders/dyer2017.py index 05866b4..1e23444 100644 --- a/colour_datasets/loaders/dyer2017.py +++ b/colour_datasets/loaders/dyer2017.py @@ -22,14 +22,7 @@ from colour import MultiSpectralDistributions, SpectralDistribution from colour.continuous import MultiSignals, Signal -from colour.hints import ( - Any, - Dict, - Literal, - Type, - Union, - cast, -) +from colour.hints import Any, Dict, Literal from colour.utilities import attest, is_numeric, is_string, optional from colour_datasets.loaders import AbstractDatasetLoader @@ -1520,14 +1513,10 @@ def load( for directory in ("camera", "cmf", "illuminant", "training"): self._content[directory] = {} - factory = cast( - Union[ - Type[SpectralDistribution_AMPAS], - Type[MultiSpectralDistributions_AMPAS], - ], + factory = ( SpectralDistribution_AMPAS if directory == "illuminant" - else MultiSpectralDistributions_AMPAS, + else MultiSpectralDistributions_AMPAS ) glob_pattern = os.path.join( self.record.repository, "dataset", "data", directory, "*.json" diff --git a/colour_datasets/loaders/kuopio.py b/colour_datasets/loaders/kuopio.py index 7553364..12f4431 100644 --- a/colour_datasets/loaders/kuopio.py +++ b/colour_datasets/loaders/kuopio.py @@ -43,6 +43,7 @@ import scipy.io import sys from collections import namedtuple +from typing import ClassVar from colour import SpectralDistribution, SpectralShape from colour.hints import Any, Dict, Tuple, Type, cast @@ -155,7 +156,7 @@ class DatasetLoader_KuopioUniversity(AbstractDatasetLoader): ID: str = "Undefined" """Dataset record id, i.e. the *Zenodo* record number.""" - METADATA: Dict = {} + METADATA: ClassVar[Dict] = {} """ Mapping of paths and :class:`colour_datasets.loaders.kuopio.MatFileMetadata_KuopioUniversity` @@ -498,7 +499,7 @@ def build_KuopioUniversity( for _id, _data in DATA_KUOPIO_UNIVERSITY.items(): _module = sys.modules["colour_datasets.loaders.kuopio"] _dataset_loader_class = _build_dataset_loader_class_KuopioUniversity( - _id, *_data # pyright: ignore + _id, *_data ) _partial_function = functools.partial( build_KuopioUniversity, _dataset_loader_class diff --git a/colour_datasets/loaders/luo1999.py b/colour_datasets/loaders/luo1999.py index 1c816f2..a01b8d0 100644 --- a/colour_datasets/loaders/luo1999.py +++ b/colour_datasets/loaders/luo1999.py @@ -454,36 +454,18 @@ def load(self) -> Dict[str, CorrespondingColourDataset_Luo1999]: name = f"{key} - {filename.split('.')[1]}" dataset_metadata = dict(zip(metadata_headers, metadata)) - Y_r = ( - dataset_metadata["Illuminance (lux)"][ # pyright: ignore - i - ][0], - ) - Y_t = dataset_metadata["Illuminance (lux)"][ # pyright: ignore - i - ][1] - - B_r = dataset_metadata["Background (Y%)"][ # pyright: ignore - i - ][0] - B_t = dataset_metadata["Background (Y%)"][ # pyright: ignore - i - ][1] - - dataset_metadata[ - "Illuminance (lux)" - ] = dataset_metadata[ # pyright: ignore + Y_r = dataset_metadata["Illuminance (lux)"][i][0] + Y_t = dataset_metadata["Illuminance (lux)"][i][1] + + B_r = dataset_metadata["Background (Y%)"][i][0] + B_t = dataset_metadata["Background (Y%)"][i][1] + + dataset_metadata["Illuminance (lux)"] = dataset_metadata[ "Illuminance (lux)" - ][ - i - ] - dataset_metadata[ - "Background (Y%)" - ] = dataset_metadata[ # pyright: ignore + ][i] + dataset_metadata["Background (Y%)"] = dataset_metadata[ "Background (Y%)" - ][ - i - ] + ][i] self._content[name] = CorrespondingColourDataset_Luo1999( name, diff --git a/colour_datasets/records/configuration.py b/colour_datasets/records/configuration.py index 74172b2..a9313be 100644 --- a/colour_datasets/records/configuration.py +++ b/colour_datasets/records/configuration.py @@ -117,7 +117,6 @@ def __init__( api_url: str = "https://sandbox.zenodo.org/api", community: str = "colour-science-datasets", ) -> None: - self._api_url = api_url self._community = community diff --git a/tasks.py b/tasks.py index 7adbde7..9073053 100644 --- a/tasks.py +++ b/tasks.py @@ -384,7 +384,7 @@ def tag(ctx: Context): message_box("Tagging...") result = ctx.run("git rev-parse --abbrev-ref HEAD", hide="both") - if result.stdout.strip() == "develop": + if result.stdout.strip() != "develop": # pyright: ignore raise RuntimeError("Are you still on a feature or master branch?") with open(os.path.join(PYTHON_PACKAGE_NAME, "__init__.py")) as file_handle: @@ -408,7 +408,7 @@ def tag(ctx: Context): version = ".".join((major_version, minor_version, change_version)) result = ctx.run("git ls-remote --tags upstream", hide="both") - remote_tags = result.stdout.strip().split("\n") + remote_tags = result.stdout.strip().split("\n") # pyright: ignore tags = set() for remote_tag in remote_tags: tags.add( From 6c050f87b6f36e7fa89a43d84dd0c2b5422055a7 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Tue, 29 Aug 2023 21:58:46 +1200 Subject: [PATCH 20/26] Fix various quality issues. --- colour_datasets/__init__.py | 2 +- colour_datasets/loaders/__init__.py | 4 ++-- colour_datasets/loaders/asano2015.py | 2 +- colour_datasets/loaders/brendel2020.py | 2 +- colour_datasets/loaders/dyer2017.py | 2 +- colour_datasets/loaders/ebner1998.py | 4 ++-- colour_datasets/loaders/hung1995.py | 6 +++--- colour_datasets/loaders/jakob2019.py | 2 +- colour_datasets/loaders/jiang2013.py | 2 +- colour_datasets/loaders/karge2015.py | 4 ++-- colour_datasets/loaders/labsphere2019.py | 2 +- colour_datasets/loaders/luo1997.py | 4 ++-- colour_datasets/loaders/luo1999.py | 2 +- colour_datasets/loaders/winquist2022.py | 2 +- colour_datasets/loaders/xrite2016.py | 2 +- colour_datasets/loaders/zhao2009.py | 2 +- colour_datasets/records/__init__.py | 2 +- colour_datasets/records/tests/test_zenodo.py | 4 ++-- colour_datasets/records/zenodo.py | 8 +++++--- colour_datasets/utilities/common.py | 6 ++++-- colour_datasets/utilities/tests/test_common.py | 2 +- utilities/export_todo.py | 4 ++-- utilities/unicode_to_ascii.py | 2 +- 23 files changed, 38 insertions(+), 34 deletions(-) diff --git a/colour_datasets/__init__.py b/colour_datasets/__init__.py index 12a8acd..41d5bd5 100644 --- a/colour_datasets/__init__.py +++ b/colour_datasets/__init__.py @@ -61,7 +61,7 @@ try: _version = ( subprocess.check_output( - ["git", "describe"], + ["git", "describe"], # noqa: S603, S607 cwd=os.path.dirname(__file__), stderr=subprocess.STDOUT, ) diff --git a/colour_datasets/loaders/__init__.py b/colour_datasets/loaders/__init__.py index a766340..b28c0a9 100644 --- a/colour_datasets/loaders/__init__.py +++ b/colour_datasets/loaders/__init__.py @@ -114,7 +114,7 @@ _module = sys.modules["colour_datasets.loaders"] for _export in kuopio.__all__: - if _export.startswith("DatasetLoader_") or _export.startswith("build_"): + if _export.startswith(("DatasetLoader_", "build_")): setattr(_module, _export, getattr(kuopio, _export)) __all__ += [_export] # noqa: PLE0604 @@ -158,7 +158,7 @@ def load(dataset: int | str) -> Any: 28 """ - global _HAS_TITLE_KEYS + global _HAS_TITLE_KEYS # noqa: PLW0603 if not _HAS_TITLE_KEYS: for key in list(DATASET_LOADERS.keys())[:]: diff --git a/colour_datasets/loaders/asano2015.py b/colour_datasets/loaders/asano2015.py index e36859d..a64b10d 100644 --- a/colour_datasets/loaders/asano2015.py +++ b/colour_datasets/loaders/asano2015.py @@ -336,7 +336,7 @@ def build_Asano2015(load: bool = True) -> DatasetLoader_Asano2015: :cite:`Asano2015` """ - global _DATASET_LOADER_ASANO2015 + global _DATASET_LOADER_ASANO2015 # noqa: PLW0603 if _DATASET_LOADER_ASANO2015 is None: _DATASET_LOADER_ASANO2015 = DatasetLoader_Asano2015() diff --git a/colour_datasets/loaders/brendel2020.py b/colour_datasets/loaders/brendel2020.py index cb6a6db..3528974 100644 --- a/colour_datasets/loaders/brendel2020.py +++ b/colour_datasets/loaders/brendel2020.py @@ -136,7 +136,7 @@ def build_Brendel2020(load: bool = True) -> DatasetLoader_Brendel2020: :cite:`Brendel2020` """ - global _DATASET_LOADER_BRENDEL2020 + global _DATASET_LOADER_BRENDEL2020 # noqa: PLW0603 if _DATASET_LOADER_BRENDEL2020 is None: _DATASET_LOADER_BRENDEL2020 = DatasetLoader_Brendel2020() diff --git a/colour_datasets/loaders/dyer2017.py b/colour_datasets/loaders/dyer2017.py index 1e23444..9cadfba 100644 --- a/colour_datasets/loaders/dyer2017.py +++ b/colour_datasets/loaders/dyer2017.py @@ -1556,7 +1556,7 @@ def build_Dyer2017(load: bool = True) -> DatasetLoader_Dyer2017: :cite:`Dyer2017` """ - global _DATASET_LOADER_DYER2017 + global _DATASET_LOADER_DYER2017 # noqa: PLW0603 if _DATASET_LOADER_DYER2017 is None: _DATASET_LOADER_DYER2017 = DatasetLoader_Dyer2017() diff --git a/colour_datasets/loaders/ebner1998.py b/colour_datasets/loaders/ebner1998.py index bb1ef03..db5a2dc 100644 --- a/colour_datasets/loaders/ebner1998.py +++ b/colour_datasets/loaders/ebner1998.py @@ -149,7 +149,7 @@ def _parse_float_values(data: str) -> NDArrayFloat: if line.startswith("White Point"): XYZ_r = _parse_float_values(line.split(":")[-1]) elif line.startswith("reference hue"): - line = line.replace("reference hue ", "") + line = line.replace("reference hue ", "") # noqa: PLW2901 attribute, value = line.split("\t", 1) hue, data = int(attribute), _parse_float_values(value) @@ -194,7 +194,7 @@ def build_Ebner1998(load: bool = True) -> DatasetLoader_Ebner1998: :cite:`Ebner1998` """ - global _DATASET_LOADER_EBNER1998 + global _DATASET_LOADER_EBNER1998 # noqa: PLW0603 if _DATASET_LOADER_EBNER1998 is None: _DATASET_LOADER_EBNER1998 = DatasetLoader_Ebner1998() diff --git a/colour_datasets/loaders/hung1995.py b/colour_datasets/loaders/hung1995.py index f22d0cc..210367a 100644 --- a/colour_datasets/loaders/hung1995.py +++ b/colour_datasets/loaders/hung1995.py @@ -170,7 +170,7 @@ def load( self._content[key] = {} for hue in hues: for sample_r in self._content["Table I"]: - sample_r = sample_r.tolist() + sample_r = sample_r.tolist() # noqa: PLW2901 if sample_r[0] == hue: XYZ_cr = xyY_to_XYZ(sample_r[1:4]) / 100 break @@ -181,7 +181,7 @@ def load( "C*uv": [], } for sample_t in self._content[table]: - sample_t = sample_t.tolist() + sample_t = sample_t.tolist() # noqa: PLW2901 if sample_t[0] != hue: continue @@ -226,7 +226,7 @@ def build_Hung1995(load: bool = True) -> DatasetLoader_Hung1995: :cite:`Hung1995` """ - global _DATASET_LOADER_HUNG1995 + global _DATASET_LOADER_HUNG1995 # noqa: PLW0603 if _DATASET_LOADER_HUNG1995 is None: _DATASET_LOADER_HUNG1995 = DatasetLoader_Hung1995() diff --git a/colour_datasets/loaders/jakob2019.py b/colour_datasets/loaders/jakob2019.py index 3374a3d..ead0169 100644 --- a/colour_datasets/loaders/jakob2019.py +++ b/colour_datasets/loaders/jakob2019.py @@ -145,7 +145,7 @@ def build_Jakob2019(load: bool = True) -> DatasetLoader_Jakob2019: :cite:`Jakob2019` """ - global _DATASET_LOADER_JAKOB2019 + global _DATASET_LOADER_JAKOB2019 # noqa: PLW0603 if _DATASET_LOADER_JAKOB2019 is None: _DATASET_LOADER_JAKOB2019 = DatasetLoader_Jakob2019() diff --git a/colour_datasets/loaders/jiang2013.py b/colour_datasets/loaders/jiang2013.py index cd1a9a8..ee90134 100644 --- a/colour_datasets/loaders/jiang2013.py +++ b/colour_datasets/loaders/jiang2013.py @@ -152,7 +152,7 @@ def build_Jiang2013(load: bool = True) -> DatasetLoader_Jiang2013: :cite:`Jiang2013` """ - global _DATASET_LOADER_JIANG2013 + global _DATASET_LOADER_JIANG2013 # noqa: PLW0603 if _DATASET_LOADER_JIANG2013 is None: _DATASET_LOADER_JIANG2013 = DatasetLoader_Jiang2013() diff --git a/colour_datasets/loaders/karge2015.py b/colour_datasets/loaders/karge2015.py index 7c8b0e6..5b7cca1 100644 --- a/colour_datasets/loaders/karge2015.py +++ b/colour_datasets/loaders/karge2015.py @@ -107,7 +107,7 @@ def load(self) -> Dict[str, Dict[str, Dict]]: .replace("_", " ") ) category = "Normalised" if "normalized" in path else "Raw" - path = os.path.join(database_root, path) + path = os.path.join(database_root, path) # noqa: PLW2901 sds = {} for name, sd in read_sds_from_csv_file( @@ -152,7 +152,7 @@ def build_Karge2015(load: bool = True) -> DatasetLoader_Karge2015: :cite:`Karge2015` """ - global _DATASET_LOADER_KARGE2015 + global _DATASET_LOADER_KARGE2015 # noqa: PLW0603 if _DATASET_LOADER_KARGE2015 is None: _DATASET_LOADER_KARGE2015 = DatasetLoader_Karge2015() diff --git a/colour_datasets/loaders/labsphere2019.py b/colour_datasets/loaders/labsphere2019.py index 2ad66c7..3cf6396 100644 --- a/colour_datasets/loaders/labsphere2019.py +++ b/colour_datasets/loaders/labsphere2019.py @@ -126,7 +126,7 @@ def build_Labsphere2019(load: bool = True) -> DatasetLoader_Labsphere2019: :cite:`Labsphere2019` """ - global _DATASET_LOADER_LABSPHERE2019 + global _DATASET_LOADER_LABSPHERE2019 # noqa: PLW0603 if _DATASET_LOADER_LABSPHERE2019 is None: _DATASET_LOADER_LABSPHERE2019 = DatasetLoader_Labsphere2019() diff --git a/colour_datasets/loaders/luo1997.py b/colour_datasets/loaders/luo1997.py index e080316..39c2f00 100644 --- a/colour_datasets/loaders/luo1997.py +++ b/colour_datasets/loaders/luo1997.py @@ -1000,7 +1000,7 @@ def load(self) -> Dict[str, ExperimentalGroupLuo1997]: ) in phases: filenames.add(visual_filename) filenames.add(colorimetric_filename) - phase = str(phase) + phase = str(phase) # noqa: PLW2901 visual_path = os.path.join( self.record.repository, "dataset", visual_filename ) @@ -1081,7 +1081,7 @@ def build_Luo1997(load: bool = True) -> DatasetLoader_Luo1997: :cite:`Luo1991`, :cite:`Luo1991a`, :cite:`Luo1993`, :cite:`Luo1997` """ - global _DATASET_LOADER_LUO1997 + global _DATASET_LOADER_LUO1997 # noqa: PLW0603 if _DATASET_LOADER_LUO1997 is None: _DATASET_LOADER_LUO1997 = DatasetLoader_Luo1997() diff --git a/colour_datasets/loaders/luo1999.py b/colour_datasets/loaders/luo1999.py index a01b8d0..ad75aa7 100644 --- a/colour_datasets/loaders/luo1999.py +++ b/colour_datasets/loaders/luo1999.py @@ -511,7 +511,7 @@ def build_Luo1999(load: bool = True) -> DatasetLoader_Luo1999: :cite:`Breneman1987b`, :cite:`Luo1999`, :cite:`McCann1976` """ - global _DATASET_LOADER_LUO1999 + global _DATASET_LOADER_LUO1999 # noqa: PLW0603 if _DATASET_LOADER_LUO1999 is None: _DATASET_LOADER_LUO1999 = DatasetLoader_Luo1999() diff --git a/colour_datasets/loaders/winquist2022.py b/colour_datasets/loaders/winquist2022.py index 9ba94b9..5bf0356 100644 --- a/colour_datasets/loaders/winquist2022.py +++ b/colour_datasets/loaders/winquist2022.py @@ -128,7 +128,7 @@ def build_Winquist2022(load: bool = True) -> DatasetLoader_Winquist2022: :cite:`Winquist2022` """ - global _DATASET_LOADER_WINQUIST2022 + global _DATASET_LOADER_WINQUIST2022 # noqa: PLW0603 if _DATASET_LOADER_WINQUIST2022 is None: _DATASET_LOADER_WINQUIST2022 = DatasetLoader_Winquist2022() diff --git a/colour_datasets/loaders/xrite2016.py b/colour_datasets/loaders/xrite2016.py index 7dc70ea..31f76a8 100644 --- a/colour_datasets/loaders/xrite2016.py +++ b/colour_datasets/loaders/xrite2016.py @@ -188,7 +188,7 @@ def build_XRite2016(load: bool = True) -> DatasetLoader_XRite2016: :cite:`X-Rite2016` """ - global _DATASET_LOADER_XRITE2016 + global _DATASET_LOADER_XRITE2016 # noqa: PLW0603 if _DATASET_LOADER_XRITE2016 is None: _DATASET_LOADER_XRITE2016 = DatasetLoader_XRite2016() diff --git a/colour_datasets/loaders/zhao2009.py b/colour_datasets/loaders/zhao2009.py index c890cf7..e1fd1c1 100644 --- a/colour_datasets/loaders/zhao2009.py +++ b/colour_datasets/loaders/zhao2009.py @@ -146,7 +146,7 @@ def build_Zhao2009(load: bool = True) -> DatasetLoader_Zhao2009: :cite:`Zhao2009` """ - global _DATASET_LOADER_JIANG2009 + global _DATASET_LOADER_JIANG2009 # noqa: PLW0603 if _DATASET_LOADER_JIANG2009 is None: _DATASET_LOADER_JIANG2009 = DatasetLoader_Zhao2009() diff --git a/colour_datasets/records/__init__.py b/colour_datasets/records/__init__.py index 0e53eb2..d321c97 100644 --- a/colour_datasets/records/__init__.py +++ b/colour_datasets/records/__init__.py @@ -38,7 +38,7 @@ def datasets() -> Community: 'Camera Spectral Sensitivity Database - Jiang et al. (2013)' """ - global _COMMUNITY + global _COMMUNITY # noqa: PLW0603 if _COMMUNITY is None: _COMMUNITY = Community.from_id(Configuration().community) diff --git a/colour_datasets/records/tests/test_zenodo.py b/colour_datasets/records/tests/test_zenodo.py index 61bff51..1bf095f 100644 --- a/colour_datasets/records/tests/test_zenodo.py +++ b/colour_datasets/records/tests/test_zenodo.py @@ -167,7 +167,7 @@ def test__repr__(self): """Test :func:`colour_datasets.records.zenodo.Record.__repr__` method.""" self.assertIsInstance( - eval( # noqa: PGH001 + eval( # noqa: PGH001, S307 repr(self._record), {}, {"Record": Record, "Configuration": Configuration}, @@ -335,7 +335,7 @@ def test__repr__(self): """Test :func:`colour_datasets.records.zenodo.Community.__repr__` method.""" self.assertIsInstance( - eval( # noqa: PGH001 + eval( # noqa: PGH001, S307 repr(self._community), {}, {"Community": Community, "Configuration": Configuration}, diff --git a/colour_datasets/records/zenodo.py b/colour_datasets/records/zenodo.py index c268d49..0eaad9b 100644 --- a/colour_datasets/records/zenodo.py +++ b/colour_datasets/records/zenodo.py @@ -413,7 +413,7 @@ def urls_download(urls: Dict): try: if use_urls_txt_file and urls_txt: urls = {} - urls_txt_file = tempfile.mktemp() + urls_txt_file = tempfile.NamedTemporaryFile(delete=False).name url_download( urls_txt["links"]["self"], urls_txt_file, @@ -466,7 +466,9 @@ def urls_download(urls: Dict): shutil.copytree(downloads_directory, deflate_directory) for filename in os.listdir(deflate_directory): - filename = os.path.join(deflate_directory, filename) + filename = os.path.join( # noqa: PLW2901 + deflate_directory, filename + ) if not os.path.isfile(filename): continue @@ -906,7 +908,7 @@ def synced(self) -> bool: False """ - return all([record.synced() for record in self._records.values()]) + return all(record.synced() for record in self._records.values()) def pull(self, use_urls_txt_file: bool = True, retries: int = 3): """ diff --git a/colour_datasets/utilities/common.py b/colour_datasets/utilities/common.py index a88a1ae..d72ea11 100644 --- a/colour_datasets/utilities/common.py +++ b/colour_datasets/utilities/common.py @@ -161,7 +161,7 @@ def url_download( miniters=1, desc=f"Downloading \"{url.split('/')[-1]}\" file", ) as progress: - urllib.request.urlretrieve( + urllib.request.urlretrieve( # noqa: S310 url, filename=filename, reporthook=progress.update_to, @@ -224,7 +224,9 @@ def json_open(url: str, retries: int = 3) -> Dict: attempt = 0 while attempt != retries: try: - return json.loads(urllib.request.urlopen(url).read()) + request = urllib.request.Request(url) + with urllib.request.urlopen(request) as response: # noqa: S310 + return json.loads(response.read()) except (urllib.error.URLError, ValueError): attempt += 1 print( # noqa: T201 diff --git a/colour_datasets/utilities/tests/test_common.py b/colour_datasets/utilities/tests/test_common.py index 5c824d1..cbebfb4 100644 --- a/colour_datasets/utilities/tests/test_common.py +++ b/colour_datasets/utilities/tests/test_common.py @@ -70,7 +70,7 @@ class TestUrlDownload(unittest.TestCase): def setUp(self): """Initialise the common tests attributes.""" - self._temporary_file = tempfile.mktemp() + self._temporary_file = tempfile.NamedTemporaryFile(delete=False).name def tearDown(self): """After tests actions.""" diff --git a/utilities/export_todo.py b/utilities/export_todo.py index 181c259..89df55e 100755 --- a/utilities/export_todo.py +++ b/utilities/export_todo.py @@ -66,7 +66,7 @@ def extract_todo_items(root_directory: str) -> dict: if not filename.endswith(".py"): continue - filename = os.path.join(root, filename) + filename = os.path.join(root, filename) # noqa: PLW2901 with codecs.open(filename, encoding="utf8") as file_handle: content = file_handle.readlines() @@ -74,7 +74,7 @@ def extract_todo_items(root_directory: str) -> dict: line_number = 1 todo_item = [] for i, line in enumerate(content): - line = line.strip() + line = line.strip() # noqa: PLW2901 if line.startswith("# TODO:"): in_todo = True line_number = i + 1 diff --git a/utilities/unicode_to_ascii.py b/utilities/unicode_to_ascii.py index 7a2050c..0fb9fea 100755 --- a/utilities/unicode_to_ascii.py +++ b/utilities/unicode_to_ascii.py @@ -52,7 +52,7 @@ def unicode_to_ascii(root_directory: str): if filename == "unicode_to_ascii.py": continue - filename = os.path.join(root, filename) + filename = os.path.join(root, filename) # noqa: PLW2901 with codecs.open(filename, encoding="utf8") as file_handle: content = file_handle.read() From f7dd13893941405abaa514621c5a6c9f563c83b4 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Tue, 29 Aug 2023 21:59:48 +1200 Subject: [PATCH 21/26] Update "README.rst" file. --- README.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 470d622..d6d6be2 100644 --- a/README.rst +++ b/README.rst @@ -156,12 +156,12 @@ Primary Dependencies **Colour - Datasets** requires various dependencies in order to run: -- `python >= 3.8, < 4 `__ +- `python >= 3.9, < 4 `__ - `cachetools `__ -- `colour-science >= 4 `__ +- `colour-science >= 4.3 `__ - `imageio >= 2, < 3 `__ -- `numpy >= 1.19, < 2 `__ -- `scipy >= 1.5, < 2 `__ +- `numpy >= 1.22, < 2 `__ +- `scipy >= 1.8, < 2 `__ - `tqdm `__ - `xlrd `__ From f4509e9cda921982e8bde1219ce50bd3242f8f9b Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Tue, 29 Aug 2023 22:00:07 +1200 Subject: [PATCH 22/26] Update "installation.rst" file. --- docs/installation.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/installation.rst b/docs/installation.rst index c2c4203..0365c0f 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -6,12 +6,12 @@ Primary Dependencies **Colour - Datasets** requires various dependencies in order to run: -- `python >= 3.8, < 4 `__ +- `python >= 3.9, < 4 `__ - `cachetools `__ -- `colour-science >= 4 `__ +- `colour-science >= 4.3 `__ - `imageio >= 2, < 3 `__ -- `numpy >= 1.19, < 2 `__ -- `scipy >= 1.5, < 2 `__ +- `numpy >= 1.22, < 2 `__ +- `scipy >= 1.8, < 2 `__ - `tqdm `__ - `xlrd `__ From 9d459ecf9d1237fe0553dc46dfb0ab2b7e4fe1d8 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Tue, 29 Aug 2023 21:59:32 +1200 Subject: [PATCH 23/26] Fix documentation build. --- docs/conf.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 81a0fa3..55c62db 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -4,8 +4,12 @@ """ import re +import sys +from pathlib import Path -import colour_datasets as package +sys.path.append(str(Path(__file__).parent.parent)) + +import colour_datasets as package # noqa: E402 basename = re.sub( "_(\\w)", lambda x: x.group(1).upper(), package.__name__.title() From cbf9fbe32facfa6340ce72e0bb3ea6741d3d5160 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Tue, 29 Aug 2023 21:59:14 +1200 Subject: [PATCH 24/26] Fix build issues. --- colour_datasets/loaders/asano2015.py | 2 -- colour_datasets/loaders/xrite2016.py | 5 +++-- colour_datasets/utilities/spreadsheet.py | 8 ++++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/colour_datasets/loaders/asano2015.py b/colour_datasets/loaders/asano2015.py index a64b10d..50376f8 100644 --- a/colour_datasets/loaders/asano2015.py +++ b/colour_datasets/loaders/asano2015.py @@ -253,11 +253,9 @@ def parse_workbook_Asano2015( (LMS_ConeFundamentals, "LMS"), ] ): - for j, degree in enumerate( [(2, "2$^\\circ$"), (10, "10$^\\circ$")] ): - sheet = book.sheet_by_index(j + (i * 2)) x = np.transpose( diff --git a/colour_datasets/loaders/xrite2016.py b/colour_datasets/loaders/xrite2016.py index 31f76a8..00ef512 100644 --- a/colour_datasets/loaders/xrite2016.py +++ b/colour_datasets/loaders/xrite2016.py @@ -146,12 +146,13 @@ def load(self) -> Dict[str, ColourChecker]: i, j = (6, 4) if len(samples_data) == 24 else (14, 10) samples = np.transpose( - np.array(samples_data).reshape([i, j, 2]), [1, 0, 2] + np.array(samples_data, dtype=object).reshape([i, j, 2]), + [1, 0, 2], ) keys, values = zip(*samples.reshape([-1, 2])) values = XYZ_to_xyY(Lab_to_XYZ(values, illuminant)) self._content[key] = ColourChecker( - key, dict(zip(keys, values)), illuminant + key, dict(zip(keys, values)), illuminant, j, i ) return self._content diff --git a/colour_datasets/utilities/spreadsheet.py b/colour_datasets/utilities/spreadsheet.py index fb7bfbc..da7237a 100644 --- a/colour_datasets/utilities/spreadsheet.py +++ b/colour_datasets/utilities/spreadsheet.py @@ -37,6 +37,11 @@ "cell_range_values", ] +# https://stackoverflow.com/questions/64264563/\ +# attributeerror-elementtree-object-has-no-attribute-getiterator-when-trying +xlrd.xlsx.ensure_elementtree_imported(False, None) +xlrd.xlsx.Element_has_iter = True + def _column_number_to_letters(number: int) -> str: """ @@ -62,8 +67,7 @@ def _column_number_to_letters(number: int) -> str: Examples -------- - # Doctests skip for Python 2.x compatibility. - >>> _column_number_to_letters(128) # doctest: +SKIP + >>> _column_number_to_letters(128) 'DX' """ From 3a2848695eb3d901c09040d0f89ccf152375b235 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Wed, 30 Aug 2023 22:16:35 +1200 Subject: [PATCH 25/26] Update "TODO.rst" file. --- TODO.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO.rst b/TODO.rst index 9ff2fa4..fbcc4ac 100644 --- a/TODO.rst +++ b/TODO.rst @@ -10,6 +10,6 @@ About ----- | **Colour - Datasets** by Colour Developers -| Copyright 2019 Colour Developers – `colour-developers@colour-science.org `__ +| Copyright 2019 Colour Developers - `colour-developers@colour-science.org `__ | This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause | `https://github.com/colour-science/colour-datasets `__ From 5c986ccc9492686b21b74a4a2e941f8bfa665d9a Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Wed, 30 Aug 2023 22:16:42 +1200 Subject: [PATCH 26/26] Raise package version to 0.2.2. --- colour_datasets/__init__.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/colour_datasets/__init__.py b/colour_datasets/__init__.py index 41d5bd5..c41c55d 100644 --- a/colour_datasets/__init__.py +++ b/colour_datasets/__init__.py @@ -53,7 +53,7 @@ __major_version__ = "0" __minor_version__ = "2" -__change_version__ = "1" +__change_version__ = "2" __version__ = ".".join( (__major_version__, __minor_version__, __change_version__) ) diff --git a/pyproject.toml b/pyproject.toml index 43f69ad..5b99e80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "colour-datasets" -version = "0.2.1" +version = "0.2.2" description = "Colour science datasets for use with Colour" license = "BSD-3-Clause" authors = [ "Colour Developers " ]