rerun icon indicating copy to clipboard operation
rerun copied to clipboard

Typehint for AnnotationContext not accepting tuple with varying lengths despite working fine

Open roym899 opened this issue 2 years ago • 0 comments

Describe the bug

annotation_context = [
    (0, "", (30, 30, 30)),
    (1, "Location"),
    (2, "Person"),
    (3, "Organization"),
    (4, "Miscellaneous"),
]
rr.log("/", rr.AnnotationContext(annotation_context))

works as expected but mypy complains with

Argument 1 to "AnnotationContext" has incompatible type "list[tuple[object, ...]]"; expected "AnnotationContext | ClassDescription | Sequence[ClassDescription | AnnotationInfo | int | tuple[int, str] | tuple[int, str, Rgba32 | int | Sequence[int | float] | ndarray[Any, dtype[unsignedinteger[_8Bit] | floating[_32Bit] | floating[_64Bit]]]]] | Sequence[ClassDescriptionMapElem | ClassDescription | AnnotationInfo | int | tuple[int, str] | tuple[int, str, Rgba32 | int | Sequence[int | float] | ndarray[Any, dtype[unsignedinteger[_8Bit] | floating[_32Bit] | floating[_64Bit]]]]]" [arg-type]

This happens when color is only specified for one of the tuples.

roym899 avatar Dec 18 '23 09:12 roym899