MCPcopy Create free account
hub / github.com/Kitware/VTK / vtkVariantCast

Function vtkVariantCast

Wrapping/Python/vtkmodules/util/vtkVariant.py:101–116  ·  view source on GitHub ↗

Cast the vtkVariant to the specified value type, where the type is in the following format: 'int', 'unsigned int', etc. for numeric types, and 'string' for strings. You can also use an integer VTK type constant for the type.

(v, t)

Source from the content-addressed store, hash-verified

99
100
101def vtkVariantCast(v, t):
102 """
103 Cast the vtkVariant to the specified value type, where the type is
104 in the following format: 'int', 'unsigned int', etc. for numeric types,
105 and 'string' for strings. You can also use an
106 integer VTK type constant for the type.
107 """
108 if not issubclass(type(t), int):
109 t = _variant_type_map[t]
110
111 v = vtkCommonCore.vtkVariant(v, t)
112
113 if v.IsValid():
114 return getattr(v, _variant_method_map[t])()
115 else:
116 return None
117
118
119def vtkVariantStrictWeakOrder(s1, s2):

Callers

nothing calls this directly

Calls 3

vtkVariantMethod · 0.80
typeEnum · 0.50
IsValidMethod · 0.45

Tested by

no test coverage detected