Skip to content

Commit

Permalink
Merge branch 'feature/v0.2.1' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Dec 3, 2022
2 parents 2599def + 5bb2e68 commit aaa4a88
Show file tree
Hide file tree
Showing 44 changed files with 269 additions and 238 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/continuous-integration-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ jobs:
name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
strategy:
matrix:
os: [ubuntu-20.04]
python-version: [3.8]
os: [ubuntu-22.04]
python-version: [3.11]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- name: Environment Variables
run: |
echo "CI_PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
echo "CI_PACKAGE=colour" >> $GITHUB_ENV
echo "CI_PACKAGE=colour_datasets" >> $GITHUB_ENV
echo "CI_SHA=${{ github.sha }}" >> $GITHUB_ENV
echo "MPLBACKEND=AGG" >> $GITHUB_ENV
echo "COLOUR_SCIENCE__DOCUMENTATION_BUILD=True" >> $GITHUB_ENV
Expand All @@ -31,8 +31,7 @@ jobs:
sudo apt-get --yes install latexmk texlive-full
- name: Install Poetry
run: |
curl -L https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -o get-poetry.py
python get-poetry.py
curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 -
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
shell: bash
- name: Install Package Dependencies
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/continuous-integration-quality-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
strategy:
matrix:
os: [ubuntu-20.04]
python-version: [3.8]
os: [ubuntu-22.04]
python-version: [3.11]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -20,14 +20,17 @@ jobs:
echo "CI_SHA=${{ github.sha }}" >> $GITHUB_ENV
echo "COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }}" >> $GITHUB_ENV
shell: bash
- name: Set up Python 3.9 for Pre-Commit
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
curl -L https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -o get-poetry.py
python get-poetry.py --version 1.1.12
curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 -
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
shell: bash
- name: Install Package Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,22 @@ jobs:
strategy:
matrix:
os: [macOS-latest]
python-version: [3.9]
python-version: [3.11]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- name: Environment Variables
run: |
echo "CI_PACKAGE=colour" >> $GITHUB_ENV
echo "CI_PACKAGE=colour_datasets" >> $GITHUB_ENV
shell: bash
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Static Type Checking
- name: Install Package Dependencies
run: |
pip install -r requirements.txt
mypy --install-types --non-interactive --show-error-codes --warn-unused-ignores --warn-redundant-casts -p $CI_PACKAGE
- name: Static Type Checking
run: |
mypy --install-types --non-interactive --show-error-codes --warn-unused-ignores --warn-redundant-casts $CI_PACKAGE
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
.DS_Store
.coverage
.dmypy.json
.fleet
.idea
.ipynb_checkpoints
.mypy_cache
.vscode
.sandbox
.vs
.vscode

__pycache__

Expand Down
17 changes: 11 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.37.3
rev: v3.2.2
hooks:
- id: pyupgrade
args: [--py38-plus]
args: [--py39-plus]
- repo: https://github.com/ikamensh/flynt/
rev: '0.76'
rev: '0.77'
hooks:
- id: flynt
- repo: https://github.com/psf/black
rev: 22.6.0
rev: 22.10.0
hooks:
- id: black
language_version: python3.8
language_version: python3.9
- repo: https://github.com/keewis/blackdoc
rev: v0.3.8
hooks:
- id: blackdoc
language_version: python3.9
- repo: https://github.com/PyCQA/flake8
rev: 5.0.3
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/pycqa/pydocstyle
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-20.04
tools:
python: "3.8"
python: "3.11"

sphinx:
configuration: docs/conf.py
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Contributors
Development & Technical Support
-------------------------------

- **Thomas Mansencal**, *Lead Pipeline Developer @ WetaFX*
- **Thomas Mansencal**, *Technology Supervisor @ Wētā FX*

Project coordination, overall development.

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ A dataset is loaded by using its unique number: *3245895*:

.. code-block:: python
>>> print(colour_datasets.load('3245895').keys())
>>> print(colour_datasets.load("3245895").keys())
::

Expand All @@ -142,7 +142,7 @@ Alternatively, a dataset can be loaded by using its full title:

.. code-block:: python
>>> print(colour_datasets.load('3245895').keys())
>>> print(colour_datasets.load("3245895").keys())
odict_keys(['ColorChecker24 - After November 2014', 'ColorChecker24 - Before November 2014', 'ColorCheckerSG - After November 2014', 'ColorCheckerSG - Before November 2014'])
User Guide
Expand Down
2 changes: 1 addition & 1 deletion colour_datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

__major_version__ = "0"
__minor_version__ = "2"
__change_version__ = "0"
__change_version__ = "1"
__version__ = ".".join(
(__major_version__, __minor_version__, __change_version__)
)
Expand Down
14 changes: 8 additions & 6 deletions colour_datasets/loaders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys

from colour.hints import Any, Boolean, Integer, Union
from colour.utilities import CaseInsensitiveMapping, warning
from colour.utilities import CanonicalMapping, warning

from colour_datasets.records import datasets

Expand Down Expand Up @@ -83,7 +83,7 @@
"build_Zhao2009",
]

DATASET_LOADERS: CaseInsensitiveMapping = CaseInsensitiveMapping(
DATASET_LOADERS: CanonicalMapping = CanonicalMapping(
{
DatasetLoader_Asano2015.ID: build_Asano2015,
DatasetLoader_Brendel2020.ID: build_Brendel2020,
Expand Down Expand Up @@ -150,11 +150,13 @@ def load(dataset: Union[Integer, str]) -> Any:
Examples
--------
>>> len(load('3245883').keys()) # doctest: +SKIP
>>> len(load("3245883").keys()) # doctest: +SKIP
28
>>> len(load(
... 'Camera Spectral Sensitivity Database - '
... 'Jiang et al. (2013)').keys())
>>> len(
... load(
... "Camera Spectral Sensitivity Database - " "Jiang et al. (2013)"
... ).keys()
... )
... # doctest: +SKIP
28
"""
Expand Down
2 changes: 1 addition & 1 deletion colour_datasets/loaders/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class AbstractDatasetLoader(ABC):
ID: str = "Undefined"
"""Dataset record id, i.e. the *Zenodo* record number."""

def __init__(self, record: Record):
def __init__(self, record: Record) -> None:
self._record: Record = record
self._content: Optional[Any] = None

Expand Down
5 changes: 3 additions & 2 deletions colour_datasets/loaders/asano2015.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class DatasetLoader_Asano2015(AbstractDatasetLoader):
ID: str = "3252742"
"""Dataset record id, i.e. the *Zenodo* record number."""

def __init__(self):
def __init__(self) -> None:
super().__init__(datasets()[DatasetLoader_Asano2015.ID])

def load(self) -> Dict[str, Specification_Asano2015]:
Expand All @@ -138,6 +138,7 @@ def load(self) -> Dict[str, Specification_Asano2015]:
>>> dataset = DatasetLoader_Asano2015()
>>> with suppress_stdout():
... dataset.load()
...
>>> len(dataset.content.keys())
2
"""
Expand Down Expand Up @@ -282,7 +283,7 @@ def parse_workbook_Asano2015(
rgb,
domain=wavelengths,
name=template.format(degree[0], observer, cmfs[1]),
strict_name=template.format(
display_name=template.format(
degree[0], observer, cmfs[1]
),
)
Expand Down
3 changes: 2 additions & 1 deletion colour_datasets/loaders/brendel2020.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class DatasetLoader_Brendel2020(AbstractDatasetLoader):
ID: str = "4051012"
"""Dataset record id, i.e. the *Zenodo* record number."""

def __init__(self):
def __init__(self) -> None:
super().__init__(datasets()[DatasetLoader_Brendel2020.ID])

def load(self) -> Dict[str, SpectralDistribution]:
Expand All @@ -80,6 +80,7 @@ def load(self) -> Dict[str, SpectralDistribution]:
>>> dataset = DatasetLoader_Brendel2020()
>>> with suppress_stdout():
... dataset.load()
...
>>> len(dataset.content.keys())
29
"""
Expand Down
15 changes: 8 additions & 7 deletions colour_datasets/loaders/dyer2017.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def __init__(
comments: Optional[str] = None,
license: Optional[str] = None,
**kwargs: Any,
):
) -> None:

self._schema_version: Optional[str] = None
self.schema_version = schema_version
Expand Down Expand Up @@ -571,7 +571,7 @@ def __init__(
] = None,
bandwidth_FWHM: Optional[Floating] = None,
bandwidth_corrected: Optional[Boolean] = None,
):
) -> None:
super().__init__()

self._path: Optional[str] = None
Expand Down Expand Up @@ -959,7 +959,7 @@ def read(self) -> SpectralDistribution:
elif "type" in self._header._kwargs:
self.name = self._header._kwargs["type"]

self.strict_name = self.name
self.display_name = self.name

return self
else:
Expand Down Expand Up @@ -1079,7 +1079,7 @@ def __init__(
] = None,
bandwidth_FWHM: Optional[Floating] = None,
bandwidth_corrected: Optional[Boolean] = None,
):
) -> None:
super().__init__()

self._path: Optional[str] = None
Expand Down Expand Up @@ -1468,8 +1468,8 @@ def read(self) -> MultiSpectralDistributions:
elif "type" in self._header._kwargs:
self.name = self._header._kwargs["type"]

self.strict_name = self.name
self.strict_labels = self.labels
self.display_name = self.name
self.display_labels = self.labels

return self
else:
Expand Down Expand Up @@ -1500,7 +1500,7 @@ class DatasetLoader_Dyer2017(AbstractDatasetLoader):
ID: str = "3372171"
"""Dataset record id, i.e. the *Zenodo* record number."""

def __init__(self):
def __init__(self) -> None:
super().__init__(datasets()[DatasetLoader_Dyer2017.ID])

def load(
Expand Down Expand Up @@ -1529,6 +1529,7 @@ def load(
>>> dataset = DatasetLoader_Dyer2017()
>>> with suppress_stdout():
... dataset.load()
...
>>> len(dataset.content.keys())
4
"""
Expand Down
3 changes: 2 additions & 1 deletion colour_datasets/loaders/ebner1998.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class DatasetLoader_Ebner1998(AbstractDatasetLoader):
ID: str = "3362536"
"""Dataset record id, i.e. the *Zenodo* record number."""

def __init__(self):
def __init__(self) -> None:
super().__init__(datasets()[DatasetLoader_Ebner1998.ID])

def load(
Expand All @@ -115,6 +115,7 @@ def load(
>>> dataset = DatasetLoader_Ebner1998()
>>> with suppress_stdout():
... dataset.load()
...
>>> len(dataset.content.keys())
1
"""
Expand Down
3 changes: 2 additions & 1 deletion colour_datasets/loaders/hung1995.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class DatasetLoader_Hung1995(AbstractDatasetLoader):
ID: str = "3367463"
"""Dataset record id, i.e. the *Zenodo* record number."""

def __init__(self):
def __init__(self) -> None:
super().__init__(datasets()[DatasetLoader_Hung1995.ID])

def load(
Expand All @@ -113,6 +113,7 @@ def load(
>>> dataset = DatasetLoader_Hung1995()
>>> with suppress_stdout():
... dataset.load()
...
>>> len(dataset.content.keys())
6
"""
Expand Down
3 changes: 2 additions & 1 deletion colour_datasets/loaders/jakob2019.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class DatasetLoader_Jakob2019(AbstractDatasetLoader):
ID: str = "4050598"
"""Dataset record id, i.e. the *Zenodo* record number."""

def __init__(self):
def __init__(self) -> None:
super().__init__(datasets()[DatasetLoader_Jakob2019.ID])

def load(self) -> Dict[str, LUT3D_Jakob2019]:
Expand All @@ -81,6 +81,7 @@ def load(self) -> Dict[str, LUT3D_Jakob2019]:
>>> dataset = DatasetLoader_Jakob2019()
>>> with suppress_stdout():
... dataset.load()
...
>>> len(dataset.content.keys())
4
"""
Expand Down
3 changes: 2 additions & 1 deletion colour_datasets/loaders/jiang2013.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class DatasetLoader_Jiang2013(AbstractDatasetLoader):
ID: str = "3245883"
"""Dataset record id, i.e. the *Zenodo* record number."""

def __init__(self):
def __init__(self) -> None:
super().__init__(datasets()[DatasetLoader_Jiang2013.ID])

def load(self) -> Dict[str, RGB_CameraSensitivities]:
Expand All @@ -86,6 +86,7 @@ def load(self) -> Dict[str, RGB_CameraSensitivities]:
>>> dataset = DatasetLoader_Jiang2013()
>>> with suppress_stdout():
... dataset.load()
...
>>> len(dataset.content.keys())
28
"""
Expand Down
Loading

0 comments on commit aaa4a88

Please sign in to comment.