Skip to content

Commit

Permalink
Appease pyright
Browse files Browse the repository at this point in the history
  • Loading branch information
brentyi committed Sep 2, 2023
1 parent b768130 commit a82eb34
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions viser/_message_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,10 @@ def add_spline_catmull_rom(
) -> None:
"""Add spline using Catmull-Rom interpolation."""
if isinstance(positions, onp.ndarray):
assert len(positions.shape) == 2
positions = tuple(map(tuple, positions))

assert len(positions.shape) == 2 and positions.shape[1] == 3
positions = tuple(map(tuple, positions)) # type: ignore
assert len(positions[0]) == 3
assert isinstance(positions, tuple)
self._queue(
_messages.CatmullRomSplineMessage(
name,
Expand All @@ -241,12 +242,14 @@ def add_spline_cubic_bezier(
"""Add spline using Cubic Bezier interpolation."""

if isinstance(positions, onp.ndarray):
assert len(positions.shape) == 2
positions = tuple(map(tuple, positions))
assert len(positions.shape) == 2 and positions.shape[1] == 3
positions = tuple(map(tuple, positions)) # type: ignore
if isinstance(control_points, onp.ndarray):
assert len(control_points.shape) == 2
control_points = tuple(map(tuple, control_points))
assert len(control_points.shape) == 2 and control_points.shape[1] == 3
control_points = tuple(map(tuple, control_points)) # type: ignore

assert isinstance(positions, tuple)
assert isinstance(control_points, tuple)
assert len(control_points) == (2 * len(positions) - 2)
self._queue(
_messages.CubicBezierSplineMessage(
Expand Down

0 comments on commit a82eb34

Please sign in to comment.