Skip to content

Commit 415b80a

Browse files
committed
Merge branch 'feature/pyright' into develop
2 parents 94f88ba + 2461a82 commit 415b80a

29 files changed

+174
-184
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ is available to guide the process: https://www.colour-science.org/contributing/.
1515
**Code Style and Quality**
1616

1717
- [ ] Unit tests have been implemented and passed.
18-
- [ ] Mypy static checking has been run and passed.
18+
- [ ] Pyright static checking has been run and passed.
1919
- [ ] Pre-commit hooks have been run and passed.
2020

2121
<!-- The unit tests can be invoked with `poetry run invoke tests` -->
22-
<!-- Mypy can be started with `dmypy run -- --show-error-codes --warn-unused-ignores --warn-redundant-casts --install-types --non-interactive -p colour-datasets` -->
22+
<!-- Pyright can be started with `pyright --skipunannotated` -->
2323

2424
**Documentation**
2525

.github/workflows/continuous-integration-static-type-checking.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
pip install -r requirements.txt
2727
- name: Static Type Checking
2828
run: |
29-
mypy --install-types --non-interactive --show-error-codes --warn-unused-ignores --warn-redundant-casts $CI_PACKAGE
29+
pyright --skipunannotated

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
*.pyo
44
.DS_Store
55
.coverage
6-
.dmypy.json
76
.fleet
87
.idea
98
.ipynb_checkpoints
10-
.mypy_cache
119
.sandbox
1210
.vs
1311
.vscode

colour_datasets/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
except Exception:
7171
_version = __version__
7272

73-
colour.utilities.ANCILLARY_COLOUR_SCIENCE_PACKAGES[
73+
colour.utilities.ANCILLARY_COLOUR_SCIENCE_PACKAGES[ # pyright: ignore
7474
"colour-datasets"
7575
] = _version
7676

colour_datasets/loaders/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import sys
44

5-
from colour.hints import Any, Boolean, Integer, Union
5+
from colour.hints import Any, Union
66
from colour.utilities import CanonicalMapping, warning
77

88
from colour_datasets.records import datasets
@@ -124,7 +124,7 @@
124124

125125
del _module, _export
126126

127-
_HAS_TITLE_KEYS: Boolean = False
127+
_HAS_TITLE_KEYS: bool = False
128128
"""
129129
Whether the :attr:`colour_datasets.loaders.DATASET_LOADERS` attribute has
130130
been updated with dataset titles. This variable is used in the one time
@@ -133,7 +133,7 @@
133133
"""
134134

135135

136-
def load(dataset: Union[Integer, str]) -> Any:
136+
def load(dataset: Union[int, str]) -> Any:
137137
"""
138138
Load given dataset: The dataset is pulled locally, i.e. synced if required
139139
and then its data is loaded.

colour_datasets/loaders/asano2015.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
XYZ_ColourMatchingFunctions,
2727
LMS_ConeFundamentals,
2828
)
29-
from colour.hints import Boolean, Dict, NDArray, Optional, Tuple
29+
from colour.hints import Dict, NDArrayFloat, Optional
3030
from colour.utilities import as_float_array, tstack
3131

3232
from colour_datasets.loaders import AbstractDatasetLoader
@@ -82,7 +82,7 @@ def __new__(
8282
XYZ_10: XYZ_ColourMatchingFunctions,
8383
LMS_2: LMS_ConeFundamentals,
8484
LMS_10: LMS_ConeFundamentals,
85-
parameters: NDArray,
85+
parameters: NDArrayFloat,
8686
others: Optional[Dict] = None,
8787
):
8888
"""
@@ -217,7 +217,7 @@ def load(self) -> Dict[str, Specification_Asano2015]:
217217

218218
@staticmethod
219219
def parse_workbook_Asano2015(
220-
workbook: str, template: str, observers: Tuple = (1, 10)
220+
workbook: str, template: str, observers: tuple = (1, 10)
221221
) -> Dict[str, Dict]:
222222
"""
223223
Parse given *Asano (2015)* *Observer Function Database* workbook.
@@ -317,7 +317,7 @@ def parse_workbook_Asano2015(
317317
"""
318318

319319

320-
def build_Asano2015(load: Boolean = True) -> DatasetLoader_Asano2015:
320+
def build_Asano2015(load: bool = True) -> DatasetLoader_Asano2015:
321321
"""
322322
Singleton factory that the builds *Asano (2015)*
323323
*Observer Function Database* dataset loader.

colour_datasets/loaders/brendel2020.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import os
2222

2323
from colour import LinearInterpolator, SpectralShape, SpectralDistribution
24-
from colour.hints import Boolean, Dict, Optional
24+
from colour.hints import Dict, Optional
2525
from colour.utilities import as_int
2626

2727
from colour_datasets.loaders import AbstractDatasetLoader
@@ -115,7 +115,7 @@ def load(self) -> Dict[str, SpectralDistribution]:
115115
"""
116116

117117

118-
def build_Brendel2020(load: Boolean = True) -> DatasetLoader_Brendel2020:
118+
def build_Brendel2020(load: bool = True) -> DatasetLoader_Brendel2020:
119119
"""
120120
Singleton factory that builds the *Brendel (2020)*
121121
*Measured Commercial LED Spectra* dataset loader.

colour_datasets/loaders/dyer2017.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
from colour.continuous import MultiSignals, Signal
2525
from colour.hints import (
2626
Any,
27-
Boolean,
2827
Dict,
29-
Floating,
3028
Literal,
3129
Optional,
3230
Type,
@@ -569,8 +567,8 @@ def __init__(
569567
transmission_geometry: Optional[
570568
Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"]
571569
] = None,
572-
bandwidth_FWHM: Optional[Floating] = None,
573-
bandwidth_corrected: Optional[Boolean] = None,
570+
bandwidth_FWHM: Optional[float] = None,
571+
bandwidth_corrected: Optional[bool] = None,
574572
) -> None:
575573
super().__init__()
576574

@@ -616,9 +614,9 @@ def __init__(
616614
Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"]
617615
] = None
618616
self.transmission_geometry = transmission_geometry
619-
self._bandwidth_FWHM: Optional[Floating] = None
617+
self._bandwidth_FWHM: Optional[float] = None
620618
self.bandwidth_FWHM = bandwidth_FWHM
621-
self._bandwidth_corrected: Optional[Boolean] = None
619+
self._bandwidth_corrected: Optional[bool] = None
622620
self.bandwidth_corrected = bandwidth_corrected
623621

624622
@property
@@ -847,7 +845,7 @@ def transmission_geometry(
847845
self._transmission_geometry = value
848846

849847
@property
850-
def bandwidth_FWHM(self) -> Optional[Floating]:
848+
def bandwidth_FWHM(self) -> Optional[float]:
851849
"""
852850
Getter and setter property for the full-width half-maximum bandwidth.
853851
@@ -865,7 +863,7 @@ def bandwidth_FWHM(self) -> Optional[Floating]:
865863
return self._bandwidth_FWHM
866864

867865
@bandwidth_FWHM.setter
868-
def bandwidth_FWHM(self, value: Optional[Floating]):
866+
def bandwidth_FWHM(self, value: Optional[float]):
869867
"""Setter for the **self.bandwidth_FWHM** property."""
870868

871869
if value is not None:
@@ -877,7 +875,7 @@ def bandwidth_FWHM(self, value: Optional[Floating]):
877875
self._bandwidth_FWHM = value
878876

879877
@property
880-
def bandwidth_corrected(self) -> Optional[Boolean]:
878+
def bandwidth_corrected(self) -> Optional[bool]:
881879
"""
882880
Getter and setter property for whether bandwidth correction has been
883881
applied to the measured data.
@@ -896,7 +894,7 @@ def bandwidth_corrected(self) -> Optional[Boolean]:
896894
return self._bandwidth_corrected
897895

898896
@bandwidth_corrected.setter
899-
def bandwidth_corrected(self, value: Optional[Boolean]):
897+
def bandwidth_corrected(self, value: Optional[bool]):
900898
"""Setter for the **self.bandwidth_corrected** property."""
901899

902900
if value is not None:
@@ -1077,8 +1075,8 @@ def __init__(
10771075
transmission_geometry: Optional[
10781076
Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"]
10791077
] = None,
1080-
bandwidth_FWHM: Optional[Floating] = None,
1081-
bandwidth_corrected: Optional[Boolean] = None,
1078+
bandwidth_FWHM: Optional[float] = None,
1079+
bandwidth_corrected: Optional[bool] = None,
10821080
) -> None:
10831081
super().__init__()
10841082

@@ -1124,9 +1122,9 @@ def __init__(
11241122
Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"]
11251123
] = None
11261124
self.transmission_geometry = transmission_geometry
1127-
self._bandwidth_FWHM: Optional[Floating] = None
1125+
self._bandwidth_FWHM: Optional[float] = None
11281126
self.bandwidth_FWHM = bandwidth_FWHM
1129-
self._bandwidth_corrected: Optional[Boolean] = None
1127+
self._bandwidth_corrected: Optional[bool] = None
11301128
self.bandwidth_corrected = bandwidth_corrected
11311129

11321130
@property
@@ -1355,7 +1353,7 @@ def transmission_geometry(
13551353
self._transmission_geometry = value
13561354

13571355
@property
1358-
def bandwidth_FWHM(self) -> Optional[Floating]:
1356+
def bandwidth_FWHM(self) -> Optional[float]:
13591357
"""
13601358
Getter and setter property for the full-width half-maximum bandwidth.
13611359
@@ -1373,7 +1371,7 @@ def bandwidth_FWHM(self) -> Optional[Floating]:
13731371
return self._bandwidth_FWHM
13741372

13751373
@bandwidth_FWHM.setter
1376-
def bandwidth_FWHM(self, value: Optional[Floating]):
1374+
def bandwidth_FWHM(self, value: Optional[float]):
13771375
"""Setter for the **self.bandwidth_FWHM** property."""
13781376

13791377
if value is not None:
@@ -1385,7 +1383,7 @@ def bandwidth_FWHM(self, value: Optional[Floating]):
13851383
self._bandwidth_FWHM = value
13861384

13871385
@property
1388-
def bandwidth_corrected(self) -> Optional[Boolean]:
1386+
def bandwidth_corrected(self) -> Optional[bool]:
13891387
"""
13901388
Getter and setter property for whether bandwidth correction has been
13911389
applied to the measured data.
@@ -1404,7 +1402,7 @@ def bandwidth_corrected(self) -> Optional[Boolean]:
14041402
return self._bandwidth_corrected
14051403

14061404
@bandwidth_corrected.setter
1407-
def bandwidth_corrected(self, value: Optional[Boolean]):
1405+
def bandwidth_corrected(self, value: Optional[bool]):
14081406
"""Setter for the **self.bandwidth_corrected** property."""
14091407

14101408
if value is not None:
@@ -1566,7 +1564,7 @@ def load(
15661564
"""
15671565

15681566

1569-
def build_Dyer2017(load: Boolean = True) -> DatasetLoader_Dyer2017:
1567+
def build_Dyer2017(load: bool = True) -> DatasetLoader_Dyer2017:
15701568
"""
15711569
Singleton factory that builds the *Dyer et al. (2017)*
15721570
*RAW to ACES Utility Data* dataset loader.

colour_datasets/loaders/ebner1998.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import os
2424
from collections import namedtuple
2525

26-
from colour.hints import Boolean, Dict, Integer, NDArray, Optional
26+
from colour.hints import Dict, NDArrayFloat, Optional
2727
from colour.utilities import as_float_array
2828

2929
from colour_datasets.loaders import AbstractDatasetLoader
@@ -98,7 +98,7 @@ def __init__(self) -> None:
9898

9999
def load(
100100
self,
101-
) -> Dict[str, Dict[Integer, ConstantPerceivedHueColourMatches_Ebner1998]]:
101+
) -> Dict[str, Dict[int, ConstantPerceivedHueColourMatches_Ebner1998]]:
102102
"""
103103
Sync, parse, convert and return the *Ebner and Fairchild (1998)*
104104
*Constant Perceived-Hue Data* dataset content.
@@ -128,7 +128,7 @@ def load(
128128
self.record.repository, "dataset", "Ebner_Constant_Hue_Data.txt"
129129
)
130130

131-
def _parse_float_values(data: str) -> NDArray:
131+
def _parse_float_values(data: str) -> NDArrayFloat:
132132
"""Parse float values from given data."""
133133

134134
values = np.reshape(
@@ -173,7 +173,7 @@ def _parse_float_values(data: str) -> NDArray:
173173
"""
174174

175175

176-
def build_Ebner1998(load: Boolean = True) -> DatasetLoader_Ebner1998:
176+
def build_Ebner1998(load: bool = True) -> DatasetLoader_Ebner1998:
177177
"""
178178
Singleton factory that builds the *Ebner and Fairchild (1998)*
179179
*Constant Perceived-Hue Data* dataset loader.

colour_datasets/loaders/hung1995.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from collections import namedtuple
2424

2525
from colour import CCS_ILLUMINANTS, xy_to_XYZ, xyY_to_XYZ
26-
from colour.hints import Boolean, Dict, Optional
26+
from colour.hints import Dict, Optional
2727

2828
from colour_datasets.loaders import AbstractDatasetLoader
2929
from colour_datasets.records import datasets
@@ -216,7 +216,7 @@ def load(
216216
"""
217217

218218

219-
def build_Hung1995(load: Boolean = True) -> DatasetLoader_Hung1995:
219+
def build_Hung1995(load: bool = True) -> DatasetLoader_Hung1995:
220220
"""
221221
Singleton factory that builds the *Hung and Berns (1995)*
222222
*Constant Hue Loci Data* dataset loader.

0 commit comments

Comments
 (0)