Skip to content

Commit

Permalink
Use Ruff format.
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Jan 30, 2024
1 parent 7ac9710 commit 51b59f3
Show file tree
Hide file tree
Showing 19 changed files with 190 additions and 335 deletions.
10 changes: 3 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,14 @@ repos:
- id: flynt
args: [--verbose]
- repo: https://github.com/PyCQA/isort
rev: "5.12.0"
rev: "5.13.2"
hooks:
- id: isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.6"
rev: "v0.1.14"
hooks:
- id: ruff-format
- id: ruff
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.11.0
hooks:
- id: black
language_version: python3.9
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
Expand Down
8 changes: 2 additions & 6 deletions colour_visuals/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@
__major_version__ = "0"
__minor_version__ = "1"
__change_version__ = "0"
__version__ = ".".join(
(__major_version__, __minor_version__, __change_version__)
)
__version__ = ".".join((__major_version__, __minor_version__, __change_version__))

try:
_version: str = (
Expand All @@ -122,9 +120,7 @@
except Exception:
_version: str = __version__

colour.utilities.ANCILLARY_COLOUR_SCIENCE_PACKAGES[ # pyright: ignore
"colour-visuals"
] = _version
colour.utilities.ANCILLARY_COLOUR_SCIENCE_PACKAGES["colour-visuals"] = _version # pyright: ignore

del _version

Expand Down
9 changes: 2 additions & 7 deletions colour_visuals/axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class VisualAxes(MixinPropertyModel, MixinPropertySize, Visual):
... scene.add(visual)
... if os.environ.get("CI") is None:
... gfx.show(scene, camera=camera, canvas=canvas)
...
.. image:: ../_static/Plotting_VisualAxes.png
:align: center
Expand Down Expand Up @@ -146,9 +145,7 @@ def update(self):
self.add(self._axes_helper)

labels = np.array(COLOURSPACE_MODELS_AXIS_LABELS[self._model])[
as_int_array(
colourspace_model_axis_reorder([0, 1, 2], self._model)
)
as_int_array(colourspace_model_axis_reorder([0, 1, 2], self._model))
]

self._x_text = gfx.Text(
Expand Down Expand Up @@ -195,9 +192,7 @@ def update(self):
scene = gfx.Scene()

scene.add(
gfx.Background(
None, gfx.BackgroundMaterial(np.array([0.18, 0.18, 0.18]))
)
gfx.Background(None, gfx.BackgroundMaterial(np.array([0.18, 0.18, 0.18])))
)

visual_1 = VisualAxes(model="CIE Lab")
Expand Down
2 changes: 1 addition & 1 deletion colour_visuals/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def as_contiguous_array(


def conform_primitive_dtype(
primitive: Tuple[NDArray, NDArray, NDArray]
primitive: Tuple[NDArray, NDArray, NDArray],
) -> Tuple[NDArray, NDArray, NDArray]:
"""
Conform the given primitive to the required *WebGPU* dtype.
Expand Down
18 changes: 6 additions & 12 deletions colour_visuals/daylight_locus.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ class VisualDaylightLocus(
... scene.add(visual)
... if os.environ.get("CI") is None:
... gfx.show(scene, camera=camera, canvas=canvas)
...
.. image:: ../_static/Plotting_VisualDaylightLocus.png
:align: center
Expand All @@ -111,8 +110,9 @@ class VisualDaylightLocus(

def __init__(
self,
method: Literal["CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS"]
| str = "CIE 1931",
method: (
Literal["CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS"] | str
) = "CIE 1931",
mireds: bool = False,
colour: ArrayLike | None = None,
opacity: float = 1,
Expand Down Expand Up @@ -193,13 +193,9 @@ def update(self):
self._daylight_locus = gfx.Line(
gfx.Geometry(
positions=as_contiguous_array(positions),
colors=as_contiguous_array(
append_channel(colour_sl, self._opacity)
),
),
gfx.LineSegmentMaterial(
thickness=self._thickness, color_mode="vertex"
colors=as_contiguous_array(append_channel(colour_sl, self._opacity)),
),
gfx.LineSegmentMaterial(thickness=self._thickness, color_mode="vertex"),
)
self.add(self._daylight_locus)

Expand All @@ -208,9 +204,7 @@ def update(self):
scene = gfx.Scene()

scene.add(
gfx.Background(
None, gfx.BackgroundMaterial(np.array([0.18, 0.18, 0.18]))
)
gfx.Background(None, gfx.BackgroundMaterial(np.array([0.18, 0.18, 0.18])))
)

visual_1 = VisualDaylightLocus()
Expand Down
Loading

0 comments on commit 51b59f3

Please sign in to comment.