Skip to content

Commit

Permalink
Add lints to fix casts
Browse files Browse the repository at this point in the history
  • Loading branch information
jleibs committed Mar 5, 2024
1 parent fd2a914 commit 09b8f81
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion rerun_py/tests/unit/test_space_view_blueprint.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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",
Expand Down

0 comments on commit 09b8f81

Please sign in to comment.