You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Argument of type "list[str]" cannot be assigned to parameter "classes" of type "List[str | int | float]" in function "create"
TypeVar "_T@list" is invariant
Type "str" cannot be assigned to type "str | int | float"
"str" is incompatible with "int"
"str" is incompatible with "float"
This I believe is due to the Union type as the generic to List here and here
This should be Union[List[str], List[int], List[float]] instead.
Bonus: search for other instances of List[Union[...]] and convert to Union[List[.], List[.], ...] to avoid a similar issue if it exists elsewhere.
The text was updated successfully, but these errors were encountered:
Is there a reason to use List over Sequence here? It probably doesn't make sense to take mutable data types as inputs?
I believe that Sequence can maintain the heterogeneity of the datatype (which may not be desired in this specific case, but would be useful elsewhere).
I've got a branch with the Label extension converted to use Sequence if there's any interest. This would probably only make sense if we were intending to transition everything over to Sequence.
Uh oh!
There was an error while loading. Please reload this page.
Currently setting a LabelClasses.classes property to List[str] gives an error in Pylance, e.g.
yields error at
classes=classes
withThis I believe is due to the Union type as the generic to List here and here
This should be
Union[List[str], List[int], List[float]]
instead.Bonus: search for other instances of
List[Union[...]]
and convert toUnion[List[.], List[.], ...]
to avoid a similar issue if it exists elsewhere.The text was updated successfully, but these errors were encountered: