Skip to content

Commit 559532a

Browse files
committed
Fix various static typing issues.
1 parent 26ccf60 commit 559532a

File tree

8 files changed

+15
-28
lines changed

8 files changed

+15
-28
lines changed

colour/examples/contrast/examples_contrast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def maximise_spatial_frequency(L: ArrayLike) -> NDArrayFloat:
121121
),
122122
samples=L,
123123
log_x=10,
124-
**{
124+
**{ # pyright: ignore
125125
"title": "Examples of HVS Minimum Detectable Contrast Characteristics",
126126
"x_label": "Luminance ($cd/m^2$)",
127127
"y_label": "Minimum Detectable Contrast",

colour/io/luts/lut.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,11 @@ def __init__(
157157
self.name = optional(name, self._name)
158158
self._dimensions = optional(dimensions, 0)
159159
self._table: NDArrayFloat = self.linear_table(
160-
cast(ArrayLike, optional(size, 0)),
161-
cast(ArrayLike, optional(domain, np.array([]))),
160+
optional(size, 0), optional(domain, np.array([]))
162161
)
163-
self.table = cast(ArrayLike, optional(table, self._table))
162+
self.table = optional(table, self._table)
164163
self._domain: NDArrayFloat = np.array([])
165-
self.domain = cast(ArrayLike, optional(domain, self._domain))
164+
self.domain = optional(domain, self._domain)
166165
self._comments: list = []
167166
self.comments = cast(list, optional(comments, self._comments))
168167

colour/io/luts/operator.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
List,
2121
NDArrayFloat,
2222
Sequence,
23-
cast,
2423
)
2524
from colour.utilities import (
2625
as_float_array,
@@ -249,9 +248,9 @@ def __init__(
249248
super().__init__(*args, **kwargs)
250249

251250
self._matrix: NDArrayFloat = np.diag(ones(4))
252-
self.matrix = cast(ArrayLike, optional(matrix, self._matrix))
251+
self.matrix = optional(matrix, self._matrix)
253252
self._offset: NDArrayFloat = zeros(4)
254-
self.offset = cast(ArrayLike, optional(offset, self._offset))
253+
self.offset = optional(offset, self._offset)
255254

256255
@property
257256
def matrix(self) -> NDArrayFloat:

colour/io/tabular.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def read_spectral_data_from_csv_file(
146146
if transpose:
147147
os.unlink(transposed_csv_file.name)
148148

149-
return {name: data[name] for name in data.dtype.names} # pyright: ignore
149+
return {name: data[name] for name in data.dtype.names}
150150

151151

152152
def read_sds_from_csv_file(

colour/plotting/blindness.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
Dict,
2020
Literal,
2121
Tuple,
22-
cast,
2322
)
2423
from colour.plotting import CONSTANTS_COLOUR_STYLE, plot_image, override_style
2524
from colour.utilities import optional
@@ -89,9 +88,7 @@ def plot_cvd_simulation_Machado2009(
8988
:alt: plot_cvd_simulation_Machado2009
9089
"""
9190

92-
M_a = cast(
93-
ArrayLike, optional(M_a, matrix_cvd_Machado2009(deficiency, severity))
94-
)
91+
M_a = optional(M_a, matrix_cvd_Machado2009(deficiency, severity))
9592

9693
settings: Dict[str, Any] = {
9794
"text_kwargs": {

colour/plotting/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1527,7 +1527,7 @@ def plot_multi_functions(
15271527
else:
15281528
plotting_function = axes.plot
15291529

1530-
samples = cast(ArrayLike, optional(samples, np.linspace(0, 1, 1000)))
1530+
samples = optional(samples, np.linspace(0, 1, 1000))
15311531

15321532
for i, (_name, function) in enumerate(functions.items()):
15331533
plotting_function(

colour/plotting/diagrams.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -438,11 +438,8 @@ def plot_chromaticity_diagram_colours(
438438

439439
_figure, axes = artist(**settings)
440440

441-
diagram_colours = cast(
442-
ArrayLike,
443-
optional(
444-
diagram_colours, HEX_to_RGB(CONSTANTS_COLOUR_STYLE.colour.average)
445-
),
441+
diagram_colours = optional(
442+
diagram_colours, HEX_to_RGB(CONSTANTS_COLOUR_STYLE.colour.average)
446443
)
447444

448445
cmfs = cast(

colour/plotting/section.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
Real,
3434
Sequence,
3535
Tuple,
36-
Union,
3736
cast,
3837
)
3938
from colour.models import (
@@ -203,11 +202,8 @@ def plot_hull_section_colours(
203202

204203
_figure, axes = artist(**settings)
205204

206-
section_colours = cast(
207-
ArrayLike,
208-
optional(
209-
section_colours, HEX_to_RGB(CONSTANTS_COLOUR_STYLE.colour.average)
210-
),
205+
section_colours = optional(
206+
section_colours, HEX_to_RGB(CONSTANTS_COLOUR_STYLE.colour.average)
211207
)
212208

213209
convert_kwargs = optional(convert_kwargs, {})
@@ -397,9 +393,8 @@ def plot_hull_section_contour(
397393

398394
hull = hull.copy()
399395

400-
contour_colours = cast(
401-
Union[ArrayLike, str],
402-
optional(contour_colours, CONSTANTS_COLOUR_STYLE.colour.dark),
396+
contour_colours = optional(
397+
contour_colours, CONSTANTS_COLOUR_STYLE.colour.dark
403398
)
404399

405400
settings: Dict[str, Any] = {"uniform": True}

0 commit comments

Comments
 (0)