diff --git a/docs/snippets/all/annotation_context_connections.py b/docs/snippets/all/annotation_context_connections.py index 96c32c095caf..a8b260547386 100644 --- a/docs/snippets/all/annotation_context_connections.py +++ b/docs/snippets/all/annotation_context_connections.py @@ -7,20 +7,18 @@ rr.log( "/", - rr.AnnotationContext( - [ - ClassDescription( - info=0, - keypoint_annotations=[ - (0, "zero", (255, 0, 0)), - (1, "one", (0, 255, 0)), - (2, "two", (0, 0, 255)), - (3, "three", (255, 255, 0)), - ], - keypoint_connections=[(0, 2), (1, 2), (2, 3)], - ) - ] - ), + rr.AnnotationContext([ + ClassDescription( + info=0, + keypoint_annotations=[ + (0, "zero", (255, 0, 0)), + (1, "one", (0, 255, 0)), + (2, "two", (0, 0, 255)), + (3, "three", (255, 255, 0)), + ], + keypoint_connections=[(0, 2), (1, 2), (2, 3)], + ) + ]), static=True, ) diff --git a/examples/python/arkit_scenes/main.py b/examples/python/arkit_scenes/main.py index 27c13ca9a7f9..a633508daf78 100755 --- a/examples/python/arkit_scenes/main.py +++ b/examples/python/arkit_scenes/main.py @@ -44,7 +44,7 @@ def load_json(js_path: Path) -> dict[str, Any]: - with open(js_path) as f: + with open(js_path, encoding="utf8") as f: json_data: dict[str, Any] = json.load(f) return json_data diff --git a/examples/python/detect_and_track_objects/main.py b/examples/python/detect_and_track_objects/main.py index 51ed28a90e4e..8baffd9ec05a 100755 --- a/examples/python/detect_and_track_objects/main.py +++ b/examples/python/detect_and_track_objects/main.py @@ -328,7 +328,7 @@ def update_trackers_with_detections( def track_objects(video_path: str, *, max_frame_count: int | None) -> None: - with open(COCO_CATEGORIES_PATH) as f: + with open(COCO_CATEGORIES_PATH, encoding="utf8") as f: coco_categories = json.load(f) class_descriptions = [ rr.AnnotationInfo(id=cat["id"], color=cat["color"], label=cat["name"]) for cat in coco_categories diff --git a/examples/python/external_data_loader/main.py b/examples/python/external_data_loader/main.py index 39c057b2f96f..ac05af371970 100755 --- a/examples/python/external_data_loader/main.py +++ b/examples/python/external_data_loader/main.py @@ -74,7 +74,7 @@ def main() -> None: else: entity_path = args.filepath - with open(args.filepath) as file: + with open(args.filepath, encoding="utf8") as file: body = file.read() text = f"""## Some Python code\n```python\n{body}\n```\n""" rr.log( diff --git a/examples/python/human_pose_tracking/main.py b/examples/python/human_pose_tracking/main.py index b3c8ff5b798c..e58809c4eb46 100755 --- a/examples/python/human_pose_tracking/main.py +++ b/examples/python/human_pose_tracking/main.py @@ -61,12 +61,10 @@ def track_pose(video_path: str, model_path: str, *, segment: bool, max_frame_cou # Use a separate annotation context for the segmentation mask. rr.log( "video/mask", - rr.AnnotationContext( - [ - rr.AnnotationInfo(id=0, label="Background"), - rr.AnnotationInfo(id=1, label="Person", color=(0, 0, 0)), - ] - ), + rr.AnnotationContext([ + rr.AnnotationInfo(id=0, label="Background"), + rr.AnnotationInfo(id=1, label="Person", color=(0, 0, 0)), + ]), static=True, ) rr.log("person", rr.ViewCoordinates.RIGHT_HAND_Y_DOWN, static=True) diff --git a/examples/python/open_photogrammetry_format/main.py b/examples/python/open_photogrammetry_format/main.py index d09409cceb13..0649e7e4f5f2 100755 --- a/examples/python/open_photogrammetry_format/main.py +++ b/examples/python/open_photogrammetry_format/main.py @@ -157,27 +157,21 @@ def log_calibrated_cameras(self, jpeg_quality: int | None) -> None: # https://pix4d.github.io/opf-spec/specification/calibrated_cameras.html#calibrated-camera omega, phi, kappa = tuple(np.deg2rad(a) for a in calib_camera.orientation_deg) rot = ( - np.array( - [ - [1, 0, 0], - [0, np.cos(omega), -np.sin(omega)], - [0, np.sin(omega), np.cos(omega)], - ] - ) - @ np.array( - [ - [np.cos(phi), 0, np.sin(phi)], - [0, 1, 0], - [-np.sin(phi), 0, np.cos(phi)], - ] - ) - @ np.array( - [ - [np.cos(kappa), -np.sin(kappa), 0], - [np.sin(kappa), np.cos(kappa), 0], - [0, 0, 1], - ] - ) + np.array([ + [1, 0, 0], + [0, np.cos(omega), -np.sin(omega)], + [0, np.sin(omega), np.cos(omega)], + ]) + @ np.array([ + [np.cos(phi), 0, np.sin(phi)], + [0, 1, 0], + [-np.sin(phi), 0, np.cos(phi)], + ]) + @ np.array([ + [np.cos(kappa), -np.sin(kappa), 0], + [np.sin(kappa), np.cos(kappa), 0], + [0, 0, 1], + ]) ) rr.log(entity, rr.Transform3D(translation=calib_camera.position, mat3x3=rot)) diff --git a/examples/python/raw_mesh/download_dataset.py b/examples/python/raw_mesh/download_dataset.py index 5d50b811d86f..1c92f48c3a0b 100755 --- a/examples/python/raw_mesh/download_dataset.py +++ b/examples/python/raw_mesh/download_dataset.py @@ -93,7 +93,7 @@ def download(url: str, path: Path) -> None: resp = requests.get(url) resp.raise_for_status() os.makedirs(path.parent, exist_ok=True) - with open(path, "wb") as f: + with open(path, "wb", encoding="utf8") as f: f.write(resp.content) name = name.lower() diff --git a/rerun_py/docs/gen_common_index.py b/rerun_py/docs/gen_common_index.py index 51d3ad70af7d..5afcc0ddd83d 100755 --- a/rerun_py/docs/gen_common_index.py +++ b/rerun_py/docs/gen_common_index.py @@ -50,7 +50,7 @@ def all_archetypes() -> list[str]: pattern = r'"([^"]*)"' # Open the file for reading - with open(file_path) as file: + with open(file_path, encoding="utf8") as file: # Read the file line by line for line in file: # Use re.findall to find all quoted strings in the line diff --git a/rerun_py/pyproject.toml b/rerun_py/pyproject.toml index 0b0066f1ebe5..5f68e4e92f28 100644 --- a/rerun_py/pyproject.toml +++ b/rerun_py/pyproject.toml @@ -51,6 +51,11 @@ rerun = "rerun_bindings:main" # This is needed because otherwise ruff will not be able to trim whitespaces in (codegened) docstrings. unsafe-fixes = true +# Allow preview lints to be enabled (like `PLW1514` to force `encoding` on open). +preview = true +# But we only want to opt-in to certain preview rules! +lint.explicit-preview-rules = true + extend-exclude = [ # Automatically generated test artifacts "venv/", @@ -101,13 +106,18 @@ lint.ignore = [ line-length = 120 lint.select = [ - "D", # pydocstyle codes https://www.pydocstyle.org/en/latest/error_codes.html - "E", # pycodestyle error codes: https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes - "F", # Flake8 error codes https://flake8.pycqa.org/en/latest/user/error-codes.html - "I", # Isort - "TID", # flake8-tidy-imports - "W", # pycodestyle warning codes: https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes - "UP", # pyupgrade (ensures idomatic code for supported python version) + "D", # pydocstyle codes https://www.pydocstyle.org/en/latest/error_codes.html + "E", # pycodestyle error codes: https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes + "F", # Flake8 error codes https://flake8.pycqa.org/en/latest/user/error-codes.html + "I", # Isort + "TID", # flake8-tidy-imports + "W", # pycodestyle warning codes: https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes + "UP", # pyupgrade (ensures idomatic code for supported python version) + "PLW1514", # Force setting `encoding` for open calls. This is in order to prevent issues when opening utf8 files on windows where the default encoding may depend on the active locale. https://docs.astral.sh/ruff/rules/unspecified-encoding/ +] + +lint.unfixable = [ + "PLW1514", # Automatic fix for `encoding` doesn't do what we want - it queries the locale for the preferred encoding which is exactly what we want to avoid. ] [tool.ruff.lint.per-file-ignores] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/background3d_kind.py b/rerun_py/rerun_sdk/rerun/blueprint/components/background3d_kind.py index c37142f11140..815aba7d92d7 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/background3d_kind.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/background3d_kind.py @@ -46,14 +46,12 @@ class Background3DKindType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.sparse_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("GradientDark", pa.null(), nullable=True, metadata={}), - pa.field("GradientBright", pa.null(), nullable=True, metadata={}), - pa.field("SolidColor", pa.null(), nullable=True, metadata={}), - ] - ), + pa.sparse_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("GradientDark", pa.null(), nullable=True, metadata={}), + pa.field("GradientBright", pa.null(), nullable=True, metadata={}), + pa.field("SolidColor", pa.null(), nullable=True, metadata={}), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/container_kind.py b/rerun_py/rerun_sdk/rerun/blueprint/components/container_kind.py index 5c40eb987b3b..e0347d25a5df 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/container_kind.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/container_kind.py @@ -36,15 +36,13 @@ class ContainerKindType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.sparse_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("Tabs", pa.null(), nullable=True, metadata={}), - pa.field("Horizontal", pa.null(), nullable=True, metadata={}), - pa.field("Vertical", pa.null(), nullable=True, metadata={}), - pa.field("Grid", pa.null(), nullable=True, metadata={}), - ] - ), + pa.sparse_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("Tabs", pa.null(), nullable=True, metadata={}), + pa.field("Horizontal", pa.null(), nullable=True, metadata={}), + pa.field("Vertical", pa.null(), nullable=True, metadata={}), + pa.field("Grid", pa.null(), nullable=True, metadata={}), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/corner2d.py b/rerun_py/rerun_sdk/rerun/blueprint/components/corner2d.py index 058b988a6a86..a682ad577fe8 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/corner2d.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/corner2d.py @@ -36,15 +36,13 @@ class Corner2DType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.sparse_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("LeftTop", pa.null(), nullable=True, metadata={}), - pa.field("RightTop", pa.null(), nullable=True, metadata={}), - pa.field("LeftBottom", pa.null(), nullable=True, metadata={}), - pa.field("RightBottom", pa.null(), nullable=True, metadata={}), - ] - ), + pa.sparse_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("LeftTop", pa.null(), nullable=True, metadata={}), + pa.field("RightTop", pa.null(), nullable=True, metadata={}), + pa.field("LeftBottom", pa.null(), nullable=True, metadata={}), + pa.field("RightBottom", pa.null(), nullable=True, metadata={}), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/visible_time_range.py b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/visible_time_range.py index 735c720b7a47..a588b0ac926c 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/visible_time_range.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/visible_time_range.py @@ -86,102 +86,84 @@ class VisibleTimeRangeType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.struct( - [ - pa.field( - "from_sequence", - pa.struct( - [ - pa.field( - "kind", - pa.sparse_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("RelativeToTimeCursor", pa.null(), nullable=True, metadata={}), - pa.field("Absolute", pa.null(), nullable=True, metadata={}), - pa.field("Infinite", pa.null(), nullable=True, metadata={}), - ] - ), - nullable=False, - metadata={}, - ), - pa.field("time", pa.int64(), nullable=False, metadata={}), - ] + pa.struct([ + pa.field( + "from_sequence", + pa.struct([ + pa.field( + "kind", + pa.sparse_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("RelativeToTimeCursor", pa.null(), nullable=True, metadata={}), + pa.field("Absolute", pa.null(), nullable=True, metadata={}), + pa.field("Infinite", pa.null(), nullable=True, metadata={}), + ]), + nullable=False, + metadata={}, ), - nullable=False, - metadata={}, - ), - pa.field( - "to_sequence", - pa.struct( - [ - pa.field( - "kind", - pa.sparse_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("RelativeToTimeCursor", pa.null(), nullable=True, metadata={}), - pa.field("Absolute", pa.null(), nullable=True, metadata={}), - pa.field("Infinite", pa.null(), nullable=True, metadata={}), - ] - ), - nullable=False, - metadata={}, - ), - pa.field("time", pa.int64(), nullable=False, metadata={}), - ] + pa.field("time", pa.int64(), nullable=False, metadata={}), + ]), + nullable=False, + metadata={}, + ), + pa.field( + "to_sequence", + pa.struct([ + pa.field( + "kind", + pa.sparse_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("RelativeToTimeCursor", pa.null(), nullable=True, metadata={}), + pa.field("Absolute", pa.null(), nullable=True, metadata={}), + pa.field("Infinite", pa.null(), nullable=True, metadata={}), + ]), + nullable=False, + metadata={}, ), - nullable=False, - metadata={}, - ), - pa.field( - "from_time", - pa.struct( - [ - pa.field( - "kind", - pa.sparse_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("RelativeToTimeCursor", pa.null(), nullable=True, metadata={}), - pa.field("Absolute", pa.null(), nullable=True, metadata={}), - pa.field("Infinite", pa.null(), nullable=True, metadata={}), - ] - ), - nullable=False, - metadata={}, - ), - pa.field("time", pa.int64(), nullable=False, metadata={}), - ] + pa.field("time", pa.int64(), nullable=False, metadata={}), + ]), + nullable=False, + metadata={}, + ), + pa.field( + "from_time", + pa.struct([ + pa.field( + "kind", + pa.sparse_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("RelativeToTimeCursor", pa.null(), nullable=True, metadata={}), + pa.field("Absolute", pa.null(), nullable=True, metadata={}), + pa.field("Infinite", pa.null(), nullable=True, metadata={}), + ]), + nullable=False, + metadata={}, ), - nullable=False, - metadata={}, - ), - pa.field( - "to_time", - pa.struct( - [ - pa.field( - "kind", - pa.sparse_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("RelativeToTimeCursor", pa.null(), nullable=True, metadata={}), - pa.field("Absolute", pa.null(), nullable=True, metadata={}), - pa.field("Infinite", pa.null(), nullable=True, metadata={}), - ] - ), - nullable=False, - metadata={}, - ), - pa.field("time", pa.int64(), nullable=False, metadata={}), - ] + pa.field("time", pa.int64(), nullable=False, metadata={}), + ]), + nullable=False, + metadata={}, + ), + pa.field( + "to_time", + pa.struct([ + pa.field( + "kind", + pa.sparse_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("RelativeToTimeCursor", pa.null(), nullable=True, metadata={}), + pa.field("Absolute", pa.null(), nullable=True, metadata={}), + pa.field("Infinite", pa.null(), nullable=True, metadata={}), + ]), + nullable=False, + metadata={}, ), - nullable=False, - metadata={}, - ), - ] - ), + pa.field("time", pa.int64(), nullable=False, metadata={}), + ]), + nullable=False, + metadata={}, + ), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/visible_time_range_boundary.py b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/visible_time_range_boundary.py index 7d94422c9c4e..6f5ffdfc9bd0 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/visible_time_range_boundary.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/visible_time_range_boundary.py @@ -74,24 +74,20 @@ class VisibleTimeRangeBoundaryType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.struct( - [ - pa.field( - "kind", - pa.sparse_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("RelativeToTimeCursor", pa.null(), nullable=True, metadata={}), - pa.field("Absolute", pa.null(), nullable=True, metadata={}), - pa.field("Infinite", pa.null(), nullable=True, metadata={}), - ] - ), - nullable=False, - metadata={}, - ), - pa.field("time", pa.int64(), nullable=False, metadata={}), - ] - ), + pa.struct([ + pa.field( + "kind", + pa.sparse_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("RelativeToTimeCursor", pa.null(), nullable=True, metadata={}), + pa.field("Absolute", pa.null(), nullable=True, metadata={}), + pa.field("Infinite", pa.null(), nullable=True, metadata={}), + ]), + nullable=False, + metadata={}, + ), + pa.field("time", pa.int64(), nullable=False, metadata={}), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/visible_time_range_boundary_kind.py b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/visible_time_range_boundary_kind.py index e179602b070d..72a218b1b3fd 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/visible_time_range_boundary_kind.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/visible_time_range_boundary_kind.py @@ -48,14 +48,12 @@ class VisibleTimeRangeBoundaryKindType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.sparse_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("RelativeToTimeCursor", pa.null(), nullable=True, metadata={}), - pa.field("Absolute", pa.null(), nullable=True, metadata={}), - pa.field("Infinite", pa.null(), nullable=True, metadata={}), - ] - ), + pa.sparse_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("RelativeToTimeCursor", pa.null(), nullable=True, metadata={}), + pa.field("Absolute", pa.null(), nullable=True, metadata={}), + pa.field("Infinite", pa.null(), nullable=True, metadata={}), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/components/annotation_context.py b/rerun_py/rerun_sdk/rerun/components/annotation_context.py index 55ee8280a28a..6a57c850a770 100644 --- a/rerun_py/rerun_sdk/rerun/components/annotation_context.py +++ b/rerun_py/rerun_sdk/rerun/components/annotation_context.py @@ -79,73 +79,59 @@ def __init__(self) -> None: pa.list_( pa.field( "item", - pa.struct( - [ - pa.field("class_id", pa.uint16(), nullable=False, metadata={}), - pa.field( - "class_description", - pa.struct( - [ - pa.field( - "info", - pa.struct( - [ - pa.field("id", pa.uint16(), nullable=False, metadata={}), - pa.field("label", pa.utf8(), nullable=True, metadata={}), - pa.field("color", pa.uint32(), nullable=True, metadata={}), - ] - ), - nullable=False, - metadata={}, - ), + pa.struct([ + pa.field("class_id", pa.uint16(), nullable=False, metadata={}), + pa.field( + "class_description", + pa.struct([ + pa.field( + "info", + pa.struct([ + pa.field("id", pa.uint16(), nullable=False, metadata={}), + pa.field("label", pa.utf8(), nullable=True, metadata={}), + pa.field("color", pa.uint32(), nullable=True, metadata={}), + ]), + nullable=False, + metadata={}, + ), + pa.field( + "keypoint_annotations", + pa.list_( pa.field( - "keypoint_annotations", - pa.list_( - pa.field( - "item", - pa.struct( - [ - pa.field("id", pa.uint16(), nullable=False, metadata={}), - pa.field("label", pa.utf8(), nullable=True, metadata={}), - pa.field("color", pa.uint32(), nullable=True, metadata={}), - ] - ), - nullable=False, - metadata={}, - ) - ), + "item", + pa.struct([ + pa.field("id", pa.uint16(), nullable=False, metadata={}), + pa.field("label", pa.utf8(), nullable=True, metadata={}), + pa.field("color", pa.uint32(), nullable=True, metadata={}), + ]), nullable=False, metadata={}, - ), + ) + ), + nullable=False, + metadata={}, + ), + pa.field( + "keypoint_connections", + pa.list_( pa.field( - "keypoint_connections", - pa.list_( - pa.field( - "item", - pa.struct( - [ - pa.field( - "keypoint0", pa.uint16(), nullable=False, metadata={} - ), - pa.field( - "keypoint1", pa.uint16(), nullable=False, metadata={} - ), - ] - ), - nullable=False, - metadata={}, - ) - ), + "item", + pa.struct([ + pa.field("keypoint0", pa.uint16(), nullable=False, metadata={}), + pa.field("keypoint1", pa.uint16(), nullable=False, metadata={}), + ]), nullable=False, metadata={}, - ), - ] + ) + ), + nullable=False, + metadata={}, ), - nullable=False, - metadata={}, - ), - ] - ), + ]), + nullable=False, + metadata={}, + ), + ]), nullable=False, metadata={}, ) diff --git a/rerun_py/rerun_sdk/rerun/components/marker_shape.py b/rerun_py/rerun_sdk/rerun/components/marker_shape.py index eb320d2d80fa..e945fa04f9cc 100644 --- a/rerun_py/rerun_sdk/rerun/components/marker_shape.py +++ b/rerun_py/rerun_sdk/rerun/components/marker_shape.py @@ -42,21 +42,19 @@ class MarkerShapeType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.sparse_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("Circle", pa.null(), nullable=True, metadata={}), - pa.field("Diamond", pa.null(), nullable=True, metadata={}), - pa.field("Square", pa.null(), nullable=True, metadata={}), - pa.field("Cross", pa.null(), nullable=True, metadata={}), - pa.field("Plus", pa.null(), nullable=True, metadata={}), - pa.field("Up", pa.null(), nullable=True, metadata={}), - pa.field("Down", pa.null(), nullable=True, metadata={}), - pa.field("Left", pa.null(), nullable=True, metadata={}), - pa.field("Right", pa.null(), nullable=True, metadata={}), - pa.field("Asterisk", pa.null(), nullable=True, metadata={}), - ] - ), + pa.sparse_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("Circle", pa.null(), nullable=True, metadata={}), + pa.field("Diamond", pa.null(), nullable=True, metadata={}), + pa.field("Square", pa.null(), nullable=True, metadata={}), + pa.field("Cross", pa.null(), nullable=True, metadata={}), + pa.field("Plus", pa.null(), nullable=True, metadata={}), + pa.field("Up", pa.null(), nullable=True, metadata={}), + pa.field("Down", pa.null(), nullable=True, metadata={}), + pa.field("Left", pa.null(), nullable=True, metadata={}), + pa.field("Right", pa.null(), nullable=True, metadata={}), + pa.field("Asterisk", pa.null(), nullable=True, metadata={}), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/datatypes/angle.py b/rerun_py/rerun_sdk/rerun/datatypes/angle.py index e0fd7c03002e..6d298b1337b7 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/angle.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/angle.py @@ -66,13 +66,11 @@ class AngleType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("Radians", pa.float32(), nullable=False, metadata={}), - pa.field("Degrees", pa.float32(), nullable=False, metadata={}), - ] - ), + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("Radians", pa.float32(), nullable=False, metadata={}), + pa.field("Degrees", pa.float32(), nullable=False, metadata={}), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/datatypes/annotation_info.py b/rerun_py/rerun_sdk/rerun/datatypes/annotation_info.py index 26a295d6f009..fb8e6dea8890 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/annotation_info.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/annotation_info.py @@ -109,13 +109,11 @@ class AnnotationInfoType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.struct( - [ - pa.field("id", pa.uint16(), nullable=False, metadata={}), - pa.field("label", pa.utf8(), nullable=True, metadata={}), - pa.field("color", pa.uint32(), nullable=True, metadata={}), - ] - ), + pa.struct([ + pa.field("id", pa.uint16(), nullable=False, metadata={}), + pa.field("label", pa.utf8(), nullable=True, metadata={}), + pa.field("color", pa.uint32(), nullable=True, metadata={}), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/datatypes/class_description.py b/rerun_py/rerun_sdk/rerun/datatypes/class_description.py index ee42782245a2..bb366ff0e3ee 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/class_description.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/class_description.py @@ -87,59 +87,51 @@ class ClassDescriptionType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.struct( - [ - pa.field( - "info", - pa.struct( - [ + pa.struct([ + pa.field( + "info", + pa.struct([ + pa.field("id", pa.uint16(), nullable=False, metadata={}), + pa.field("label", pa.utf8(), nullable=True, metadata={}), + pa.field("color", pa.uint32(), nullable=True, metadata={}), + ]), + nullable=False, + metadata={}, + ), + pa.field( + "keypoint_annotations", + pa.list_( + pa.field( + "item", + pa.struct([ pa.field("id", pa.uint16(), nullable=False, metadata={}), pa.field("label", pa.utf8(), nullable=True, metadata={}), pa.field("color", pa.uint32(), nullable=True, metadata={}), - ] - ), - nullable=False, - metadata={}, + ]), + nullable=False, + metadata={}, + ) ), - pa.field( - "keypoint_annotations", - pa.list_( - pa.field( - "item", - pa.struct( - [ - pa.field("id", pa.uint16(), nullable=False, metadata={}), - pa.field("label", pa.utf8(), nullable=True, metadata={}), - pa.field("color", pa.uint32(), nullable=True, metadata={}), - ] - ), - nullable=False, - metadata={}, - ) - ), - nullable=False, - metadata={}, + nullable=False, + metadata={}, + ), + pa.field( + "keypoint_connections", + pa.list_( + pa.field( + "item", + pa.struct([ + pa.field("keypoint0", pa.uint16(), nullable=False, metadata={}), + pa.field("keypoint1", pa.uint16(), nullable=False, metadata={}), + ]), + nullable=False, + metadata={}, + ) ), - pa.field( - "keypoint_connections", - pa.list_( - pa.field( - "item", - pa.struct( - [ - pa.field("keypoint0", pa.uint16(), nullable=False, metadata={}), - pa.field("keypoint1", pa.uint16(), nullable=False, metadata={}), - ] - ), - nullable=False, - metadata={}, - ) - ), - nullable=False, - metadata={}, - ), - ] - ), + nullable=False, + metadata={}, + ), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/datatypes/class_description_map_elem.py b/rerun_py/rerun_sdk/rerun/datatypes/class_description_map_elem.py index 2b3953264be8..cc99e8ebace5 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/class_description_map_elem.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/class_description_map_elem.py @@ -86,69 +86,59 @@ class ClassDescriptionMapElemType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.struct( - [ - pa.field("class_id", pa.uint16(), nullable=False, metadata={}), - pa.field( - "class_description", - pa.struct( - [ - pa.field( - "info", - pa.struct( - [ - pa.field("id", pa.uint16(), nullable=False, metadata={}), - pa.field("label", pa.utf8(), nullable=True, metadata={}), - pa.field("color", pa.uint32(), nullable=True, metadata={}), - ] - ), - nullable=False, - metadata={}, - ), + pa.struct([ + pa.field("class_id", pa.uint16(), nullable=False, metadata={}), + pa.field( + "class_description", + pa.struct([ + pa.field( + "info", + pa.struct([ + pa.field("id", pa.uint16(), nullable=False, metadata={}), + pa.field("label", pa.utf8(), nullable=True, metadata={}), + pa.field("color", pa.uint32(), nullable=True, metadata={}), + ]), + nullable=False, + metadata={}, + ), + pa.field( + "keypoint_annotations", + pa.list_( pa.field( - "keypoint_annotations", - pa.list_( - pa.field( - "item", - pa.struct( - [ - pa.field("id", pa.uint16(), nullable=False, metadata={}), - pa.field("label", pa.utf8(), nullable=True, metadata={}), - pa.field("color", pa.uint32(), nullable=True, metadata={}), - ] - ), - nullable=False, - metadata={}, - ) - ), + "item", + pa.struct([ + pa.field("id", pa.uint16(), nullable=False, metadata={}), + pa.field("label", pa.utf8(), nullable=True, metadata={}), + pa.field("color", pa.uint32(), nullable=True, metadata={}), + ]), nullable=False, metadata={}, - ), + ) + ), + nullable=False, + metadata={}, + ), + pa.field( + "keypoint_connections", + pa.list_( pa.field( - "keypoint_connections", - pa.list_( - pa.field( - "item", - pa.struct( - [ - pa.field("keypoint0", pa.uint16(), nullable=False, metadata={}), - pa.field("keypoint1", pa.uint16(), nullable=False, metadata={}), - ] - ), - nullable=False, - metadata={}, - ) - ), + "item", + pa.struct([ + pa.field("keypoint0", pa.uint16(), nullable=False, metadata={}), + pa.field("keypoint1", pa.uint16(), nullable=False, metadata={}), + ]), nullable=False, metadata={}, - ), - ] + ) + ), + nullable=False, + metadata={}, ), - nullable=False, - metadata={}, - ), - ] - ), + ]), + nullable=False, + metadata={}, + ), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/datatypes/keypoint_pair.py b/rerun_py/rerun_sdk/rerun/datatypes/keypoint_pair.py index 246801ad49d8..762551957e6d 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/keypoint_pair.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/keypoint_pair.py @@ -79,12 +79,10 @@ class KeypointPairType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.struct( - [ - pa.field("keypoint0", pa.uint16(), nullable=False, metadata={}), - pa.field("keypoint1", pa.uint16(), nullable=False, metadata={}), - ] - ), + pa.struct([ + pa.field("keypoint0", pa.uint16(), nullable=False, metadata={}), + pa.field("keypoint1", pa.uint16(), nullable=False, metadata={}), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/datatypes/mesh_properties.py b/rerun_py/rerun_sdk/rerun/datatypes/mesh_properties.py index 29b7d6ca8d7e..da993757d1c2 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/mesh_properties.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/mesh_properties.py @@ -72,16 +72,14 @@ class MeshPropertiesType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.struct( - [ - pa.field( - "indices", - pa.list_(pa.field("item", pa.uint32(), nullable=False, metadata={})), - nullable=True, - metadata={}, - ) - ] - ), + pa.struct([ + pa.field( + "indices", + pa.list_(pa.field("item", pa.uint32(), nullable=False, metadata={})), + nullable=True, + metadata={}, + ) + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/datatypes/rotation3d.py b/rerun_py/rerun_sdk/rerun/datatypes/rotation3d.py index fcc1a03cb987..9fcdf1d81a06 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/rotation3d.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/rotation3d.py @@ -56,44 +56,38 @@ class Rotation3DType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field( - "Quaternion", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 4), - nullable=False, - metadata={}, - ), - pa.field( - "AxisAngle", - pa.struct( - [ - pa.field( - "axis", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), - nullable=False, - metadata={}, - ), - pa.field( - "angle", - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("Radians", pa.float32(), nullable=False, metadata={}), - pa.field("Degrees", pa.float32(), nullable=False, metadata={}), - ] - ), - nullable=False, - metadata={}, - ), - ] + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field( + "Quaternion", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 4), + nullable=False, + metadata={}, + ), + pa.field( + "AxisAngle", + pa.struct([ + pa.field( + "axis", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=False, + metadata={}, ), - nullable=False, - metadata={}, - ), - ] - ), + pa.field( + "angle", + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("Radians", pa.float32(), nullable=False, metadata={}), + pa.field("Degrees", pa.float32(), nullable=False, metadata={}), + ]), + nullable=False, + metadata={}, + ), + ]), + nullable=False, + metadata={}, + ), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/datatypes/rotation_axis_angle.py b/rerun_py/rerun_sdk/rerun/datatypes/rotation_axis_angle.py index 535b01a7aab1..209b57e16c92 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/rotation_axis_angle.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/rotation_axis_angle.py @@ -66,28 +66,24 @@ class RotationAxisAngleType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.struct( - [ - pa.field( - "axis", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), - nullable=False, - metadata={}, - ), - pa.field( - "angle", - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("Radians", pa.float32(), nullable=False, metadata={}), - pa.field("Degrees", pa.float32(), nullable=False, metadata={}), - ] - ), - nullable=False, - metadata={}, - ), - ] - ), + pa.struct([ + pa.field( + "axis", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=False, + metadata={}, + ), + pa.field( + "angle", + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("Radians", pa.float32(), nullable=False, metadata={}), + pa.field("Degrees", pa.float32(), nullable=False, metadata={}), + ]), + nullable=False, + metadata={}, + ), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/datatypes/scale3d.py b/rerun_py/rerun_sdk/rerun/datatypes/scale3d.py index 897f6f56c04c..b07f31a7c611 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/scale3d.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/scale3d.py @@ -70,18 +70,16 @@ class Scale3DType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field( - "ThreeD", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), - nullable=False, - metadata={}, - ), - pa.field("Uniform", pa.float32(), nullable=False, metadata={}), - ] - ), + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field( + "ThreeD", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=False, + metadata={}, + ), + pa.field("Uniform", pa.float32(), nullable=False, metadata={}), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/datatypes/tensor_buffer.py b/rerun_py/rerun_sdk/rerun/datatypes/tensor_buffer.py index 36ae3c1e1c76..9e61d27392d9 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/tensor_buffer.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/tensor_buffer.py @@ -188,95 +188,93 @@ class TensorBufferType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field( - "U8", - pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "U16", - pa.list_(pa.field("item", pa.uint16(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "U32", - pa.list_(pa.field("item", pa.uint32(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "U64", - pa.list_(pa.field("item", pa.uint64(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "I8", - pa.list_(pa.field("item", pa.int8(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "I16", - pa.list_(pa.field("item", pa.int16(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "I32", - pa.list_(pa.field("item", pa.int32(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "I64", - pa.list_(pa.field("item", pa.int64(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "F16", - pa.list_(pa.field("item", pa.float16(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "F32", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "F64", - pa.list_(pa.field("item", pa.float64(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "JPEG", - pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "NV12", - pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "YUY2", - pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - ] - ), + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field( + "U8", + pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "U16", + pa.list_(pa.field("item", pa.uint16(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "U32", + pa.list_(pa.field("item", pa.uint32(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "U64", + pa.list_(pa.field("item", pa.uint64(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "I8", + pa.list_(pa.field("item", pa.int8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "I16", + pa.list_(pa.field("item", pa.int16(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "I32", + pa.list_(pa.field("item", pa.int32(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "I64", + pa.list_(pa.field("item", pa.int64(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "F16", + pa.list_(pa.field("item", pa.float16(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "F32", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "F64", + pa.list_(pa.field("item", pa.float64(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "JPEG", + pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "NV12", + pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "YUY2", + pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/datatypes/tensor_data.py b/rerun_py/rerun_sdk/rerun/datatypes/tensor_data.py index 1752ce60a208..35b34f38da33 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/tensor_data.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/tensor_data.py @@ -63,122 +63,116 @@ class TensorDataType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.struct( - [ - pa.field( - "shape", - pa.list_( - pa.field( - "item", - pa.struct( - [ - pa.field("size", pa.uint64(), nullable=False, metadata={}), - pa.field("name", pa.utf8(), nullable=True, metadata={}), - ] - ), - nullable=False, - metadata={}, - ) - ), - nullable=False, - metadata={}, + pa.struct([ + pa.field( + "shape", + pa.list_( + pa.field( + "item", + pa.struct([ + pa.field("size", pa.uint64(), nullable=False, metadata={}), + pa.field("name", pa.utf8(), nullable=True, metadata={}), + ]), + nullable=False, + metadata={}, + ) ), - pa.field( - "buffer", - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field( - "U8", - pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "U16", - pa.list_(pa.field("item", pa.uint16(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "U32", - pa.list_(pa.field("item", pa.uint32(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "U64", - pa.list_(pa.field("item", pa.uint64(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "I8", - pa.list_(pa.field("item", pa.int8(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "I16", - pa.list_(pa.field("item", pa.int16(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "I32", - pa.list_(pa.field("item", pa.int32(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "I64", - pa.list_(pa.field("item", pa.int64(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "F16", - pa.list_(pa.field("item", pa.float16(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "F32", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "F64", - pa.list_(pa.field("item", pa.float64(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "JPEG", - pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "NV12", - pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "YUY2", - pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - ] + nullable=False, + metadata={}, + ), + pa.field( + "buffer", + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field( + "U8", + pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), + nullable=False, + metadata={}, ), - nullable=False, - metadata={}, - ), - ] - ), + pa.field( + "U16", + pa.list_(pa.field("item", pa.uint16(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "U32", + pa.list_(pa.field("item", pa.uint32(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "U64", + pa.list_(pa.field("item", pa.uint64(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "I8", + pa.list_(pa.field("item", pa.int8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "I16", + pa.list_(pa.field("item", pa.int16(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "I32", + pa.list_(pa.field("item", pa.int32(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "I64", + pa.list_(pa.field("item", pa.int64(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "F16", + pa.list_(pa.field("item", pa.float16(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "F32", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "F64", + pa.list_(pa.field("item", pa.float64(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "JPEG", + pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "NV12", + pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "YUY2", + pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + ]), + nullable=False, + metadata={}, + ), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/datatypes/tensor_dimension.py b/rerun_py/rerun_sdk/rerun/datatypes/tensor_dimension.py index 56d75add04b4..e7d11a6a585e 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/tensor_dimension.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/tensor_dimension.py @@ -68,12 +68,10 @@ class TensorDimensionType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.struct( - [ - pa.field("size", pa.uint64(), nullable=False, metadata={}), - pa.field("name", pa.utf8(), nullable=True, metadata={}), - ] - ), + pa.struct([ + pa.field("size", pa.uint64(), nullable=False, metadata={}), + pa.field("name", pa.utf8(), nullable=True, metadata={}), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/datatypes/transform3d.py b/rerun_py/rerun_sdk/rerun/datatypes/transform3d.py index 7c09f28f83bf..e10448ac7c09 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/transform3d.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/transform3d.py @@ -56,133 +56,95 @@ class Transform3DType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field( - "TranslationAndMat3x3", - pa.struct( - [ + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field( + "TranslationAndMat3x3", + pa.struct([ + pa.field( + "translation", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=True, + metadata={}, + ), + pa.field( + "mat3x3", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 9), + nullable=True, + metadata={}, + ), + pa.field("from_parent", pa.bool_(), nullable=False, metadata={}), + ]), + nullable=False, + metadata={}, + ), + pa.field( + "TranslationRotationScale", + pa.struct([ + pa.field( + "translation", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=True, + metadata={}, + ), + pa.field( + "rotation", + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), pa.field( - "translation", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), - nullable=True, + "Quaternion", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 4), + nullable=False, metadata={}, ), pa.field( - "mat3x3", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 9), - nullable=True, + "AxisAngle", + pa.struct([ + pa.field( + "axis", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=False, + metadata={}, + ), + pa.field( + "angle", + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("Radians", pa.float32(), nullable=False, metadata={}), + pa.field("Degrees", pa.float32(), nullable=False, metadata={}), + ]), + nullable=False, + metadata={}, + ), + ]), + nullable=False, metadata={}, ), - pa.field("from_parent", pa.bool_(), nullable=False, metadata={}), - ] + ]), + nullable=True, + metadata={}, ), - nullable=False, - metadata={}, - ), - pa.field( - "TranslationRotationScale", - pa.struct( - [ + pa.field( + "scale", + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), pa.field( - "translation", + "ThreeD", pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), - nullable=True, - metadata={}, - ), - pa.field( - "rotation", - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field( - "Quaternion", - pa.list_( - pa.field("item", pa.float32(), nullable=False, metadata={}), 4 - ), - nullable=False, - metadata={}, - ), - pa.field( - "AxisAngle", - pa.struct( - [ - pa.field( - "axis", - pa.list_( - pa.field( - "item", pa.float32(), nullable=False, metadata={} - ), - 3, - ), - nullable=False, - metadata={}, - ), - pa.field( - "angle", - pa.dense_union( - [ - pa.field( - "_null_markers", - pa.null(), - nullable=True, - metadata={}, - ), - pa.field( - "Radians", - pa.float32(), - nullable=False, - metadata={}, - ), - pa.field( - "Degrees", - pa.float32(), - nullable=False, - metadata={}, - ), - ] - ), - nullable=False, - metadata={}, - ), - ] - ), - nullable=False, - metadata={}, - ), - ] - ), - nullable=True, - metadata={}, - ), - pa.field( - "scale", - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field( - "ThreeD", - pa.list_( - pa.field("item", pa.float32(), nullable=False, metadata={}), 3 - ), - nullable=False, - metadata={}, - ), - pa.field("Uniform", pa.float32(), nullable=False, metadata={}), - ] - ), - nullable=True, + nullable=False, metadata={}, ), - pa.field("from_parent", pa.bool_(), nullable=False, metadata={}), - ] + pa.field("Uniform", pa.float32(), nullable=False, metadata={}), + ]), + nullable=True, + metadata={}, ), - nullable=False, - metadata={}, - ), - ] - ), + pa.field("from_parent", pa.bool_(), nullable=False, metadata={}), + ]), + nullable=False, + metadata={}, + ), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/datatypes/translation_and_mat3x3.py b/rerun_py/rerun_sdk/rerun/datatypes/translation_and_mat3x3.py index 10fee8b83f9e..16294b40c079 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/translation_and_mat3x3.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/translation_and_mat3x3.py @@ -91,23 +91,21 @@ class TranslationAndMat3x3Type(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.struct( - [ - pa.field( - "translation", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), - nullable=True, - metadata={}, - ), - pa.field( - "mat3x3", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 9), - nullable=True, - metadata={}, - ), - pa.field("from_parent", pa.bool_(), nullable=False, metadata={}), - ] - ), + pa.struct([ + pa.field( + "translation", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=True, + metadata={}, + ), + pa.field( + "mat3x3", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 9), + nullable=True, + metadata={}, + ), + pa.field("from_parent", pa.bool_(), nullable=False, metadata={}), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/datatypes/translation_rotation_scale3d.py b/rerun_py/rerun_sdk/rerun/datatypes/translation_rotation_scale3d.py index 35274d15baad..545d80e8ca43 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/translation_rotation_scale3d.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/translation_rotation_scale3d.py @@ -95,81 +95,67 @@ class TranslationRotationScale3DType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.struct( - [ - pa.field( - "translation", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), - nullable=True, - metadata={}, - ), - pa.field( - "rotation", - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.struct([ + pa.field( + "translation", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=True, + metadata={}, + ), + pa.field( + "rotation", + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field( + "Quaternion", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 4), + nullable=False, + metadata={}, + ), + pa.field( + "AxisAngle", + pa.struct([ pa.field( - "Quaternion", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 4), + "axis", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), nullable=False, metadata={}, ), pa.field( - "AxisAngle", - pa.struct( - [ - pa.field( - "axis", - pa.list_( - pa.field("item", pa.float32(), nullable=False, metadata={}), 3 - ), - nullable=False, - metadata={}, - ), - pa.field( - "angle", - pa.dense_union( - [ - pa.field( - "_null_markers", pa.null(), nullable=True, metadata={} - ), - pa.field("Radians", pa.float32(), nullable=False, metadata={}), - pa.field("Degrees", pa.float32(), nullable=False, metadata={}), - ] - ), - nullable=False, - metadata={}, - ), - ] - ), + "angle", + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("Radians", pa.float32(), nullable=False, metadata={}), + pa.field("Degrees", pa.float32(), nullable=False, metadata={}), + ]), nullable=False, metadata={}, ), - ] + ]), + nullable=False, + metadata={}, ), - nullable=True, - metadata={}, - ), - pa.field( - "scale", - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field( - "ThreeD", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), - nullable=False, - metadata={}, - ), - pa.field("Uniform", pa.float32(), nullable=False, metadata={}), - ] + ]), + nullable=True, + metadata={}, + ), + pa.field( + "scale", + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field( + "ThreeD", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=False, + metadata={}, ), - nullable=True, - metadata={}, - ), - pa.field("from_parent", pa.bool_(), nullable=False, metadata={}), - ] - ), + pa.field("Uniform", pa.float32(), nullable=False, metadata={}), + ]), + nullable=True, + metadata={}, + ), + pa.field("from_parent", pa.bool_(), nullable=False, metadata={}), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/rerun_sdk/rerun/utilities/data.py b/rerun_py/rerun_sdk/rerun/utilities/data.py index d8419f5370bd..6d02871fe8a3 100644 --- a/rerun_py/rerun_sdk/rerun/utilities/data.py +++ b/rerun_py/rerun_sdk/rerun/utilities/data.py @@ -56,16 +56,14 @@ def build_color_grid(x_count: int = 10, y_count: int = 10, z_count: int = 10, tw positions = np.vstack([xyz.ravel() for xyz in grid]) - colors = np.vstack( - [ - xyz.ravel() - for xyz in np.mgrid[ - slice(0, 255, x_count * 1j), - slice(0, 255, y_count * 1j), - slice(0, 255, z_count * 1j), - ] + colors = np.vstack([ + xyz.ravel() + for xyz in np.mgrid[ + slice(0, 255, x_count * 1j), + slice(0, 255, y_count * 1j), + slice(0, 255, z_count * 1j), ] - ) + ]) return ColorGrid(positions.T, colors.T.astype(np.uint8)) @@ -132,16 +130,14 @@ def build_color_spiral( The factor applied between each step along the Z axis. """ - positions = np.array( + positions = np.array([ [ - [ - cos(i * tau * angular_step + angular_offset) * radius, - sin(i * tau * angular_step + angular_offset) * radius, - i * z_step, - ] - for i in range(num_points) + cos(i * tau * angular_step + angular_offset) * radius, + sin(i * tau * angular_step + angular_offset) * radius, + i * z_step, ] - ) + for i in range(num_points) + ]) colors = turbo_colormap_data[np.linspace(0, len(turbo_colormap_data) - 1, num_points, dtype=int)] return ColorSpiral(positions, colors) diff --git a/rerun_py/rerun_sdk/rerun/utilities/turbo.py b/rerun_py/rerun_sdk/rerun/utilities/turbo.py index e711fbc2a7e7..005af175d6ce 100644 --- a/rerun_py/rerun_sdk/rerun/utilities/turbo.py +++ b/rerun_py/rerun_sdk/rerun/utilities/turbo.py @@ -4,263 +4,261 @@ __all__ = ["turbo_colormap_data"] -turbo_colormap_data = np.array( - [ - [0.18995, 0.07176, 0.23217], - [0.19483, 0.08339, 0.26149], - [0.19956, 0.09498, 0.29024], - [0.20415, 0.10652, 0.31844], - [0.20860, 0.11802, 0.34607], - [0.21291, 0.12947, 0.37314], - [0.21708, 0.14087, 0.39964], - [0.22111, 0.15223, 0.42558], - [0.22500, 0.16354, 0.45096], - [0.22875, 0.17481, 0.47578], - [0.23236, 0.18603, 0.50004], - [0.23582, 0.19720, 0.52373], - [0.23915, 0.20833, 0.54686], - [0.24234, 0.21941, 0.56942], - [0.24539, 0.23044, 0.59142], - [0.24830, 0.24143, 0.61286], - [0.25107, 0.25237, 0.63374], - [0.25369, 0.26327, 0.65406], - [0.25618, 0.27412, 0.67381], - [0.25853, 0.28492, 0.69300], - [0.26074, 0.29568, 0.71162], - [0.26280, 0.30639, 0.72968], - [0.26473, 0.31706, 0.74718], - [0.26652, 0.32768, 0.76412], - [0.26816, 0.33825, 0.78050], - [0.26967, 0.34878, 0.79631], - [0.27103, 0.35926, 0.81156], - [0.27226, 0.36970, 0.82624], - [0.27334, 0.38008, 0.84037], - [0.27429, 0.39043, 0.85393], - [0.27509, 0.40072, 0.86692], - [0.27576, 0.41097, 0.87936], - [0.27628, 0.42118, 0.89123], - [0.27667, 0.43134, 0.90254], - [0.27691, 0.44145, 0.91328], - [0.27701, 0.45152, 0.92347], - [0.27698, 0.46153, 0.93309], - [0.27680, 0.47151, 0.94214], - [0.27648, 0.48144, 0.95064], - [0.27603, 0.49132, 0.95857], - [0.27543, 0.50115, 0.96594], - [0.27469, 0.51094, 0.97275], - [0.27381, 0.52069, 0.97899], - [0.27273, 0.53040, 0.98461], - [0.27106, 0.54015, 0.98930], - [0.26878, 0.54995, 0.99303], - [0.26592, 0.55979, 0.99583], - [0.26252, 0.56967, 0.99773], - [0.25862, 0.57958, 0.99876], - [0.25425, 0.58950, 0.99896], - [0.24946, 0.59943, 0.99835], - [0.24427, 0.60937, 0.99697], - [0.23874, 0.61931, 0.99485], - [0.23288, 0.62923, 0.99202], - [0.22676, 0.63913, 0.98851], - [0.22039, 0.64901, 0.98436], - [0.21382, 0.65886, 0.97959], - [0.20708, 0.66866, 0.97423], - [0.20021, 0.67842, 0.96833], - [0.19326, 0.68812, 0.96190], - [0.18625, 0.69775, 0.95498], - [0.17923, 0.70732, 0.94761], - [0.17223, 0.71680, 0.93981], - [0.16529, 0.72620, 0.93161], - [0.15844, 0.73551, 0.92305], - [0.15173, 0.74472, 0.91416], - [0.14519, 0.75381, 0.90496], - [0.13886, 0.76279, 0.89550], - [0.13278, 0.77165, 0.88580], - [0.12698, 0.78037, 0.87590], - [0.12151, 0.78896, 0.86581], - [0.11639, 0.79740, 0.85559], - [0.11167, 0.80569, 0.84525], - [0.10738, 0.81381, 0.83484], - [0.10357, 0.82177, 0.82437], - [0.10026, 0.82955, 0.81389], - [0.09750, 0.83714, 0.80342], - [0.09532, 0.84455, 0.79299], - [0.09377, 0.85175, 0.78264], - [0.09287, 0.85875, 0.77240], - [0.09267, 0.86554, 0.76230], - [0.09320, 0.87211, 0.75237], - [0.09451, 0.87844, 0.74265], - [0.09662, 0.88454, 0.73316], - [0.09958, 0.89040, 0.72393], - [0.10342, 0.89600, 0.71500], - [0.10815, 0.90142, 0.70599], - [0.11374, 0.90673, 0.69651], - [0.12014, 0.91193, 0.68660], - [0.12733, 0.91701, 0.67627], - [0.13526, 0.92197, 0.66556], - [0.14391, 0.92680, 0.65448], - [0.15323, 0.93151, 0.64308], - [0.16319, 0.93609, 0.63137], - [0.17377, 0.94053, 0.61938], - [0.18491, 0.94484, 0.60713], - [0.19659, 0.94901, 0.59466], - [0.20877, 0.95304, 0.58199], - [0.22142, 0.95692, 0.56914], - [0.23449, 0.96065, 0.55614], - [0.24797, 0.96423, 0.54303], - [0.26180, 0.96765, 0.52981], - [0.27597, 0.97092, 0.51653], - [0.29042, 0.97403, 0.50321], - [0.30513, 0.97697, 0.48987], - [0.32006, 0.97974, 0.47654], - [0.33517, 0.98234, 0.46325], - [0.35043, 0.98477, 0.45002], - [0.36581, 0.98702, 0.43688], - [0.38127, 0.98909, 0.42386], - [0.39678, 0.99098, 0.41098], - [0.41229, 0.99268, 0.39826], - [0.42778, 0.99419, 0.38575], - [0.44321, 0.99551, 0.37345], - [0.45854, 0.99663, 0.36140], - [0.47375, 0.99755, 0.34963], - [0.48879, 0.99828, 0.33816], - [0.50362, 0.99879, 0.32701], - [0.51822, 0.99910, 0.31622], - [0.53255, 0.99919, 0.30581], - [0.54658, 0.99907, 0.29581], - [0.56026, 0.99873, 0.28623], - [0.57357, 0.99817, 0.27712], - [0.58646, 0.99739, 0.26849], - [0.59891, 0.99638, 0.26038], - [0.61088, 0.99514, 0.25280], - [0.62233, 0.99366, 0.24579], - [0.63323, 0.99195, 0.23937], - [0.64362, 0.98999, 0.23356], - [0.65394, 0.98775, 0.22835], - [0.66428, 0.98524, 0.22370], - [0.67462, 0.98246, 0.21960], - [0.68494, 0.97941, 0.21602], - [0.69525, 0.97610, 0.21294], - [0.70553, 0.97255, 0.21032], - [0.71577, 0.96875, 0.20815], - [0.72596, 0.96470, 0.20640], - [0.73610, 0.96043, 0.20504], - [0.74617, 0.95593, 0.20406], - [0.75617, 0.95121, 0.20343], - [0.76608, 0.94627, 0.20311], - [0.77591, 0.94113, 0.20310], - [0.78563, 0.93579, 0.20336], - [0.79524, 0.93025, 0.20386], - [0.80473, 0.92452, 0.20459], - [0.81410, 0.91861, 0.20552], - [0.82333, 0.91253, 0.20663], - [0.83241, 0.90627, 0.20788], - [0.84133, 0.89986, 0.20926], - [0.85010, 0.89328, 0.21074], - [0.85868, 0.88655, 0.21230], - [0.86709, 0.87968, 0.21391], - [0.87530, 0.87267, 0.21555], - [0.88331, 0.86553, 0.21719], - [0.89112, 0.85826, 0.21880], - [0.89870, 0.85087, 0.22038], - [0.90605, 0.84337, 0.22188], - [0.91317, 0.83576, 0.22328], - [0.92004, 0.82806, 0.22456], - [0.92666, 0.82025, 0.22570], - [0.93301, 0.81236, 0.22667], - [0.93909, 0.80439, 0.22744], - [0.94489, 0.79634, 0.22800], - [0.95039, 0.78823, 0.22831], - [0.95560, 0.78005, 0.22836], - [0.96049, 0.77181, 0.22811], - [0.96507, 0.76352, 0.22754], - [0.96931, 0.75519, 0.22663], - [0.97323, 0.74682, 0.22536], - [0.97679, 0.73842, 0.22369], - [0.98000, 0.73000, 0.22161], - [0.98289, 0.72140, 0.21918], - [0.98549, 0.71250, 0.21650], - [0.98781, 0.70330, 0.21358], - [0.98986, 0.69382, 0.21043], - [0.99163, 0.68408, 0.20706], - [0.99314, 0.67408, 0.20348], - [0.99438, 0.66386, 0.19971], - [0.99535, 0.65341, 0.19577], - [0.99607, 0.64277, 0.19165], - [0.99654, 0.63193, 0.18738], - [0.99675, 0.62093, 0.18297], - [0.99672, 0.60977, 0.17842], - [0.99644, 0.59846, 0.17376], - [0.99593, 0.58703, 0.16899], - [0.99517, 0.57549, 0.16412], - [0.99419, 0.56386, 0.15918], - [0.99297, 0.55214, 0.15417], - [0.99153, 0.54036, 0.14910], - [0.98987, 0.52854, 0.14398], - [0.98799, 0.51667, 0.13883], - [0.98590, 0.50479, 0.13367], - [0.98360, 0.49291, 0.12849], - [0.98108, 0.48104, 0.12332], - [0.97837, 0.46920, 0.11817], - [0.97545, 0.45740, 0.11305], - [0.97234, 0.44565, 0.10797], - [0.96904, 0.43399, 0.10294], - [0.96555, 0.42241, 0.09798], - [0.96187, 0.41093, 0.09310], - [0.95801, 0.39958, 0.08831], - [0.95398, 0.38836, 0.08362], - [0.94977, 0.37729, 0.07905], - [0.94538, 0.36638, 0.07461], - [0.94084, 0.35566, 0.07031], - [0.93612, 0.34513, 0.06616], - [0.93125, 0.33482, 0.06218], - [0.92623, 0.32473, 0.05837], - [0.92105, 0.31489, 0.05475], - [0.91572, 0.30530, 0.05134], - [0.91024, 0.29599, 0.04814], - [0.90463, 0.28696, 0.04516], - [0.89888, 0.27824, 0.04243], - [0.89298, 0.26981, 0.03993], - [0.88691, 0.26152, 0.03753], - [0.88066, 0.25334, 0.03521], - [0.87422, 0.24526, 0.03297], - [0.86760, 0.23730, 0.03082], - [0.86079, 0.22945, 0.02875], - [0.85380, 0.22170, 0.02677], - [0.84662, 0.21407, 0.02487], - [0.83926, 0.20654, 0.02305], - [0.83172, 0.19912, 0.02131], - [0.82399, 0.19182, 0.01966], - [0.81608, 0.18462, 0.01809], - [0.80799, 0.17753, 0.01660], - [0.79971, 0.17055, 0.01520], - [0.79125, 0.16368, 0.01387], - [0.78260, 0.15693, 0.01264], - [0.77377, 0.15028, 0.01148], - [0.76476, 0.14374, 0.01041], - [0.75556, 0.13731, 0.00942], - [0.74617, 0.13098, 0.00851], - [0.73661, 0.12477, 0.00769], - [0.72686, 0.11867, 0.00695], - [0.71692, 0.11268, 0.00629], - [0.70680, 0.10680, 0.00571], - [0.69650, 0.10102, 0.00522], - [0.68602, 0.09536, 0.00481], - [0.67535, 0.08980, 0.00449], - [0.66449, 0.08436, 0.00424], - [0.65345, 0.07902, 0.00408], - [0.64223, 0.07380, 0.00401], - [0.63082, 0.06868, 0.00401], - [0.61923, 0.06367, 0.00410], - [0.60746, 0.05878, 0.00427], - [0.59550, 0.05399, 0.00453], - [0.58336, 0.04931, 0.00486], - [0.57103, 0.04474, 0.00529], - [0.55852, 0.04028, 0.00579], - [0.54583, 0.03593, 0.00638], - [0.53295, 0.03169, 0.00705], - [0.51989, 0.02756, 0.00780], - [0.50664, 0.02354, 0.00863], - [0.49321, 0.01963, 0.00955], - [0.47960, 0.01583, 0.01055], - ] -) +turbo_colormap_data = np.array([ + [0.18995, 0.07176, 0.23217], + [0.19483, 0.08339, 0.26149], + [0.19956, 0.09498, 0.29024], + [0.20415, 0.10652, 0.31844], + [0.20860, 0.11802, 0.34607], + [0.21291, 0.12947, 0.37314], + [0.21708, 0.14087, 0.39964], + [0.22111, 0.15223, 0.42558], + [0.22500, 0.16354, 0.45096], + [0.22875, 0.17481, 0.47578], + [0.23236, 0.18603, 0.50004], + [0.23582, 0.19720, 0.52373], + [0.23915, 0.20833, 0.54686], + [0.24234, 0.21941, 0.56942], + [0.24539, 0.23044, 0.59142], + [0.24830, 0.24143, 0.61286], + [0.25107, 0.25237, 0.63374], + [0.25369, 0.26327, 0.65406], + [0.25618, 0.27412, 0.67381], + [0.25853, 0.28492, 0.69300], + [0.26074, 0.29568, 0.71162], + [0.26280, 0.30639, 0.72968], + [0.26473, 0.31706, 0.74718], + [0.26652, 0.32768, 0.76412], + [0.26816, 0.33825, 0.78050], + [0.26967, 0.34878, 0.79631], + [0.27103, 0.35926, 0.81156], + [0.27226, 0.36970, 0.82624], + [0.27334, 0.38008, 0.84037], + [0.27429, 0.39043, 0.85393], + [0.27509, 0.40072, 0.86692], + [0.27576, 0.41097, 0.87936], + [0.27628, 0.42118, 0.89123], + [0.27667, 0.43134, 0.90254], + [0.27691, 0.44145, 0.91328], + [0.27701, 0.45152, 0.92347], + [0.27698, 0.46153, 0.93309], + [0.27680, 0.47151, 0.94214], + [0.27648, 0.48144, 0.95064], + [0.27603, 0.49132, 0.95857], + [0.27543, 0.50115, 0.96594], + [0.27469, 0.51094, 0.97275], + [0.27381, 0.52069, 0.97899], + [0.27273, 0.53040, 0.98461], + [0.27106, 0.54015, 0.98930], + [0.26878, 0.54995, 0.99303], + [0.26592, 0.55979, 0.99583], + [0.26252, 0.56967, 0.99773], + [0.25862, 0.57958, 0.99876], + [0.25425, 0.58950, 0.99896], + [0.24946, 0.59943, 0.99835], + [0.24427, 0.60937, 0.99697], + [0.23874, 0.61931, 0.99485], + [0.23288, 0.62923, 0.99202], + [0.22676, 0.63913, 0.98851], + [0.22039, 0.64901, 0.98436], + [0.21382, 0.65886, 0.97959], + [0.20708, 0.66866, 0.97423], + [0.20021, 0.67842, 0.96833], + [0.19326, 0.68812, 0.96190], + [0.18625, 0.69775, 0.95498], + [0.17923, 0.70732, 0.94761], + [0.17223, 0.71680, 0.93981], + [0.16529, 0.72620, 0.93161], + [0.15844, 0.73551, 0.92305], + [0.15173, 0.74472, 0.91416], + [0.14519, 0.75381, 0.90496], + [0.13886, 0.76279, 0.89550], + [0.13278, 0.77165, 0.88580], + [0.12698, 0.78037, 0.87590], + [0.12151, 0.78896, 0.86581], + [0.11639, 0.79740, 0.85559], + [0.11167, 0.80569, 0.84525], + [0.10738, 0.81381, 0.83484], + [0.10357, 0.82177, 0.82437], + [0.10026, 0.82955, 0.81389], + [0.09750, 0.83714, 0.80342], + [0.09532, 0.84455, 0.79299], + [0.09377, 0.85175, 0.78264], + [0.09287, 0.85875, 0.77240], + [0.09267, 0.86554, 0.76230], + [0.09320, 0.87211, 0.75237], + [0.09451, 0.87844, 0.74265], + [0.09662, 0.88454, 0.73316], + [0.09958, 0.89040, 0.72393], + [0.10342, 0.89600, 0.71500], + [0.10815, 0.90142, 0.70599], + [0.11374, 0.90673, 0.69651], + [0.12014, 0.91193, 0.68660], + [0.12733, 0.91701, 0.67627], + [0.13526, 0.92197, 0.66556], + [0.14391, 0.92680, 0.65448], + [0.15323, 0.93151, 0.64308], + [0.16319, 0.93609, 0.63137], + [0.17377, 0.94053, 0.61938], + [0.18491, 0.94484, 0.60713], + [0.19659, 0.94901, 0.59466], + [0.20877, 0.95304, 0.58199], + [0.22142, 0.95692, 0.56914], + [0.23449, 0.96065, 0.55614], + [0.24797, 0.96423, 0.54303], + [0.26180, 0.96765, 0.52981], + [0.27597, 0.97092, 0.51653], + [0.29042, 0.97403, 0.50321], + [0.30513, 0.97697, 0.48987], + [0.32006, 0.97974, 0.47654], + [0.33517, 0.98234, 0.46325], + [0.35043, 0.98477, 0.45002], + [0.36581, 0.98702, 0.43688], + [0.38127, 0.98909, 0.42386], + [0.39678, 0.99098, 0.41098], + [0.41229, 0.99268, 0.39826], + [0.42778, 0.99419, 0.38575], + [0.44321, 0.99551, 0.37345], + [0.45854, 0.99663, 0.36140], + [0.47375, 0.99755, 0.34963], + [0.48879, 0.99828, 0.33816], + [0.50362, 0.99879, 0.32701], + [0.51822, 0.99910, 0.31622], + [0.53255, 0.99919, 0.30581], + [0.54658, 0.99907, 0.29581], + [0.56026, 0.99873, 0.28623], + [0.57357, 0.99817, 0.27712], + [0.58646, 0.99739, 0.26849], + [0.59891, 0.99638, 0.26038], + [0.61088, 0.99514, 0.25280], + [0.62233, 0.99366, 0.24579], + [0.63323, 0.99195, 0.23937], + [0.64362, 0.98999, 0.23356], + [0.65394, 0.98775, 0.22835], + [0.66428, 0.98524, 0.22370], + [0.67462, 0.98246, 0.21960], + [0.68494, 0.97941, 0.21602], + [0.69525, 0.97610, 0.21294], + [0.70553, 0.97255, 0.21032], + [0.71577, 0.96875, 0.20815], + [0.72596, 0.96470, 0.20640], + [0.73610, 0.96043, 0.20504], + [0.74617, 0.95593, 0.20406], + [0.75617, 0.95121, 0.20343], + [0.76608, 0.94627, 0.20311], + [0.77591, 0.94113, 0.20310], + [0.78563, 0.93579, 0.20336], + [0.79524, 0.93025, 0.20386], + [0.80473, 0.92452, 0.20459], + [0.81410, 0.91861, 0.20552], + [0.82333, 0.91253, 0.20663], + [0.83241, 0.90627, 0.20788], + [0.84133, 0.89986, 0.20926], + [0.85010, 0.89328, 0.21074], + [0.85868, 0.88655, 0.21230], + [0.86709, 0.87968, 0.21391], + [0.87530, 0.87267, 0.21555], + [0.88331, 0.86553, 0.21719], + [0.89112, 0.85826, 0.21880], + [0.89870, 0.85087, 0.22038], + [0.90605, 0.84337, 0.22188], + [0.91317, 0.83576, 0.22328], + [0.92004, 0.82806, 0.22456], + [0.92666, 0.82025, 0.22570], + [0.93301, 0.81236, 0.22667], + [0.93909, 0.80439, 0.22744], + [0.94489, 0.79634, 0.22800], + [0.95039, 0.78823, 0.22831], + [0.95560, 0.78005, 0.22836], + [0.96049, 0.77181, 0.22811], + [0.96507, 0.76352, 0.22754], + [0.96931, 0.75519, 0.22663], + [0.97323, 0.74682, 0.22536], + [0.97679, 0.73842, 0.22369], + [0.98000, 0.73000, 0.22161], + [0.98289, 0.72140, 0.21918], + [0.98549, 0.71250, 0.21650], + [0.98781, 0.70330, 0.21358], + [0.98986, 0.69382, 0.21043], + [0.99163, 0.68408, 0.20706], + [0.99314, 0.67408, 0.20348], + [0.99438, 0.66386, 0.19971], + [0.99535, 0.65341, 0.19577], + [0.99607, 0.64277, 0.19165], + [0.99654, 0.63193, 0.18738], + [0.99675, 0.62093, 0.18297], + [0.99672, 0.60977, 0.17842], + [0.99644, 0.59846, 0.17376], + [0.99593, 0.58703, 0.16899], + [0.99517, 0.57549, 0.16412], + [0.99419, 0.56386, 0.15918], + [0.99297, 0.55214, 0.15417], + [0.99153, 0.54036, 0.14910], + [0.98987, 0.52854, 0.14398], + [0.98799, 0.51667, 0.13883], + [0.98590, 0.50479, 0.13367], + [0.98360, 0.49291, 0.12849], + [0.98108, 0.48104, 0.12332], + [0.97837, 0.46920, 0.11817], + [0.97545, 0.45740, 0.11305], + [0.97234, 0.44565, 0.10797], + [0.96904, 0.43399, 0.10294], + [0.96555, 0.42241, 0.09798], + [0.96187, 0.41093, 0.09310], + [0.95801, 0.39958, 0.08831], + [0.95398, 0.38836, 0.08362], + [0.94977, 0.37729, 0.07905], + [0.94538, 0.36638, 0.07461], + [0.94084, 0.35566, 0.07031], + [0.93612, 0.34513, 0.06616], + [0.93125, 0.33482, 0.06218], + [0.92623, 0.32473, 0.05837], + [0.92105, 0.31489, 0.05475], + [0.91572, 0.30530, 0.05134], + [0.91024, 0.29599, 0.04814], + [0.90463, 0.28696, 0.04516], + [0.89888, 0.27824, 0.04243], + [0.89298, 0.26981, 0.03993], + [0.88691, 0.26152, 0.03753], + [0.88066, 0.25334, 0.03521], + [0.87422, 0.24526, 0.03297], + [0.86760, 0.23730, 0.03082], + [0.86079, 0.22945, 0.02875], + [0.85380, 0.22170, 0.02677], + [0.84662, 0.21407, 0.02487], + [0.83926, 0.20654, 0.02305], + [0.83172, 0.19912, 0.02131], + [0.82399, 0.19182, 0.01966], + [0.81608, 0.18462, 0.01809], + [0.80799, 0.17753, 0.01660], + [0.79971, 0.17055, 0.01520], + [0.79125, 0.16368, 0.01387], + [0.78260, 0.15693, 0.01264], + [0.77377, 0.15028, 0.01148], + [0.76476, 0.14374, 0.01041], + [0.75556, 0.13731, 0.00942], + [0.74617, 0.13098, 0.00851], + [0.73661, 0.12477, 0.00769], + [0.72686, 0.11867, 0.00695], + [0.71692, 0.11268, 0.00629], + [0.70680, 0.10680, 0.00571], + [0.69650, 0.10102, 0.00522], + [0.68602, 0.09536, 0.00481], + [0.67535, 0.08980, 0.00449], + [0.66449, 0.08436, 0.00424], + [0.65345, 0.07902, 0.00408], + [0.64223, 0.07380, 0.00401], + [0.63082, 0.06868, 0.00401], + [0.61923, 0.06367, 0.00410], + [0.60746, 0.05878, 0.00427], + [0.59550, 0.05399, 0.00453], + [0.58336, 0.04931, 0.00486], + [0.57103, 0.04474, 0.00529], + [0.55852, 0.04028, 0.00579], + [0.54583, 0.03593, 0.00638], + [0.53295, 0.03169, 0.00705], + [0.51989, 0.02756, 0.00780], + [0.50664, 0.02354, 0.00863], + [0.49321, 0.01963, 0.00955], + [0.47960, 0.01583, 0.01055], +]) diff --git a/rerun_py/tests/test_types/components/affix_fuzzer16.py b/rerun_py/tests/test_types/components/affix_fuzzer16.py index 16b10dbb6800..817e55f94cf3 100644 --- a/rerun_py/tests/test_types/components/affix_fuzzer16.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer16.py @@ -43,74 +43,60 @@ def __init__(self) -> None: pa.list_( pa.field( "item", - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("degrees", pa.float32(), nullable=False, metadata={}), - pa.field("radians", pa.float32(), nullable=False, metadata={}), - pa.field( - "craziness", - pa.list_( - pa.field( - "item", - pa.struct( - [ - pa.field( - "single_float_optional", pa.float32(), nullable=True, metadata={} - ), - pa.field( - "single_string_required", pa.utf8(), nullable=False, metadata={} - ), - pa.field( - "single_string_optional", pa.utf8(), nullable=True, metadata={} - ), - pa.field( - "many_floats_optional", - pa.list_( - pa.field("item", pa.float32(), nullable=False, metadata={}) - ), - nullable=True, - metadata={}, - ), - pa.field( - "many_strings_required", - pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "many_strings_optional", - pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), - nullable=True, - metadata={}, - ), - pa.field("flattened_scalar", pa.float32(), nullable=False, metadata={}), - pa.field( - "almost_flattened_scalar", - pa.struct( - [pa.field("value", pa.float32(), nullable=False, metadata={})] - ), - nullable=False, - metadata={}, - ), - pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), - ] + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("degrees", pa.float32(), nullable=False, metadata={}), + pa.field("radians", pa.float32(), nullable=False, metadata={}), + pa.field( + "craziness", + pa.list_( + pa.field( + "item", + pa.struct([ + pa.field("single_float_optional", pa.float32(), nullable=True, metadata={}), + pa.field("single_string_required", pa.utf8(), nullable=False, metadata={}), + pa.field("single_string_optional", pa.utf8(), nullable=True, metadata={}), + pa.field( + "many_floats_optional", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={})), + nullable=True, + metadata={}, ), - nullable=False, - metadata={}, - ) - ), - nullable=False, - metadata={}, - ), - pa.field( - "fixed_size_shenanigans", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), - nullable=False, - metadata={}, + pa.field( + "many_strings_required", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "many_strings_optional", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=True, + metadata={}, + ), + pa.field("flattened_scalar", pa.float32(), nullable=False, metadata={}), + pa.field( + "almost_flattened_scalar", + pa.struct([pa.field("value", pa.float32(), nullable=False, metadata={})]), + nullable=False, + metadata={}, + ), + pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), + ]), + nullable=False, + metadata={}, + ) ), - ] - ), + nullable=False, + metadata={}, + ), + pa.field( + "fixed_size_shenanigans", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=False, + metadata={}, + ), + ]), nullable=False, metadata={}, ) diff --git a/rerun_py/tests/test_types/components/affix_fuzzer17.py b/rerun_py/tests/test_types/components/affix_fuzzer17.py index 9c99643cfe3e..d80061aadac7 100644 --- a/rerun_py/tests/test_types/components/affix_fuzzer17.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer17.py @@ -43,74 +43,60 @@ def __init__(self) -> None: pa.list_( pa.field( "item", - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("degrees", pa.float32(), nullable=False, metadata={}), - pa.field("radians", pa.float32(), nullable=False, metadata={}), - pa.field( - "craziness", - pa.list_( - pa.field( - "item", - pa.struct( - [ - pa.field( - "single_float_optional", pa.float32(), nullable=True, metadata={} - ), - pa.field( - "single_string_required", pa.utf8(), nullable=False, metadata={} - ), - pa.field( - "single_string_optional", pa.utf8(), nullable=True, metadata={} - ), - pa.field( - "many_floats_optional", - pa.list_( - pa.field("item", pa.float32(), nullable=False, metadata={}) - ), - nullable=True, - metadata={}, - ), - pa.field( - "many_strings_required", - pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "many_strings_optional", - pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), - nullable=True, - metadata={}, - ), - pa.field("flattened_scalar", pa.float32(), nullable=False, metadata={}), - pa.field( - "almost_flattened_scalar", - pa.struct( - [pa.field("value", pa.float32(), nullable=False, metadata={})] - ), - nullable=False, - metadata={}, - ), - pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), - ] + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("degrees", pa.float32(), nullable=False, metadata={}), + pa.field("radians", pa.float32(), nullable=False, metadata={}), + pa.field( + "craziness", + pa.list_( + pa.field( + "item", + pa.struct([ + pa.field("single_float_optional", pa.float32(), nullable=True, metadata={}), + pa.field("single_string_required", pa.utf8(), nullable=False, metadata={}), + pa.field("single_string_optional", pa.utf8(), nullable=True, metadata={}), + pa.field( + "many_floats_optional", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={})), + nullable=True, + metadata={}, ), - nullable=False, - metadata={}, - ) - ), - nullable=False, - metadata={}, - ), - pa.field( - "fixed_size_shenanigans", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), - nullable=False, - metadata={}, + pa.field( + "many_strings_required", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "many_strings_optional", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=True, + metadata={}, + ), + pa.field("flattened_scalar", pa.float32(), nullable=False, metadata={}), + pa.field( + "almost_flattened_scalar", + pa.struct([pa.field("value", pa.float32(), nullable=False, metadata={})]), + nullable=False, + metadata={}, + ), + pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), + ]), + nullable=False, + metadata={}, + ) ), - ] - ), + nullable=False, + metadata={}, + ), + pa.field( + "fixed_size_shenanigans", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=False, + metadata={}, + ), + ]), nullable=False, metadata={}, ) diff --git a/rerun_py/tests/test_types/components/affix_fuzzer18.py b/rerun_py/tests/test_types/components/affix_fuzzer18.py index 93692238959c..2a8fbe788308 100644 --- a/rerun_py/tests/test_types/components/affix_fuzzer18.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer18.py @@ -43,13 +43,83 @@ def __init__(self) -> None: pa.list_( pa.field( "item", - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field( - "single_required", - pa.dense_union( - [ + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field( + "single_required", + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("degrees", pa.float32(), nullable=False, metadata={}), + pa.field("radians", pa.float32(), nullable=False, metadata={}), + pa.field( + "craziness", + pa.list_( + pa.field( + "item", + pa.struct([ + pa.field( + "single_float_optional", pa.float32(), nullable=True, metadata={} + ), + pa.field( + "single_string_required", pa.utf8(), nullable=False, metadata={} + ), + pa.field( + "single_string_optional", pa.utf8(), nullable=True, metadata={} + ), + pa.field( + "many_floats_optional", + pa.list_( + pa.field("item", pa.float32(), nullable=False, metadata={}) + ), + nullable=True, + metadata={}, + ), + pa.field( + "many_strings_required", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "many_strings_optional", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=True, + metadata={}, + ), + pa.field("flattened_scalar", pa.float32(), nullable=False, metadata={}), + pa.field( + "almost_flattened_scalar", + pa.struct([ + pa.field("value", pa.float32(), nullable=False, metadata={}) + ]), + nullable=False, + metadata={}, + ), + pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), + ]), + nullable=False, + metadata={}, + ) + ), + nullable=False, + metadata={}, + ), + pa.field( + "fixed_size_shenanigans", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=False, + metadata={}, + ), + ]), + nullable=False, + metadata={}, + ), + pa.field( + "many_required", + pa.list_( + pa.field( + "item", + pa.dense_union([ pa.field("_null_markers", pa.null(), nullable=True, metadata={}), pa.field("degrees", pa.float32(), nullable=False, metadata={}), pa.field("radians", pa.float32(), nullable=False, metadata={}), @@ -58,85 +128,69 @@ def __init__(self) -> None: pa.list_( pa.field( "item", - pa.struct( - [ - pa.field( - "single_float_optional", - pa.float32(), - nullable=True, - metadata={}, - ), - pa.field( - "single_string_required", - pa.utf8(), - nullable=False, - metadata={}, - ), - pa.field( - "single_string_optional", - pa.utf8(), - nullable=True, - metadata={}, - ), - pa.field( - "many_floats_optional", - pa.list_( - pa.field( - "item", - pa.float32(), - nullable=False, - metadata={}, - ) - ), - nullable=True, - metadata={}, - ), - pa.field( - "many_strings_required", - pa.list_( - pa.field( - "item", pa.utf8(), nullable=False, metadata={} - ) - ), - nullable=False, - metadata={}, - ), - pa.field( - "many_strings_optional", - pa.list_( - pa.field( - "item", pa.utf8(), nullable=False, metadata={} - ) - ), - nullable=True, - metadata={}, - ), - pa.field( - "flattened_scalar", - pa.float32(), - nullable=False, - metadata={}, + pa.struct([ + pa.field( + "single_float_optional", + pa.float32(), + nullable=True, + metadata={}, + ), + pa.field( + "single_string_required", + pa.utf8(), + nullable=False, + metadata={}, + ), + pa.field( + "single_string_optional", + pa.utf8(), + nullable=True, + metadata={}, + ), + pa.field( + "many_floats_optional", + pa.list_( + pa.field( + "item", pa.float32(), nullable=False, metadata={} + ) ), - pa.field( - "almost_flattened_scalar", - pa.struct( - [ - pa.field( - "value", - pa.float32(), - nullable=False, - metadata={}, - ) - ] - ), - nullable=False, - metadata={}, + nullable=True, + metadata={}, + ), + pa.field( + "many_strings_required", + pa.list_( + pa.field("item", pa.utf8(), nullable=False, metadata={}) ), - pa.field( - "from_parent", pa.bool_(), nullable=True, metadata={} + nullable=False, + metadata={}, + ), + pa.field( + "many_strings_optional", + pa.list_( + pa.field("item", pa.utf8(), nullable=False, metadata={}) ), - ] - ), + nullable=True, + metadata={}, + ), + pa.field( + "flattened_scalar", + pa.float32(), + nullable=False, + metadata={}, + ), + pa.field( + "almost_flattened_scalar", + pa.struct([ + pa.field( + "value", pa.float32(), nullable=False, metadata={} + ) + ]), + nullable=False, + metadata={}, + ), + pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), + ]), nullable=False, metadata={}, ) @@ -150,267 +204,113 @@ def __init__(self) -> None: nullable=False, metadata={}, ), - ] - ), - nullable=False, - metadata={}, + ]), + nullable=False, + metadata={}, + ) ), - pa.field( - "many_required", - pa.list_( - pa.field( - "item", - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("degrees", pa.float32(), nullable=False, metadata={}), - pa.field("radians", pa.float32(), nullable=False, metadata={}), + nullable=False, + metadata={}, + ), + pa.field( + "many_optional", + pa.list_( + pa.field( + "item", + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("degrees", pa.float32(), nullable=False, metadata={}), + pa.field("radians", pa.float32(), nullable=False, metadata={}), + pa.field( + "craziness", + pa.list_( pa.field( - "craziness", - pa.list_( + "item", + pa.struct([ + pa.field( + "single_float_optional", + pa.float32(), + nullable=True, + metadata={}, + ), + pa.field( + "single_string_required", + pa.utf8(), + nullable=False, + metadata={}, + ), + pa.field( + "single_string_optional", + pa.utf8(), + nullable=True, + metadata={}, + ), pa.field( - "item", - pa.struct( - [ - pa.field( - "single_float_optional", - pa.float32(), - nullable=True, - metadata={}, - ), - pa.field( - "single_string_required", - pa.utf8(), - nullable=False, - metadata={}, - ), - pa.field( - "single_string_optional", - pa.utf8(), - nullable=True, - metadata={}, - ), - pa.field( - "many_floats_optional", - pa.list_( - pa.field( - "item", - pa.float32(), - nullable=False, - metadata={}, - ) - ), - nullable=True, - metadata={}, - ), - pa.field( - "many_strings_required", - pa.list_( - pa.field( - "item", - pa.utf8(), - nullable=False, - metadata={}, - ) - ), - nullable=False, - metadata={}, - ), - pa.field( - "many_strings_optional", - pa.list_( - pa.field( - "item", - pa.utf8(), - nullable=False, - metadata={}, - ) - ), - nullable=True, - metadata={}, - ), - pa.field( - "flattened_scalar", - pa.float32(), - nullable=False, - metadata={}, - ), - pa.field( - "almost_flattened_scalar", - pa.struct( - [ - pa.field( - "value", - pa.float32(), - nullable=False, - metadata={}, - ) - ] - ), - nullable=False, - metadata={}, - ), - pa.field( - "from_parent", - pa.bool_(), - nullable=True, - metadata={}, - ), - ] + "many_floats_optional", + pa.list_( + pa.field( + "item", pa.float32(), nullable=False, metadata={} + ) + ), + nullable=True, + metadata={}, + ), + pa.field( + "many_strings_required", + pa.list_( + pa.field("item", pa.utf8(), nullable=False, metadata={}) ), nullable=False, metadata={}, - ) - ), - nullable=False, - metadata={}, - ), - pa.field( - "fixed_size_shenanigans", - pa.list_( - pa.field("item", pa.float32(), nullable=False, metadata={}), 3 - ), - nullable=False, - metadata={}, - ), - ] - ), - nullable=False, - metadata={}, - ) - ), - nullable=False, - metadata={}, - ), - pa.field( - "many_optional", - pa.list_( - pa.field( - "item", - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("degrees", pa.float32(), nullable=False, metadata={}), - pa.field("radians", pa.float32(), nullable=False, metadata={}), - pa.field( - "craziness", - pa.list_( + ), pa.field( - "item", - pa.struct( - [ - pa.field( - "single_float_optional", - pa.float32(), - nullable=True, - metadata={}, - ), - pa.field( - "single_string_required", - pa.utf8(), - nullable=False, - metadata={}, - ), - pa.field( - "single_string_optional", - pa.utf8(), - nullable=True, - metadata={}, - ), - pa.field( - "many_floats_optional", - pa.list_( - pa.field( - "item", - pa.float32(), - nullable=False, - metadata={}, - ) - ), - nullable=True, - metadata={}, - ), - pa.field( - "many_strings_required", - pa.list_( - pa.field( - "item", - pa.utf8(), - nullable=False, - metadata={}, - ) - ), - nullable=False, - metadata={}, - ), - pa.field( - "many_strings_optional", - pa.list_( - pa.field( - "item", - pa.utf8(), - nullable=False, - metadata={}, - ) - ), - nullable=True, - metadata={}, - ), - pa.field( - "flattened_scalar", - pa.float32(), - nullable=False, - metadata={}, - ), - pa.field( - "almost_flattened_scalar", - pa.struct( - [ - pa.field( - "value", - pa.float32(), - nullable=False, - metadata={}, - ) - ] - ), - nullable=False, - metadata={}, - ), - pa.field( - "from_parent", - pa.bool_(), - nullable=True, - metadata={}, - ), - ] + "many_strings_optional", + pa.list_( + pa.field("item", pa.utf8(), nullable=False, metadata={}) ), + nullable=True, + metadata={}, + ), + pa.field( + "flattened_scalar", + pa.float32(), nullable=False, metadata={}, - ) - ), - nullable=False, - metadata={}, - ), - pa.field( - "fixed_size_shenanigans", - pa.list_( - pa.field("item", pa.float32(), nullable=False, metadata={}), 3 - ), + ), + pa.field( + "almost_flattened_scalar", + pa.struct([ + pa.field( + "value", pa.float32(), nullable=False, metadata={} + ) + ]), + nullable=False, + metadata={}, + ), + pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), + ]), nullable=False, metadata={}, - ), - ] + ) + ), + nullable=False, + metadata={}, ), - nullable=False, - metadata={}, - ) - ), - nullable=False, - metadata={}, + pa.field( + "fixed_size_shenanigans", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=False, + metadata={}, + ), + ]), + nullable=False, + metadata={}, + ) ), - ] - ), + nullable=False, + metadata={}, + ), + ]), nullable=False, metadata={}, ) diff --git a/rerun_py/tests/test_types/components/affix_fuzzer7.py b/rerun_py/tests/test_types/components/affix_fuzzer7.py index 3902fb9a733c..13adb7102f3d 100644 --- a/rerun_py/tests/test_types/components/affix_fuzzer7.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer7.py @@ -43,39 +43,37 @@ def __init__(self) -> None: pa.list_( pa.field( "item", - pa.struct( - [ - pa.field("single_float_optional", pa.float32(), nullable=True, metadata={}), - pa.field("single_string_required", pa.utf8(), nullable=False, metadata={}), - pa.field("single_string_optional", pa.utf8(), nullable=True, metadata={}), - pa.field( - "many_floats_optional", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={})), - nullable=True, - metadata={}, - ), - pa.field( - "many_strings_required", - pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "many_strings_optional", - pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), - nullable=True, - metadata={}, - ), - pa.field("flattened_scalar", pa.float32(), nullable=False, metadata={}), - pa.field( - "almost_flattened_scalar", - pa.struct([pa.field("value", pa.float32(), nullable=False, metadata={})]), - nullable=False, - metadata={}, - ), - pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), - ] - ), + pa.struct([ + pa.field("single_float_optional", pa.float32(), nullable=True, metadata={}), + pa.field("single_string_required", pa.utf8(), nullable=False, metadata={}), + pa.field("single_string_optional", pa.utf8(), nullable=True, metadata={}), + pa.field( + "many_floats_optional", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={})), + nullable=True, + metadata={}, + ), + pa.field( + "many_strings_required", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "many_strings_optional", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=True, + metadata={}, + ), + pa.field("flattened_scalar", pa.float32(), nullable=False, metadata={}), + pa.field( + "almost_flattened_scalar", + pa.struct([pa.field("value", pa.float32(), nullable=False, metadata={})]), + nullable=False, + metadata={}, + ), + pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), + ]), nullable=False, metadata={}, ) diff --git a/rerun_py/tests/test_types/components/enum_test.py b/rerun_py/tests/test_types/components/enum_test.py index d0e5325520fc..c57d80a06268 100644 --- a/rerun_py/tests/test_types/components/enum_test.py +++ b/rerun_py/tests/test_types/components/enum_test.py @@ -48,17 +48,15 @@ class EnumTestType(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.sparse_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("Up", pa.null(), nullable=True, metadata={}), - pa.field("Down", pa.null(), nullable=True, metadata={}), - pa.field("Right", pa.null(), nullable=True, metadata={}), - pa.field("Left", pa.null(), nullable=True, metadata={}), - pa.field("Forward", pa.null(), nullable=True, metadata={}), - pa.field("Back", pa.null(), nullable=True, metadata={}), - ] - ), + pa.sparse_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("Up", pa.null(), nullable=True, metadata={}), + pa.field("Down", pa.null(), nullable=True, metadata={}), + pa.field("Right", pa.null(), nullable=True, metadata={}), + pa.field("Left", pa.null(), nullable=True, metadata={}), + pa.field("Forward", pa.null(), nullable=True, metadata={}), + pa.field("Back", pa.null(), nullable=True, metadata={}), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/tests/test_types/datatypes/affix_fuzzer1.py b/rerun_py/tests/test_types/datatypes/affix_fuzzer1.py index c9b69542b4fc..7496d15d1773 100644 --- a/rerun_py/tests/test_types/datatypes/affix_fuzzer1.py +++ b/rerun_py/tests/test_types/datatypes/affix_fuzzer1.py @@ -88,39 +88,37 @@ class AffixFuzzer1Type(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.struct( - [ - pa.field("single_float_optional", pa.float32(), nullable=True, metadata={}), - pa.field("single_string_required", pa.utf8(), nullable=False, metadata={}), - pa.field("single_string_optional", pa.utf8(), nullable=True, metadata={}), - pa.field( - "many_floats_optional", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={})), - nullable=True, - metadata={}, - ), - pa.field( - "many_strings_required", - pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "many_strings_optional", - pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), - nullable=True, - metadata={}, - ), - pa.field("flattened_scalar", pa.float32(), nullable=False, metadata={}), - pa.field( - "almost_flattened_scalar", - pa.struct([pa.field("value", pa.float32(), nullable=False, metadata={})]), - nullable=False, - metadata={}, - ), - pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), - ] - ), + pa.struct([ + pa.field("single_float_optional", pa.float32(), nullable=True, metadata={}), + pa.field("single_string_required", pa.utf8(), nullable=False, metadata={}), + pa.field("single_string_optional", pa.utf8(), nullable=True, metadata={}), + pa.field( + "many_floats_optional", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={})), + nullable=True, + metadata={}, + ), + pa.field( + "many_strings_required", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "many_strings_optional", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=True, + metadata={}, + ), + pa.field("flattened_scalar", pa.float32(), nullable=False, metadata={}), + pa.field( + "almost_flattened_scalar", + pa.struct([pa.field("value", pa.float32(), nullable=False, metadata={})]), + nullable=False, + metadata={}, + ), + pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/tests/test_types/datatypes/affix_fuzzer20.py b/rerun_py/tests/test_types/datatypes/affix_fuzzer20.py index 3ec3196bb726..af092d58ba59 100644 --- a/rerun_py/tests/test_types/datatypes/affix_fuzzer20.py +++ b/rerun_py/tests/test_types/datatypes/affix_fuzzer20.py @@ -57,12 +57,10 @@ class AffixFuzzer20Type(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.struct( - [ - pa.field("p", pa.uint32(), nullable=False, metadata={}), - pa.field("s", pa.utf8(), nullable=False, metadata={}), - ] - ), + pa.struct([ + pa.field("p", pa.uint32(), nullable=False, metadata={}), + pa.field("s", pa.utf8(), nullable=False, metadata={}), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/tests/test_types/datatypes/affix_fuzzer21.py b/rerun_py/tests/test_types/datatypes/affix_fuzzer21.py index e45c8cc35cde..ab09b21a9bc8 100644 --- a/rerun_py/tests/test_types/datatypes/affix_fuzzer21.py +++ b/rerun_py/tests/test_types/datatypes/affix_fuzzer21.py @@ -44,17 +44,15 @@ class AffixFuzzer21Type(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.struct( - [ - pa.field("single_half", pa.float16(), nullable=False, metadata={}), - pa.field( - "many_halves", - pa.list_(pa.field("item", pa.float16(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - ] - ), + pa.struct([ + pa.field("single_half", pa.float16(), nullable=False, metadata={}), + pa.field( + "many_halves", + pa.list_(pa.field("item", pa.float16(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/tests/test_types/datatypes/affix_fuzzer22.py b/rerun_py/tests/test_types/datatypes/affix_fuzzer22.py index 940bd360cb50..6e732c2ce20e 100644 --- a/rerun_py/tests/test_types/datatypes/affix_fuzzer22.py +++ b/rerun_py/tests/test_types/datatypes/affix_fuzzer22.py @@ -47,16 +47,14 @@ class AffixFuzzer22Type(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.struct( - [ - pa.field( - "fixed_sized_native", - pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={}), 4), - nullable=False, - metadata={}, - ) - ] - ), + pa.struct([ + pa.field( + "fixed_sized_native", + pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={}), 4), + nullable=False, + metadata={}, + ) + ]), self._TYPE_NAME, ) diff --git a/rerun_py/tests/test_types/datatypes/affix_fuzzer3.py b/rerun_py/tests/test_types/datatypes/affix_fuzzer3.py index e9558ce2f2a7..3030782c0d40 100644 --- a/rerun_py/tests/test_types/datatypes/affix_fuzzer3.py +++ b/rerun_py/tests/test_types/datatypes/affix_fuzzer3.py @@ -74,64 +74,60 @@ class AffixFuzzer3Type(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("degrees", pa.float32(), nullable=False, metadata={}), - pa.field("radians", pa.float32(), nullable=False, metadata={}), - pa.field( - "craziness", - pa.list_( - pa.field( - "item", - pa.struct( - [ - pa.field("single_float_optional", pa.float32(), nullable=True, metadata={}), - pa.field("single_string_required", pa.utf8(), nullable=False, metadata={}), - pa.field("single_string_optional", pa.utf8(), nullable=True, metadata={}), - pa.field( - "many_floats_optional", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={})), - nullable=True, - metadata={}, - ), - pa.field( - "many_strings_required", - pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), - nullable=False, - metadata={}, - ), - pa.field( - "many_strings_optional", - pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), - nullable=True, - metadata={}, - ), - pa.field("flattened_scalar", pa.float32(), nullable=False, metadata={}), - pa.field( - "almost_flattened_scalar", - pa.struct([pa.field("value", pa.float32(), nullable=False, metadata={})]), - nullable=False, - metadata={}, - ), - pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), - ] + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("degrees", pa.float32(), nullable=False, metadata={}), + pa.field("radians", pa.float32(), nullable=False, metadata={}), + pa.field( + "craziness", + pa.list_( + pa.field( + "item", + pa.struct([ + pa.field("single_float_optional", pa.float32(), nullable=True, metadata={}), + pa.field("single_string_required", pa.utf8(), nullable=False, metadata={}), + pa.field("single_string_optional", pa.utf8(), nullable=True, metadata={}), + pa.field( + "many_floats_optional", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={})), + nullable=True, + metadata={}, ), - nullable=False, - metadata={}, - ) - ), - nullable=False, - metadata={}, - ), - pa.field( - "fixed_size_shenanigans", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), - nullable=False, - metadata={}, + pa.field( + "many_strings_required", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "many_strings_optional", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=True, + metadata={}, + ), + pa.field("flattened_scalar", pa.float32(), nullable=False, metadata={}), + pa.field( + "almost_flattened_scalar", + pa.struct([pa.field("value", pa.float32(), nullable=False, metadata={})]), + nullable=False, + metadata={}, + ), + pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), + ]), + nullable=False, + metadata={}, + ) ), - ] - ), + nullable=False, + metadata={}, + ), + pa.field( + "fixed_size_shenanigans", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=False, + metadata={}, + ), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/tests/test_types/datatypes/affix_fuzzer4.py b/rerun_py/tests/test_types/datatypes/affix_fuzzer4.py index 77932d2fc75c..672729cd04b2 100644 --- a/rerun_py/tests/test_types/datatypes/affix_fuzzer4.py +++ b/rerun_py/tests/test_types/datatypes/affix_fuzzer4.py @@ -66,13 +66,73 @@ class AffixFuzzer4Type(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field( - "single_required", - pa.dense_union( - [ + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field( + "single_required", + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("degrees", pa.float32(), nullable=False, metadata={}), + pa.field("radians", pa.float32(), nullable=False, metadata={}), + pa.field( + "craziness", + pa.list_( + pa.field( + "item", + pa.struct([ + pa.field("single_float_optional", pa.float32(), nullable=True, metadata={}), + pa.field("single_string_required", pa.utf8(), nullable=False, metadata={}), + pa.field("single_string_optional", pa.utf8(), nullable=True, metadata={}), + pa.field( + "many_floats_optional", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={})), + nullable=True, + metadata={}, + ), + pa.field( + "many_strings_required", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "many_strings_optional", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=True, + metadata={}, + ), + pa.field("flattened_scalar", pa.float32(), nullable=False, metadata={}), + pa.field( + "almost_flattened_scalar", + pa.struct([pa.field("value", pa.float32(), nullable=False, metadata={})]), + nullable=False, + metadata={}, + ), + pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), + ]), + nullable=False, + metadata={}, + ) + ), + nullable=False, + metadata={}, + ), + pa.field( + "fixed_size_shenanigans", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=False, + metadata={}, + ), + ]), + nullable=False, + metadata={}, + ), + pa.field( + "many_required", + pa.list_( + pa.field( + "item", + pa.dense_union([ pa.field("_null_markers", pa.null(), nullable=True, metadata={}), pa.field("degrees", pa.float32(), nullable=False, metadata={}), pa.field("radians", pa.float32(), nullable=False, metadata={}), @@ -81,62 +141,47 @@ def __init__(self) -> None: pa.list_( pa.field( "item", - pa.struct( - [ - pa.field( - "single_float_optional", - pa.float32(), - nullable=True, - metadata={}, - ), - pa.field( - "single_string_required", pa.utf8(), nullable=False, metadata={} - ), - pa.field( - "single_string_optional", pa.utf8(), nullable=True, metadata={} - ), - pa.field( - "many_floats_optional", - pa.list_( - pa.field("item", pa.float32(), nullable=False, metadata={}) - ), - nullable=True, - metadata={}, - ), - pa.field( - "many_strings_required", - pa.list_( - pa.field("item", pa.utf8(), nullable=False, metadata={}) - ), - nullable=False, - metadata={}, - ), - pa.field( - "many_strings_optional", - pa.list_( - pa.field("item", pa.utf8(), nullable=False, metadata={}) - ), - nullable=True, - metadata={}, - ), - pa.field( - "flattened_scalar", pa.float32(), nullable=False, metadata={} - ), - pa.field( - "almost_flattened_scalar", - pa.struct( - [ - pa.field( - "value", pa.float32(), nullable=False, metadata={} - ) - ] - ), - nullable=False, - metadata={}, + pa.struct([ + pa.field( + "single_float_optional", pa.float32(), nullable=True, metadata={} + ), + pa.field( + "single_string_required", pa.utf8(), nullable=False, metadata={} + ), + pa.field( + "single_string_optional", pa.utf8(), nullable=True, metadata={} + ), + pa.field( + "many_floats_optional", + pa.list_( + pa.field("item", pa.float32(), nullable=False, metadata={}) ), - pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), - ] - ), + nullable=True, + metadata={}, + ), + pa.field( + "many_strings_required", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "many_strings_optional", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=True, + metadata={}, + ), + pa.field("flattened_scalar", pa.float32(), nullable=False, metadata={}), + pa.field( + "almost_flattened_scalar", + pa.struct([ + pa.field("value", pa.float32(), nullable=False, metadata={}) + ]), + nullable=False, + metadata={}, + ), + pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), + ]), nullable=False, metadata={}, ) @@ -150,245 +195,91 @@ def __init__(self) -> None: nullable=False, metadata={}, ), - ] - ), - nullable=False, - metadata={}, + ]), + nullable=False, + metadata={}, + ) ), - pa.field( - "many_required", - pa.list_( - pa.field( - "item", - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("degrees", pa.float32(), nullable=False, metadata={}), - pa.field("radians", pa.float32(), nullable=False, metadata={}), + nullable=False, + metadata={}, + ), + pa.field( + "many_optional", + pa.list_( + pa.field( + "item", + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("degrees", pa.float32(), nullable=False, metadata={}), + pa.field("radians", pa.float32(), nullable=False, metadata={}), + pa.field( + "craziness", + pa.list_( pa.field( - "craziness", - pa.list_( + "item", + pa.struct([ pa.field( - "item", - pa.struct( - [ - pa.field( - "single_float_optional", - pa.float32(), - nullable=True, - metadata={}, - ), - pa.field( - "single_string_required", - pa.utf8(), - nullable=False, - metadata={}, - ), - pa.field( - "single_string_optional", - pa.utf8(), - nullable=True, - metadata={}, - ), - pa.field( - "many_floats_optional", - pa.list_( - pa.field( - "item", - pa.float32(), - nullable=False, - metadata={}, - ) - ), - nullable=True, - metadata={}, - ), - pa.field( - "many_strings_required", - pa.list_( - pa.field( - "item", pa.utf8(), nullable=False, metadata={} - ) - ), - nullable=False, - metadata={}, - ), - pa.field( - "many_strings_optional", - pa.list_( - pa.field( - "item", pa.utf8(), nullable=False, metadata={} - ) - ), - nullable=True, - metadata={}, - ), - pa.field( - "flattened_scalar", - pa.float32(), - nullable=False, - metadata={}, - ), - pa.field( - "almost_flattened_scalar", - pa.struct( - [ - pa.field( - "value", - pa.float32(), - nullable=False, - metadata={}, - ) - ] - ), - nullable=False, - metadata={}, - ), - pa.field( - "from_parent", pa.bool_(), nullable=True, metadata={} - ), - ] + "single_float_optional", pa.float32(), nullable=True, metadata={} + ), + pa.field( + "single_string_required", pa.utf8(), nullable=False, metadata={} + ), + pa.field( + "single_string_optional", pa.utf8(), nullable=True, metadata={} + ), + pa.field( + "many_floats_optional", + pa.list_( + pa.field("item", pa.float32(), nullable=False, metadata={}) ), + nullable=True, + metadata={}, + ), + pa.field( + "many_strings_required", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), nullable=False, metadata={}, - ) - ), - nullable=False, - metadata={}, - ), - pa.field( - "fixed_size_shenanigans", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), - nullable=False, - metadata={}, - ), - ] - ), - nullable=False, - metadata={}, - ) - ), - nullable=False, - metadata={}, - ), - pa.field( - "many_optional", - pa.list_( - pa.field( - "item", - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("degrees", pa.float32(), nullable=False, metadata={}), - pa.field("radians", pa.float32(), nullable=False, metadata={}), - pa.field( - "craziness", - pa.list_( + ), pa.field( - "item", - pa.struct( - [ - pa.field( - "single_float_optional", - pa.float32(), - nullable=True, - metadata={}, - ), - pa.field( - "single_string_required", - pa.utf8(), - nullable=False, - metadata={}, - ), - pa.field( - "single_string_optional", - pa.utf8(), - nullable=True, - metadata={}, - ), - pa.field( - "many_floats_optional", - pa.list_( - pa.field( - "item", - pa.float32(), - nullable=False, - metadata={}, - ) - ), - nullable=True, - metadata={}, - ), - pa.field( - "many_strings_required", - pa.list_( - pa.field( - "item", pa.utf8(), nullable=False, metadata={} - ) - ), - nullable=False, - metadata={}, - ), - pa.field( - "many_strings_optional", - pa.list_( - pa.field( - "item", pa.utf8(), nullable=False, metadata={} - ) - ), - nullable=True, - metadata={}, - ), - pa.field( - "flattened_scalar", - pa.float32(), - nullable=False, - metadata={}, - ), - pa.field( - "almost_flattened_scalar", - pa.struct( - [ - pa.field( - "value", - pa.float32(), - nullable=False, - metadata={}, - ) - ] - ), - nullable=False, - metadata={}, - ), - pa.field( - "from_parent", pa.bool_(), nullable=True, metadata={} - ), - ] - ), + "many_strings_optional", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=True, + metadata={}, + ), + pa.field("flattened_scalar", pa.float32(), nullable=False, metadata={}), + pa.field( + "almost_flattened_scalar", + pa.struct([ + pa.field("value", pa.float32(), nullable=False, metadata={}) + ]), nullable=False, metadata={}, - ) - ), - nullable=False, - metadata={}, - ), - pa.field( - "fixed_size_shenanigans", - pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + ), + pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), + ]), nullable=False, metadata={}, - ), - ] + ) + ), + nullable=False, + metadata={}, ), - nullable=False, - metadata={}, - ) - ), - nullable=False, - metadata={}, + pa.field( + "fixed_size_shenanigans", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=False, + metadata={}, + ), + ]), + nullable=False, + metadata={}, + ) ), - ] - ), + nullable=False, + metadata={}, + ), + ]), self._TYPE_NAME, ) diff --git a/rerun_py/tests/test_types/datatypes/affix_fuzzer5.py b/rerun_py/tests/test_types/datatypes/affix_fuzzer5.py index c110886cea93..4bd517892ea4 100644 --- a/rerun_py/tests/test_types/datatypes/affix_fuzzer5.py +++ b/rerun_py/tests/test_types/datatypes/affix_fuzzer5.py @@ -53,396 +53,281 @@ class AffixFuzzer5Type(BaseExtensionType): def __init__(self) -> None: pa.ExtensionType.__init__( self, - pa.struct( - [ - pa.field( - "single_optional_union", - pa.dense_union( - [ + pa.struct([ + pa.field( + "single_optional_union", + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field( + "single_required", + pa.dense_union([ pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("degrees", pa.float32(), nullable=False, metadata={}), + pa.field("radians", pa.float32(), nullable=False, metadata={}), pa.field( - "single_required", - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("degrees", pa.float32(), nullable=False, metadata={}), - pa.field("radians", pa.float32(), nullable=False, metadata={}), - pa.field( - "craziness", - pa.list_( - pa.field( - "item", - pa.struct( - [ - pa.field( - "single_float_optional", - pa.float32(), - nullable=True, - metadata={}, - ), - pa.field( - "single_string_required", - pa.utf8(), - nullable=False, - metadata={}, - ), - pa.field( - "single_string_optional", - pa.utf8(), - nullable=True, - metadata={}, - ), - pa.field( - "many_floats_optional", - pa.list_( - pa.field( - "item", - pa.float32(), - nullable=False, - metadata={}, - ) - ), - nullable=True, - metadata={}, - ), - pa.field( - "many_strings_required", - pa.list_( - pa.field( - "item", - pa.utf8(), - nullable=False, - metadata={}, - ) - ), - nullable=False, - metadata={}, - ), - pa.field( - "many_strings_optional", - pa.list_( - pa.field( - "item", - pa.utf8(), - nullable=False, - metadata={}, - ) - ), - nullable=True, - metadata={}, - ), - pa.field( - "flattened_scalar", - pa.float32(), - nullable=False, - metadata={}, - ), - pa.field( - "almost_flattened_scalar", - pa.struct( - [ - pa.field( - "value", - pa.float32(), - nullable=False, - metadata={}, - ) - ] - ), - nullable=False, - metadata={}, - ), - pa.field( - "from_parent", - pa.bool_(), - nullable=True, - metadata={}, - ), - ] - ), - nullable=False, - metadata={}, - ) + "craziness", + pa.list_( + pa.field( + "item", + pa.struct([ + pa.field( + "single_float_optional", pa.float32(), nullable=True, metadata={} ), - nullable=False, - metadata={}, - ), - pa.field( - "fixed_size_shenanigans", - pa.list_( - pa.field("item", pa.float32(), nullable=False, metadata={}), 3 + pa.field( + "single_string_required", pa.utf8(), nullable=False, metadata={} ), - nullable=False, - metadata={}, - ), - ] + pa.field( + "single_string_optional", pa.utf8(), nullable=True, metadata={} + ), + pa.field( + "many_floats_optional", + pa.list_( + pa.field("item", pa.float32(), nullable=False, metadata={}) + ), + nullable=True, + metadata={}, + ), + pa.field( + "many_strings_required", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "many_strings_optional", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=True, + metadata={}, + ), + pa.field("flattened_scalar", pa.float32(), nullable=False, metadata={}), + pa.field( + "almost_flattened_scalar", + pa.struct([ + pa.field("value", pa.float32(), nullable=False, metadata={}) + ]), + nullable=False, + metadata={}, + ), + pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), + ]), + nullable=False, + metadata={}, + ) ), nullable=False, metadata={}, ), pa.field( - "many_required", - pa.list_( + "fixed_size_shenanigans", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=False, + metadata={}, + ), + ]), + nullable=False, + metadata={}, + ), + pa.field( + "many_required", + pa.list_( + pa.field( + "item", + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("degrees", pa.float32(), nullable=False, metadata={}), + pa.field("radians", pa.float32(), nullable=False, metadata={}), pa.field( - "item", - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("degrees", pa.float32(), nullable=False, metadata={}), - pa.field("radians", pa.float32(), nullable=False, metadata={}), - pa.field( - "craziness", - pa.list_( - pa.field( - "item", - pa.struct( - [ - pa.field( - "single_float_optional", - pa.float32(), - nullable=True, - metadata={}, - ), - pa.field( - "single_string_required", - pa.utf8(), - nullable=False, - metadata={}, - ), - pa.field( - "single_string_optional", - pa.utf8(), - nullable=True, - metadata={}, - ), - pa.field( - "many_floats_optional", - pa.list_( - pa.field( - "item", - pa.float32(), - nullable=False, - metadata={}, - ) - ), - nullable=True, - metadata={}, - ), - pa.field( - "many_strings_required", - pa.list_( - pa.field( - "item", - pa.utf8(), - nullable=False, - metadata={}, - ) - ), - nullable=False, - metadata={}, - ), - pa.field( - "many_strings_optional", - pa.list_( - pa.field( - "item", - pa.utf8(), - nullable=False, - metadata={}, - ) - ), - nullable=True, - metadata={}, - ), - pa.field( - "flattened_scalar", - pa.float32(), - nullable=False, - metadata={}, - ), - pa.field( - "almost_flattened_scalar", - pa.struct( - [ - pa.field( - "value", - pa.float32(), - nullable=False, - metadata={}, - ) - ] - ), - nullable=False, - metadata={}, - ), - pa.field( - "from_parent", - pa.bool_(), - nullable=True, - metadata={}, - ), - ] - ), - nullable=False, - metadata={}, - ) + "craziness", + pa.list_( + pa.field( + "item", + pa.struct([ + pa.field( + "single_float_optional", + pa.float32(), + nullable=True, + metadata={}, ), - nullable=False, - metadata={}, - ), - pa.field( - "fixed_size_shenanigans", - pa.list_( - pa.field("item", pa.float32(), nullable=False, metadata={}), - 3, + pa.field( + "single_string_required", + pa.utf8(), + nullable=False, + metadata={}, ), - nullable=False, - metadata={}, - ), - ] + pa.field( + "single_string_optional", + pa.utf8(), + nullable=True, + metadata={}, + ), + pa.field( + "many_floats_optional", + pa.list_( + pa.field( + "item", pa.float32(), nullable=False, metadata={} + ) + ), + nullable=True, + metadata={}, + ), + pa.field( + "many_strings_required", + pa.list_( + pa.field("item", pa.utf8(), nullable=False, metadata={}) + ), + nullable=False, + metadata={}, + ), + pa.field( + "many_strings_optional", + pa.list_( + pa.field("item", pa.utf8(), nullable=False, metadata={}) + ), + nullable=True, + metadata={}, + ), + pa.field( + "flattened_scalar", + pa.float32(), + nullable=False, + metadata={}, + ), + pa.field( + "almost_flattened_scalar", + pa.struct([ + pa.field( + "value", pa.float32(), nullable=False, metadata={} + ) + ]), + nullable=False, + metadata={}, + ), + pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), + ]), + nullable=False, + metadata={}, + ) ), nullable=False, metadata={}, - ) - ), + ), + pa.field( + "fixed_size_shenanigans", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=False, + metadata={}, + ), + ]), nullable=False, metadata={}, - ), + ) + ), + nullable=False, + metadata={}, + ), + pa.field( + "many_optional", + pa.list_( pa.field( - "many_optional", - pa.list_( + "item", + pa.dense_union([ + pa.field("_null_markers", pa.null(), nullable=True, metadata={}), + pa.field("degrees", pa.float32(), nullable=False, metadata={}), + pa.field("radians", pa.float32(), nullable=False, metadata={}), pa.field( - "item", - pa.dense_union( - [ - pa.field("_null_markers", pa.null(), nullable=True, metadata={}), - pa.field("degrees", pa.float32(), nullable=False, metadata={}), - pa.field("radians", pa.float32(), nullable=False, metadata={}), - pa.field( - "craziness", - pa.list_( - pa.field( - "item", - pa.struct( - [ - pa.field( - "single_float_optional", - pa.float32(), - nullable=True, - metadata={}, - ), - pa.field( - "single_string_required", - pa.utf8(), - nullable=False, - metadata={}, - ), - pa.field( - "single_string_optional", - pa.utf8(), - nullable=True, - metadata={}, - ), - pa.field( - "many_floats_optional", - pa.list_( - pa.field( - "item", - pa.float32(), - nullable=False, - metadata={}, - ) - ), - nullable=True, - metadata={}, - ), - pa.field( - "many_strings_required", - pa.list_( - pa.field( - "item", - pa.utf8(), - nullable=False, - metadata={}, - ) - ), - nullable=False, - metadata={}, - ), - pa.field( - "many_strings_optional", - pa.list_( - pa.field( - "item", - pa.utf8(), - nullable=False, - metadata={}, - ) - ), - nullable=True, - metadata={}, - ), - pa.field( - "flattened_scalar", - pa.float32(), - nullable=False, - metadata={}, - ), - pa.field( - "almost_flattened_scalar", - pa.struct( - [ - pa.field( - "value", - pa.float32(), - nullable=False, - metadata={}, - ) - ] - ), - nullable=False, - metadata={}, - ), - pa.field( - "from_parent", - pa.bool_(), - nullable=True, - metadata={}, - ), - ] - ), - nullable=False, - metadata={}, - ) + "craziness", + pa.list_( + pa.field( + "item", + pa.struct([ + pa.field( + "single_float_optional", + pa.float32(), + nullable=True, + metadata={}, ), - nullable=False, - metadata={}, - ), - pa.field( - "fixed_size_shenanigans", - pa.list_( - pa.field("item", pa.float32(), nullable=False, metadata={}), - 3, + pa.field( + "single_string_required", + pa.utf8(), + nullable=False, + metadata={}, ), - nullable=False, - metadata={}, - ), - ] + pa.field( + "single_string_optional", + pa.utf8(), + nullable=True, + metadata={}, + ), + pa.field( + "many_floats_optional", + pa.list_( + pa.field( + "item", pa.float32(), nullable=False, metadata={} + ) + ), + nullable=True, + metadata={}, + ), + pa.field( + "many_strings_required", + pa.list_( + pa.field("item", pa.utf8(), nullable=False, metadata={}) + ), + nullable=False, + metadata={}, + ), + pa.field( + "many_strings_optional", + pa.list_( + pa.field("item", pa.utf8(), nullable=False, metadata={}) + ), + nullable=True, + metadata={}, + ), + pa.field( + "flattened_scalar", + pa.float32(), + nullable=False, + metadata={}, + ), + pa.field( + "almost_flattened_scalar", + pa.struct([ + pa.field( + "value", pa.float32(), nullable=False, metadata={} + ) + ]), + nullable=False, + metadata={}, + ), + pa.field("from_parent", pa.bool_(), nullable=True, metadata={}), + ]), + nullable=False, + metadata={}, + ) ), nullable=False, metadata={}, - ) - ), + ), + pa.field( + "fixed_size_shenanigans", + pa.list_(pa.field("item", pa.float32(), nullable=False, metadata={}), 3), + nullable=False, + metadata={}, + ), + ]), nullable=False, metadata={}, - ), - ] + ) + ), + nullable=False, + metadata={}, ), - nullable=True, - metadata={}, - ) - ] - ), + ]), + nullable=True, + metadata={}, + ) + ]), self._TYPE_NAME, ) diff --git a/rerun_py/tests/unit/test_line_strips2d.py b/rerun_py/tests/unit/test_line_strips2d.py index c4ff870008b3..979a038480fb 100644 --- a/rerun_py/tests/unit/test_line_strips2d.py +++ b/rerun_py/tests/unit/test_line_strips2d.py @@ -127,12 +127,10 @@ def test_line_strips2d() -> None: def test_line_segments2d(data: LineStrip2DArrayLike) -> None: arch = rr.LineStrips2D(data) - assert arch.strips == LineStrip2DBatch( - [ - [[0, 0], [2, 1]], - [[4, -1], [6, 0]], - ] - ) + assert arch.strips == LineStrip2DBatch([ + [[0, 0], [2, 1]], + [[4, -1], [6, 0]], + ]) def test_single_line_strip2d() -> None: @@ -169,21 +167,17 @@ def test_line_strip2d_invalid_shapes() -> None: # not homogeneous numpy arrays with pytest.raises(ValueError): rr.LineStrips2D( - np.array( - [ - [[0, 0], (2, 1), [4, -1], (6, 0)], - [[0, 3], (1, 4), [2, 2], (3, 4), [4, 2], (5, 4), [6, 3]], - ] - ) + np.array([ + [[0, 0], (2, 1), [4, -1], (6, 0)], + [[0, 3], (1, 4), [2, 2], (3, 4), [4, 2], (5, 4), [6, 3]], + ]) ) with pytest.raises(ValueError): rr.LineStrips2D( - np.array( - [ - [0, 0, 2, 1, 4, -1, 6, 0], - [0, 3, 1, 4, 2, 2, 3, 4, 4, 2, 5, 4, 6, 3], - ] - ), + np.array([ + [0, 0, 2, 1, 4, -1, 6, 0], + [0, 3, 1, 4, 2, 2, 3, 4, 4, 2, 5, 4, 6, 3], + ]), ) diff --git a/rerun_py/tests/unit/test_line_strips3d.py b/rerun_py/tests/unit/test_line_strips3d.py index f19583fd644c..fc8e3a628dc8 100644 --- a/rerun_py/tests/unit/test_line_strips3d.py +++ b/rerun_py/tests/unit/test_line_strips3d.py @@ -175,22 +175,18 @@ def test_line_strip2d_invalid_shapes() -> None: with pytest.raises(ValueError): rr.LineStrips3D( np.array( - np.array( - [ - [([0, 0, 2]), [1, 0, 2], [1, 1, 2], [0, 1, 2]], - [([0, 0, 0]), [0, 0, 1], [1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 1], [0, 1, 0], [0, 1, 1]], - ] - ), + np.array([ + [([0, 0, 2]), [1, 0, 2], [1, 1, 2], [0, 1, 2]], + [([0, 0, 0]), [0, 0, 1], [1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 1], [0, 1, 0], [0, 1, 1]], + ]), ) ) with pytest.raises(ValueError): rr.LineStrips3D( - np.array( - [ - [0, 0, 2, 1, 4, -1, 6, 0], - [0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1], - ] - ), + np.array([ + [0, 0, 2, 1, 4, -1, 6, 0], + [0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1], + ]), ) diff --git a/rerun_py/tests/unit/test_mesh3d.py b/rerun_py/tests/unit/test_mesh3d.py index e9185b377034..bab3c59c777b 100644 --- a/rerun_py/tests/unit/test_mesh3d.py +++ b/rerun_py/tests/unit/test_mesh3d.py @@ -124,21 +124,17 @@ def test_nullable_albedo_factor() -> None: # NOTE: We're just making sure that this doesn't crash… trust me, it used to. assert ( len( - MaterialBatch( - [ - Material(albedo_factor=[0xCC, 0x00, 0xCC, 0xFF]), - ] - ) + MaterialBatch([ + Material(albedo_factor=[0xCC, 0x00, 0xCC, 0xFF]), + ]) ) == 1 ) assert ( len( - MaterialBatch( - [ - Material(), - ] - ) + MaterialBatch([ + Material(), + ]) ) == 1 ) @@ -148,12 +144,10 @@ def test_nullable_indices() -> None: # NOTE: We're just making sure that this doesn't crash… trust me, it used to. assert ( len( - MeshPropertiesBatch( - [ - MeshProperties(indices=[1, 2, 3, 4, 5, 6]), - MeshProperties(), - ] - ) + MeshPropertiesBatch([ + MeshProperties(indices=[1, 2, 3, 4, 5, 6]), + MeshProperties(), + ]) ) == 2 ) diff --git a/rerun_py/tests/unit/test_points2d.py b/rerun_py/tests/unit/test_points2d.py index 67cd83b49ec1..fd10f1b976a1 100644 --- a/rerun_py/tests/unit/test_points2d.py +++ b/rerun_py/tests/unit/test_points2d.py @@ -130,12 +130,10 @@ def test_point2d_single_color(data: Rgba32ArrayLike) -> None: def test_point2d_multiple_colors(data: Rgba32ArrayLike) -> None: pts = rr.Points2D(positions=np.zeros((5, 2)), colors=data) - assert pts.colors == ColorBatch( - [ - Color([0, 128, 0, 255]), - Color([128, 0, 0, 255]), - ] - ) + assert pts.colors == ColorBatch([ + Color([0, 128, 0, 255]), + Color([128, 0, 0, 255]), + ]) if __name__ == "__main__": diff --git a/rerun_py/tests/unit/test_points3d.py b/rerun_py/tests/unit/test_points3d.py index 1c691698ba59..0d4a7d5738a4 100644 --- a/rerun_py/tests/unit/test_points3d.py +++ b/rerun_py/tests/unit/test_points3d.py @@ -122,12 +122,10 @@ def test_point3d_single_color(data: Rgba32ArrayLike) -> None: def test_point3d_multiple_colors(data: Rgba32ArrayLike) -> None: pts = rr.Points3D(positions=np.zeros((5, 3)), colors=data) - assert pts.colors == ColorBatch( - [ - Color([0, 128, 0, 255]), - Color([128, 0, 0, 255]), - ] - ) + assert pts.colors == ColorBatch([ + Color([0, 128, 0, 255]), + Color([128, 0, 0, 255]), + ]) if __name__ == "__main__": diff --git a/rerun_py/tests/unit/test_view_coordinates.py b/rerun_py/tests/unit/test_view_coordinates.py index 057e2239bd46..9f084469723c 100644 --- a/rerun_py/tests/unit/test_view_coordinates.py +++ b/rerun_py/tests/unit/test_view_coordinates.py @@ -18,13 +18,11 @@ def view_coordinates_expected(obj: Any) -> rrc.ViewCoordinatesBatch: VIEW_COORDINATES_INPUTS: list[rrc.ViewCoordinatesArrayLike | None] = [ None, - rrc.ViewCoordinates( - [ - rrc.ViewCoordinates.ViewDir.Right, - rrc.ViewCoordinates.ViewDir.Down, - rrc.ViewCoordinates.ViewDir.Forward, - ] - ), + rrc.ViewCoordinates([ + rrc.ViewCoordinates.ViewDir.Right, + rrc.ViewCoordinates.ViewDir.Down, + rrc.ViewCoordinates.ViewDir.Forward, + ]), [ rrc.ViewCoordinates.ViewDir.Right, rrc.ViewCoordinates.ViewDir.Down, diff --git a/scripts/ci/check_large_files.py b/scripts/ci/check_large_files.py index 78d772cb877e..9c9a857e372e 100755 --- a/scripts/ci/check_large_files.py +++ b/scripts/ci/check_large_files.py @@ -24,7 +24,7 @@ if actual_size >= maximum_size: allow_list_path = os.path.join(script_path, "check_large_files_allow_list.txt") - with open(allow_list_path) as allow_list_file: + with open(allow_list_path, encoding="utf8") as allow_list_file: allow_list = allow_list_file.read().splitlines() if file_path not in allow_list: diff --git a/scripts/ci/check_links.py b/scripts/ci/check_links.py index 549a9dc7c5ca..fe7432500364 100755 --- a/scripts/ci/check_links.py +++ b/scripts/ci/check_links.py @@ -14,7 +14,7 @@ def check_file(file_path: str) -> list[str] | None: links = [] - with open(file_path) as f: + with open(file_path, encoding="utf8") as f: content = f.read() for m in re.finditer(f"(https://.*){NEW_LINK_MARKER}", content): link = m.group(0) diff --git a/scripts/ci/compare.py b/scripts/ci/compare.py index ca040ab97cab..ce078d128189 100755 --- a/scripts/ci/compare.py +++ b/scripts/ci/compare.py @@ -129,14 +129,12 @@ def compare( change = f"{change_pct:+.2f}%" else: change = f"{format_num(current - previous)} {unit}" - rows.append( - ( - name, - f"{format_num(previous)} {unit}", - f"{format_num(current)} {unit}", - change, - ) - ) + rows.append(( + name, + f"{format_num(previous)} {unit}", + f"{format_num(current)} {unit}", + change, + )) elif "current" in entry: value = entry["current"]["value"] unit = entry["current"]["unit"] diff --git a/scripts/ci/count_bytes.py b/scripts/ci/count_bytes.py index 71f188ab3bb4..c79ea3b5f6d2 100755 --- a/scripts/ci/count_bytes.py +++ b/scripts/ci/count_bytes.py @@ -97,13 +97,11 @@ def measure(files: list[str], format: Format) -> None: unit = parts[2] if len(parts) > 2 else get_unit(size) div = get_divisor(unit) - output.append( - { - "name": name, - "value": str(round(size / div, 2)), - "unit": unit, - } - ) + output.append({ + "name": name, + "value": str(round(size / div, 2)), + "unit": unit, + }) sys.stdout.write(format.render(output)) sys.stdout.flush() diff --git a/scripts/ci/dag.py b/scripts/ci/dag.py index 90887e45096c..f5e99f7eeede 100644 --- a/scripts/ci/dag.py +++ b/scripts/ci/dag.py @@ -204,14 +204,12 @@ def process(node: str) -> None: # Processed B at T+0.5 # Processed D at T+1 # `A` and `C` may swap places. - dag = DAG( - { - "A": [], - "B": ["A"], - "C": [], - "D": ["A", "B", "C"], - } - ) + dag = DAG({ + "A": [], + "B": ["A"], + "C": [], + "D": ["A", "B", "C"], + }) # `walk_parallel` can be called multiple times dag.walk_parallel( diff --git a/scripts/ci/generate_pr_summary.py b/scripts/ci/generate_pr_summary.py index 0674da0e57b7..a90bf7668e0a 100644 --- a/scripts/ci/generate_pr_summary.py +++ b/scripts/ci/generate_pr_summary.py @@ -87,7 +87,7 @@ def generate_pr_summary(github_token: str, github_repository: str, pr_number: in template_path = os.path.join(os.path.dirname(os.path.relpath(__file__)), "templates/pr_results_summary.html") # Render the Jinja template with the found_builds variable - with open(template_path) as f: + with open(template_path, encoding="utf8") as f: template = Template(f.read()) buffer = io.BytesIO(template.render(found_builds=found_builds, pr_number=pr_number).encode("utf-8")) diff --git a/scripts/ci/generate_prerelease_pip_index.py b/scripts/ci/generate_prerelease_pip_index.py index 6d4d752f2284..4918ba42d963 100755 --- a/scripts/ci/generate_prerelease_pip_index.py +++ b/scripts/ci/generate_prerelease_pip_index.py @@ -52,7 +52,7 @@ def generate_pip_index(title: str, dir: str, upload: bool, check: bool) -> None: template_path = os.path.join(os.path.dirname(os.path.relpath(__file__)), "templates/pip_index.html") # Render the Jinja template with the found_builds variable - with open(template_path) as f: + with open(template_path, encoding="utf8") as f: template = Template(f.read()) buffer = io.BytesIO(template.render(found_builds=found_builds).encode("utf-8")) diff --git a/scripts/ci/render_bench.py b/scripts/ci/render_bench.py index a76f51967f32..a1431f4f8d9c 100755 --- a/scripts/ci/render_bench.py +++ b/scripts/ci/render_bench.py @@ -258,7 +258,7 @@ def label(entry: BenchmarkEntry) -> str: "data": data, } - with open(os.path.join(SCRIPT_PATH, "templates/benchmark.html")) as template_file: + with open(os.path.join(SCRIPT_PATH, "templates/benchmark.html"), encoding="utf8") as template_file: html = template_file.read() html = html.replace("%%TITLE%%", title) # double encode to escape the data as a single string diff --git a/scripts/ci/rust_checks.py b/scripts/ci/rust_checks.py index d6cfa115a2e2..c614ea447cd8 100755 --- a/scripts/ci/rust_checks.py +++ b/scripts/ci/rust_checks.py @@ -46,7 +46,7 @@ def run_cargo(cargo_cmd, cargo_args: str, clippy_conf: str | None = None) -> Tim def package_name_from_cargo_toml(cargo_toml_path: str) -> str: - with open(cargo_toml_path) as file: + with open(cargo_toml_path, encoding="utf8") as file: cargo_toml_contents = file.read() package_name_result = re.search(r'name\s+=\s"([\w\-_]+)"', cargo_toml_contents) if package_name_result is None: diff --git a/scripts/generate_changelog.py b/scripts/generate_changelog.py index 4bdb8cda6f54..ddb5f21adc92 100755 --- a/scripts/generate_changelog.py +++ b/scripts/generate_changelog.py @@ -65,7 +65,7 @@ def get_github_token() -> str: token_file = os.path.join(home_dir, ".githubtoken") try: - with open(token_file) as f: + with open(token_file, encoding="utf8") as f: token = f.read().strip() return token except Exception: @@ -127,7 +127,7 @@ def main() -> None: args = parser.parse_args() # Because how we branch, we sometimes get duplicate commits in the changelog unless we check for it - previous_changelog = open("CHANGELOG.md").read() + previous_changelog = open("CHANGELOG.md", encoding="utf8").read() repo = Repo(".") commits = list(repo.iter_commits(args.commit_range)) diff --git a/scripts/generate_view_coordinate_defs.py b/scripts/generate_view_coordinate_defs.py index 5a3814097543..a947c6f0dcbc 100755 --- a/scripts/generate_view_coordinate_defs.py +++ b/scripts/generate_view_coordinate_defs.py @@ -268,13 +268,13 @@ def show_preview(lines: list[str]) -> None: def patch_file(filename: str, lines: list[str], key: str) -> None: - contents = open(filename).readlines() + contents = open(filename, encoding="utf8").readlines() start_line = next((i for i, line in enumerate(contents) if BEGIN_MARKER.format(key) in line), None) end_line = next((i for i, line in enumerate(contents) if END_MARKER.format(key) in line), None) if (start_line is None) or (end_line is None): raise Exception("Could not find the generated section in the file.") new_contents = contents[:start_line] + lines + contents[end_line + 1 :] - open(filename, "w").writelines(new_contents) + open(filename, "w", encoding="utf8").writelines(new_contents) ################################################################################ diff --git a/scripts/highlight_issues.py b/scripts/highlight_issues.py index 79b69fc2db64..92810cbe6349 100755 --- a/scripts/highlight_issues.py +++ b/scripts/highlight_issues.py @@ -38,7 +38,7 @@ def get_github_token() -> str: token_file = os.path.join(home_dir, ".githubtoken") try: - with open(token_file) as f: + with open(token_file, encoding="utf8") as f: token = f.read().strip() return token except Exception: diff --git a/scripts/lint.py b/scripts/lint.py index bf52210c7a75..e8f3acef2dfe 100755 --- a/scripts/lint.py +++ b/scripts/lint.py @@ -812,7 +812,7 @@ def rewrite(self, new_lines: list[str]) -> None: """Rewrite the contents of the file.""" if new_lines != self.lines: self.lines = new_lines - with open(self.path, "w") as f: + with open(self.path, "w", encoding="utf8") as f: f.writelines(new_lines) self._update_content() print(f"{self.path} fixed.") @@ -965,7 +965,7 @@ def lint_example_requirements() -> int: failed = False - with open("examples/python/requirements.txt") as f: + with open("examples/python/requirements.txt", encoding="utf8") as f: lines = f.read().strip().splitlines() sorted_lines = lines.copy() sorted_lines.sort() diff --git a/scripts/run_all.py b/scripts/run_all.py index e27d8f9e726c..19fff88146b6 100755 --- a/scripts/run_all.py +++ b/scripts/run_all.py @@ -217,17 +217,15 @@ def run_sdk_build() -> None: def run_viewer_build(web: bool) -> None: print("Building Rerun Viewer…") - returncode = subprocess.Popen( - [ - "cargo", - "build", - "-p", - "rerun-cli", - "--no-default-features", - "--features=web_viewer" if web else "--features=native_viewer", - "--quiet", - ] - ).wait() + returncode = subprocess.Popen([ + "cargo", + "build", + "-p", + "rerun-cli", + "--no-default-features", + "--features=web_viewer" if web else "--features=native_viewer", + "--quiet", + ]).wait() assert returncode == 0, f"process exited with error code {returncode}" @@ -240,13 +238,11 @@ def run_install_requirements(examples: list[str]) -> None: args.extend(["-r", req]) print("Installing examples requirements…") - returncode = subprocess.Popen( - [ - "pip", - "install", - *args, - ] - ).wait() + returncode = subprocess.Popen([ + "pip", + "install", + *args, + ]).wait() assert returncode == 0, f"process exited with error code {returncode}" diff --git a/scripts/zombie_todos.py b/scripts/zombie_todos.py index 8184861f49c1..369d4f1f4d52 100755 --- a/scripts/zombie_todos.py +++ b/scripts/zombie_todos.py @@ -78,7 +78,7 @@ async def fetch_issues(): def check_file(path: str) -> bool: ok = True closed_issues = set(issues) - with open(path) as f: + with open(path, encoding="utf8") as f: for i, line in enumerate(f.readlines()): matches = internal_issue_number_pattern.search(line) if matches is not None: diff --git a/tests/python/annotation_context_ui_stress/annotation_context_ui_stress.py b/tests/python/annotation_context_ui_stress/annotation_context_ui_stress.py index 829afac6dc20..a90dde844779 100644 --- a/tests/python/annotation_context_ui_stress/annotation_context_ui_stress.py +++ b/tests/python/annotation_context_ui_stress/annotation_context_ui_stress.py @@ -13,20 +13,18 @@ rr.script_setup(args, "rerun_example_annotation_context_ui_stress") -annotation_context = rr.AnnotationContext( - [ - ClassDescription( - info=(0, "class_info", (255, 0, 0)), - keypoint_annotations=[(i, f"keypoint {i}", (255, 255 - i, 0)) for i in range(100)], - keypoint_connections=[(i, 99 - i) for i in range(50)], - ), - ClassDescription( - info=(1, "another_class_info", (255, 0, 255)), - keypoint_annotations=[(i, f"keypoint {i}", (255, 255, i)) for i in range(100)], - keypoint_connections=[(0, 2), (1, 2), (2, 3)], - ), - ] -) +annotation_context = rr.AnnotationContext([ + ClassDescription( + info=(0, "class_info", (255, 0, 0)), + keypoint_annotations=[(i, f"keypoint {i}", (255, 255 - i, 0)) for i in range(100)], + keypoint_connections=[(i, 99 - i) for i in range(50)], + ), + ClassDescription( + info=(1, "another_class_info", (255, 0, 255)), + keypoint_annotations=[(i, f"keypoint {i}", (255, 255, i)) for i in range(100)], + keypoint_connections=[(0, 2), (1, 2), (2, 3)], + ), +]) # log two of those to test multi-selection rr.log("annotation1", annotation_context) diff --git a/tests/python/plot_dashboard_stress/main.py b/tests/python/plot_dashboard_stress/main.py index 26f230f7997a..32c0a536bb1e 100755 --- a/tests/python/plot_dashboard_stress/main.py +++ b/tests/python/plot_dashboard_stress/main.py @@ -115,7 +115,7 @@ def main() -> None: if total_elapsed >= 1.0: print( f"logged {total_num_scalars} scalars over {round(total_elapsed, 3)}s \ -(freq={round(total_num_scalars/total_elapsed, 3)}Hz, expected={round(expected_total_freq, 3)}Hz, \ +(freq={round(total_num_scalars / total_elapsed, 3)}Hz, expected={round(expected_total_freq, 3)}Hz, \ load={round(max_load * 100.0, 3)}%)" ) @@ -145,7 +145,7 @@ def main() -> None: total_elapsed = time.time() - total_start_time print( f"logged {total_num_scalars} scalars over {round(total_elapsed, 3)}s \ -(freq={round(total_num_scalars/total_elapsed, 3)}Hz, expected={round(expected_total_freq, 3)}Hz, \ +(freq={round(total_num_scalars / total_elapsed, 3)}Hz, expected={round(expected_total_freq, 3)}Hz, \ load={round(max_load * 100.0, 3)}%)" ) diff --git a/tests/python/release_checklist/main.py b/tests/python/release_checklist/main.py index b34ba2a7605a..44184dc272f0 100755 --- a/tests/python/release_checklist/main.py +++ b/tests/python/release_checklist/main.py @@ -20,7 +20,7 @@ def log_checks(args: argparse.Namespace) -> None: def log_readme() -> None: - with open(join(dirname(__file__), "README.md")) as f: + with open(join(dirname(__file__), "README.md"), encoding="utf8") as f: rr.log("readme", rr.TextDocument(f.read(), media_type=rr.MediaType.MARKDOWN), static=True) diff --git a/tests/python/roundtrips/annotation_context/main.py b/tests/python/roundtrips/annotation_context/main.py index d1e4be862327..62766f4b68c1 100755 --- a/tests/python/roundtrips/annotation_context/main.py +++ b/tests/python/roundtrips/annotation_context/main.py @@ -11,16 +11,14 @@ def main() -> None: - annotation_context = rr.AnnotationContext( - [ - (1, "hello"), - ClassDescription( - info=(2, "world", [3, 4, 5]), - keypoint_annotations=[(17, "head"), (42, "shoulders")], - keypoint_connections=[(1, 2), (3, 4)], - ), - ] - ) + annotation_context = rr.AnnotationContext([ + (1, "hello"), + ClassDescription( + info=(2, "world", [3, 4, 5]), + keypoint_annotations=[(17, "head"), (42, "shoulders")], + keypoint_connections=[(1, 2), (3, 4)], + ), + ]) parser = argparse.ArgumentParser(description="Logs rich data using the Rerun SDK.") rr.script_add_args(parser) diff --git a/tests/python/test_api/main.py b/tests/python/test_api/main.py index e59aa39ea953..b71755817ad9 100755 --- a/tests/python/test_api/main.py +++ b/tests/python/test_api/main.py @@ -78,13 +78,11 @@ def run_segmentation() -> None: rr.log( "seg_test", - rr.AnnotationContext( - [ - rr.AnnotationInfo(13, color=(255, 0, 0)), - (42, "label2", (0, 255, 0)), - rr.AnnotationInfo(99, label="label3"), - ] - ), + rr.AnnotationContext([ + rr.AnnotationInfo(13, color=(255, 0, 0)), + (42, "label2", (0, 255, 0)), + rr.AnnotationInfo(99, label="label3"), + ]), static=False, ) rr.log("logs/seg_test_log", rr.TextLog("label1 disappears and everything with label3 is now default colored again"))