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/.github/workflows/continuous-integration-documentation.yml b/.github/workflows/continuous-integration-documentation.yml index 2165290..cc10aa0 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 @@ -37,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/.github/workflows/continuous-integration-quality-unit-tests.yml b/.github/workflows/continuous-integration-quality-unit-tests.yml index f7e514a..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 @@ -48,7 +50,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/.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 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/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..d6d6be2 100644 --- a/README.rst +++ b/README.rst @@ -24,11 +24,11 @@ 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 -`New BSD License `__ terms. +`BSD-3-Clause `__ terms. .. contents:: **Table of Contents** :backlinks: none @@ -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.9, < 4 `__ +- `cachetools `__ +- `colour-science >= 4.3 `__ +- `imageio >= 2, < 3 `__ +- `numpy >= 1.22, < 2 `__ +- `scipy >= 1.8, < 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 ---------------- @@ -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 9490326..41d5bd5 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 ----------- @@ -18,7 +18,7 @@ import contextlib import numpy as np import os -import subprocess # nosec +import subprocess import colour @@ -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" @@ -60,8 +60,8 @@ try: _version = ( - subprocess.check_output( # nosec - ["git", "describe"], + subprocess.check_output( + ["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/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..50376f8 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" @@ -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( @@ -336,7 +334,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 7bea8b2..3528974 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" @@ -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 24db05f..9cadfba 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 @@ -37,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" @@ -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" @@ -1567,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 978752c..db5a2dc 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" @@ -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 fb1b571..210367a 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" @@ -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 5cf68c6..ead0169 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" @@ -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 5a81afc..ee90134 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" @@ -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 1aa7b37..5b7cca1 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" @@ -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/kuopio.py b/colour_datasets/loaders/kuopio.py index 6b011b3..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 @@ -52,7 +53,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" @@ -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/labsphere2019.py b/colour_datasets/loaders/labsphere2019.py index e25e3aa..3cf6396 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" @@ -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 387f14e..39c2f00 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" @@ -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 aefefa9..ad75aa7 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" @@ -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, @@ -529,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/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..5bf0356 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" @@ -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 38c2045..00ef512 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" @@ -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 @@ -188,7 +189,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 14b6e07..e1fd1c1 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" @@ -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/configuration.py b/colour_datasets/records/configuration.py index 38c8389..a9313be 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" @@ -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/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..1bf095f 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" @@ -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 4028442..0eaad9b 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" @@ -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 6e172c1..d72ea11 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" @@ -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/spreadsheet.py b/colour_datasets/utilities/spreadsheet.py index 7a24dd2..da7237a 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" @@ -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' """ diff --git a/colour_datasets/utilities/tests/test_common.py b/colour_datasets/utilities/tests/test_common.py index c950fe2..cbebfb4 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" @@ -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/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/conf.py b/docs/conf.py index f3d9133..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() @@ -177,21 +181,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) diff --git a/docs/index.rst b/docs/index.rst index 4934a2f..9bad645 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -5,11 +5,11 @@ 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 -`New BSD License `__ terms. +`BSD-3-Clause `__ terms. .. sectnum:: @@ -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 ---------------- @@ -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/docs/installation.rst b/docs/installation.rst index dda4a14..0365c0f 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.9, < 4 `__ +- `cachetools `__ +- `colour-science >= 4.3 `__ +- `imageio >= 2, < 3 `__ +- `numpy >= 1.22, < 2 `__ +- `scipy >= 1.8, < 2 `__ +- `tqdm `__ +- `xlrd `__ Pypi ---- 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 434c43f..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.20, < 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 17940bd..9073053 100644 --- a/tasks.py +++ b/tasks.py @@ -20,11 +20,12 @@ 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" -__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" @@ -209,9 +210,9 @@ def tests(ctx: Context): message_box('Running "Pytest"...') ctx.run( "pytest " - "--disable-warnings " "--doctest-modules " f"--ignore={PYTHON_PACKAGE_NAME}/examples " + f"--cov={PYTHON_PACKAGE_NAME} " f"{PYTHON_PACKAGE_NAME}" ) @@ -308,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" ) @@ -328,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/*") @@ -411,7 +364,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}", @@ -432,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: @@ -456,14 +408,14 @@ 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( 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!" diff --git a/utilities/export_todo.py b/utilities/export_todo.py index e4cd76a..89df55e 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 \ `__ @@ -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 @@ -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..0fb9fea 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" @@ -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() @@ -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"))