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

Function vtkVariantStrictEquality

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

Check two variants for strict equality of type and value.

(s1, s2)

Source from the content-addressed store, hash-verified

162
163
164def vtkVariantStrictEquality(s1, s2):
165 """
166 Check two variants for strict equality of type and value.
167 """
168 s1 = vtkCommonCore.vtkVariant(s1)
169 s2 = vtkCommonCore.vtkVariant(s2)
170
171 t1 = s1.GetType()
172 t2 = s2.GetType()
173
174 # check based on type
175 if t1 != t2:
176 return False
177
178 v1 = s1.IsValid()
179 v2 = s2.IsValid()
180
181 # check based on validity
182 if (not v1) and (not v2):
183 return True
184 elif v1 != v2:
185 return False
186
187 # extract and compare the values
188 r1 = getattr(s1, _variant_method_map[t1])()
189 r2 = getattr(s2, _variant_method_map[t2])()
190
191 return (r1 == r2)
192
193
194def vtkVariantLessThan(s1, s2):

Callers 1

testComparisonMethodsMethod · 0.90

Calls 3

vtkVariantMethod · 0.80
GetTypeMethod · 0.45
IsValidMethod · 0.45

Tested by 1

testComparisonMethodsMethod · 0.72