Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use | instead of Union for type hints #19

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions src/gepetto_viewer_rerun/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
from enum import Enum
from math import tau
from typing import List, Union
from typing import List

import numpy as np
import rerun as rr
Expand Down Expand Up @@ -180,10 +180,10 @@ def addFloor(self, floorName: str) -> bool:
def addBox(
self,
boxName: str,
boxSize1: List[Union[int, float]],
boxSize2: List[Union[int, float]],
boxSize3: List[Union[int, float]],
RGBAcolor: List[Union[int, float]],
boxSize1: List[int | float],
boxSize2: List[int | float],
boxSize3: List[int | float],
RGBAcolor: List[int | float],
) -> bool:
assert isinstance(boxName, str), "Parameter 'boxName' must be a string"
assert all(
Expand All @@ -205,9 +205,9 @@ def addBox(
def addArrow(
self,
name: str,
radius: Union[int, float],
length: Union[int, float],
RGBAcolor: List[Union[int, float]],
radius: int | float,
length: int | float,
RGBAcolor: List[int | float],
) -> bool:
assert isinstance(name, str), "Parameter 'name' must be a string"
assert all(
Expand All @@ -230,7 +230,7 @@ def addArrow(
return True

def resizeArrow(
self, arrowName: str, radius: Union[int, float], length: Union[int, float]
self, arrowName: str, radius: int | float, length: int | float
) -> bool:
assert isinstance(arrowName, str), "Parameter 'arrowName' must be a string"
assert all(
Expand All @@ -239,9 +239,9 @@ def resizeArrow(

def createArrow(
arrowName: str,
radius: Union[int, float],
length: Union[int, float],
colors: List[Union[int, float]],
radius: int | float,
length: int | float,
colors: List[int | float],
) -> rr.archetypes.arrows3d.Arrows3D:
angle = np.arange(start=0, stop=tau, step=tau)
vectors = np.column_stack(
Expand Down Expand Up @@ -312,9 +312,9 @@ def createArrow(
def addCapsule(
self,
name: str,
radius: Union[int, float],
height: Union[int, float],
RGBAcolor: List[Union[int, float]],
radius: int | float,
height: int | float,
RGBAcolor: List[int | float],
) -> bool:
assert isinstance(name, str), "Parameter 'name' must be a string"
assert all(
Expand All @@ -334,7 +334,7 @@ def addCapsule(
return True

def resizeCapsule(
self, capsuleName: str, radius: Union[int, float], length: Union[int, float]
self, capsuleName: str, radius: int | float, length: int | float
) -> bool:
assert isinstance(capsuleName, str), "Parameter 'capsuleName' must be a string"
assert all(
Expand All @@ -343,9 +343,9 @@ def resizeCapsule(

def createCapsule(
capsuleName: str,
radius: Union[int, float],
length: Union[int, float],
colors: List[Union[int, float]],
radius: int | float,
length: int | float,
colors: List[int | float],
) -> rr.archetypes.capsules3d.Capsules3D:
capsule = rr.Capsules3D(
radii=[radius],
Expand Down Expand Up @@ -414,9 +414,9 @@ def createCapsule(
def addLine(
self,
lineName: str,
pos1: List[Union[int, float]],
pos2: List[Union[int, float]],
RGBAcolor: List[Union[int, float]],
pos1: List[int | float],
pos2: List[int | float],
RGBAcolor: List[int | float],
) -> bool:
assert isinstance(lineName, str), "Parameter 'lineName' must be a string"
assert all(
Expand All @@ -441,11 +441,11 @@ def addLine(
def addSquareFace(
self,
faceName: str,
pos1: List[Union[int, float]],
pos2: List[Union[int, float]],
pos3: List[Union[int, float]],
pos4: List[Union[int, float]],
RGBAcolor: List[Union[int, float]],
pos1: List[int | float],
pos2: List[int | float],
pos3: List[int | float],
pos4: List[int | float],
RGBAcolor: List[int | float],
) -> bool:
assert isinstance(faceName, str), "Parameter 'faceName' must be a string"
assert all(
Expand All @@ -469,10 +469,10 @@ def addSquareFace(
def addTriangleFace(
self,
faceName: str,
pos1: List[Union[int, float]],
pos2: List[Union[int, float]],
pos3: List[Union[int, float]],
RGBAcolor: List[Union[int, float]],
pos1: List[int | float],
pos2: List[int | float],
pos3: List[int | float],
RGBAcolor: List[int | float],
) -> bool:
assert isinstance(faceName, str), "Parameter 'faceName' must be a string"
assert all(
Expand All @@ -499,8 +499,8 @@ def addTriangleFace(
def addSphere(
self,
sphereName: str,
radius: Union[int, float],
RGBAcolor: List[Union[int, float]],
radius: int | float,
RGBAcolor: List[int | float],
) -> bool:
assert isinstance(sphereName, str), "Parameter 'sphereName' must be a string"
assert isinstance(
Expand Down
4 changes: 2 additions & 2 deletions src/gepetto_viewer_rerun/entity.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import rerun as rr
from dataclasses import dataclass
from typing import Union, List
from typing import List
import pathlib
from .scene import Scene

Expand Down Expand Up @@ -32,4 +32,4 @@ def addScene(self, scene: Scene):

@dataclass
class MeshFromPath:
path: Union[str, pathlib.Path]
path: str | pathlib.Path
Loading