Skip to content

Commit

Permalink
ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
brentyi committed Aug 27, 2024
1 parent 0c17a60 commit 092914c
Show file tree
Hide file tree
Showing 22 changed files with 31 additions and 12 deletions.
1 change: 1 addition & 0 deletions examples/01_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import imageio.v3 as iio
import numpy as onp

import viser


Expand Down
1 change: 1 addition & 0 deletions examples/02_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import time

import numpy as onp

import viser


Expand Down
3 changes: 2 additions & 1 deletion examples/03_gui_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
import time

import numpy as onp
import viser
from typing_extensions import assert_never

import viser


def main() -> None:
server = viser.ViserServer()
Expand Down
1 change: 1 addition & 0 deletions examples/05_camera_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import time

import numpy as onp

import viser
import viser.transforms as tf

Expand Down
1 change: 1 addition & 0 deletions examples/06_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import numpy as onp
import trimesh

import viser
import viser.transforms as tf

Expand Down
3 changes: 2 additions & 1 deletion examples/07_record3d_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

import numpy as onp
import tyro
from tqdm.auto import tqdm

import viser
import viser.extras
import viser.transforms as tf
from tqdm.auto import tqdm


def main(
Expand Down
1 change: 1 addition & 0 deletions examples/08_smpl_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import numpy as np
import numpy as onp
import tyro

import viser
import viser.transforms as tf

Expand Down
3 changes: 2 additions & 1 deletion examples/09_urdf_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@

import numpy as onp
import tyro
import viser
from robot_descriptions.loaders.yourdfpy import load_robot_description

import viser
from viser.extras import ViserUrdf

# A subset of robots available in the robot_descriptions package.
Expand Down
3 changes: 2 additions & 1 deletion examples/10_realsense.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
import numpy as np
import numpy.typing as npt
import pyrealsense2 as rs # type: ignore
import viser
from tqdm.auto import tqdm

import viser


@contextlib.contextmanager
def realsense_pipeline(fps: int = 30):
Expand Down
3 changes: 2 additions & 1 deletion examples/11_colmap_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
import imageio.v3 as iio
import numpy as onp
import tyro
from tqdm.auto import tqdm

import viser
import viser.transforms as tf
from tqdm.auto import tqdm
from viser.extras.colmap import (
read_cameras_binary,
read_images_binary,
Expand Down
1 change: 1 addition & 0 deletions examples/12_click_meshes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import time

import matplotlib

import viser


Expand Down
1 change: 1 addition & 0 deletions examples/15_gui_in_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from typing import Optional

import numpy as onp

import viser
import viser.transforms as tf

Expand Down
1 change: 1 addition & 0 deletions examples/17_background_composite.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import numpy as onp
import trimesh
import trimesh.creation

import viser

server = viser.ViserServer()
Expand Down
1 change: 1 addition & 0 deletions examples/18_splines.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import time

import numpy as onp

import viser


Expand Down
1 change: 1 addition & 0 deletions examples/19_get_renders.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import imageio.v3 as iio
import numpy as onp

import viser


Expand Down
1 change: 1 addition & 0 deletions examples/20_scene_pointer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import trimesh
import trimesh.creation
import trimesh.ray

import viser
import viser.transforms as tf
from viser.theme import TitlebarConfig
Expand Down
3 changes: 2 additions & 1 deletion examples/22_games.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@

import numpy as onp
import trimesh.creation
from typing_extensions import assert_never

import viser
import viser.transforms as tf
from typing_extensions import assert_never


def main() -> None:
Expand Down
3 changes: 2 additions & 1 deletion examples/23_plotly.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
import numpy as onp
import plotly.express as px
import plotly.graph_objects as go
import viser
from PIL import Image

import viser


def create_sinusoidal_wave(t: float) -> go.Figure:
"""Create a sinusoidal wave plot, starting at time t."""
Expand Down
1 change: 1 addition & 0 deletions examples/23_smpl_visualizer_skinned.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import numpy as np
import numpy as onp
import tyro

import viser
import viser.transforms as tf

Expand Down
3 changes: 2 additions & 1 deletion examples/experimental/gaussian_splats.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
import numpy as onp
import numpy.typing as onpt
import tyro
import viser
from plyfile import PlyData

import viser
from viser import transforms as tf


Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,6 @@ lint.ignore = [
"PLR0912", # Too many branches.
"PLW0603", # Globa statement updates are discouraged.
"PLW2901", # For loop variable overwritten.
"PLW0642", # Reassigned self in instance method.
]
exclude = [ ".nodeenv" ]
6 changes: 2 additions & 4 deletions src/viser/_gui_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1242,8 +1242,7 @@ def add_slider(
"""
value: IntOrFloat = initial_value
assert max >= min
if step > max - min:
step = max - min
step = __builtins__.min(step, max - min)
assert max >= value >= min

# GUI callbacks cast incoming values to match the type of the initial value. If
Expand Down Expand Up @@ -1328,8 +1327,7 @@ def add_multi_slider(
A handle that can be used to interact with the GUI element.
"""
assert max >= min
if step > max - min:
step = max - min
step = __builtins__.min(step, max - min)
assert all(max >= x >= min for x in initial_value)

# GUI callbacks cast incoming values to match the type of the initial value. If
Expand Down

0 comments on commit 092914c

Please sign in to comment.