From 09b8f815e7519af3ba7601b22eea6bb6aecfa570 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Tue, 5 Mar 2024 10:35:18 -0500 Subject: [PATCH] Add lints to fix casts --- rerun_py/tests/unit/test_space_view_blueprint.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/rerun_py/tests/unit/test_space_view_blueprint.py b/rerun_py/tests/unit/test_space_view_blueprint.py index 98da5af621dc..5513fb18040b 100644 --- a/rerun_py/tests/unit/test_space_view_blueprint.py +++ b/rerun_py/tests/unit/test_space_view_blueprint.py @@ -1,17 +1,22 @@ from __future__ import annotations import itertools +from typing import Optional, cast from rerun.blueprint.archetypes.space_view_blueprint import SpaceViewBlueprint from rerun.blueprint.components.entities_determined_by_user import ( EntitiesDeterminedByUser, EntitiesDeterminedByUserBatch, + EntitiesDeterminedByUserLike, ) from rerun.blueprint.components.included_query import IncludedQuery, IncludedQueryBatch from rerun.blueprint.components.space_view_class import SpaceViewClass, SpaceViewClassBatch from rerun.blueprint.components.space_view_origin import SpaceViewOrigin, SpaceViewOriginBatch -from rerun.blueprint.components.visible import Visible, VisibleBatch +from rerun.blueprint.components.visible import Visible, VisibleBatch, VisibleLike from rerun.components.name import Name, NameBatch +from rerun.datatypes.entity_path import EntityPathLike +from rerun.datatypes.utf8 import Utf8Like +from rerun.datatypes.uuid import UuidArrayLike from .common_arrays import none_empty_or_value, uuid_bytes0, uuid_bytes1 @@ -37,6 +42,14 @@ def test_space_view_blueprint() -> None: for class_identifier, display_name, space_origin, entities_determined_by_user, contents, visible in all_arrays: class_identifier = class_identifier if class_identifier is not None else class_identifier_arrays[-1] + # mypy can't track types properly through itertools zip so re-cast + class_identifier = cast(Utf8Like, class_identifier) + display_name = cast(Optional[Utf8Like], display_name) + space_origin = cast(Optional[EntityPathLike], space_origin) + entities_determined_by_user = cast(Optional[EntitiesDeterminedByUserLike], entities_determined_by_user) + contents = cast(Optional[UuidArrayLike], contents) + visible = cast(Optional[VisibleLike], visible) + print( "rr.SpaceViewBlueprint(\n", f" class_identifier={class_identifier!r}\n",