magicclass.type_matching package

Submodules

magicclass.type_matching.list_type module

magicclass.type_matching.list_type.list_of_any(value, annotation) WidgetTuple | None[source]

Determine if value/annotation is list[...].

magicclass.type_matching.tuple_type module

magicclass.type_matching.tuple_type.tuple_of_any(value, annotation) WidgetTuple | None[source]

Determine if value/annotation is tuple[...].

Module contents

Enable type matching of tuple/list types in magicgui. Annotations such as tuple[int, str] and list[float] can be converted into TupleEdit or ListEdit. Type matching will be enabled just by importing them like:

>>> from magicclass.type_matching import tuple_type  # enable tuple
>>> from magicclass.type_matching import list_type  # enable list