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

Function TryUpdate

Common/Core/Testing/Python/TestEmptyInput.py:173–200  ·  view source on GitHub ↗

The method Update() is tried on the instantiated class. Some classes do not have an Update method, if this is the case, Python will generate an AttributeError, in this case, the name of the class is stored in the global variable noUpdate and false is returned. If an error

(b, e)

Source from the content-addressed store, hash-verified

171 return res
172
173def TryUpdate(b, e):
174 '''
175 The method Update() is tried on the instantiated class.
176
177 Some classes do not have an Update method, if this is the case,
178 Python will generate an AttributeError, in this case, the name
179 of the class is stored in the global variable noUpdate and false
180 is returned.
181
182 If an error occurs on Update() then the error handler
183 will be triggered and in this case false is returned.
184
185 :param: b - the class on which Update() will be tried.
186 :param: e - the error handler.
187 :return: True if the update was successful, False otherwise.
188 '''
189 try:
190 b.Update()
191 if e.ErrorOccurred():
192 return False
193 else:
194 return True
195 except AttributeError:
196 # No Update() method
197 noUpdate.add(b.GetClassName())
198 return False
199 except:
200 raise
201
202def TryShutdown(b, e):
203 '''

Callers 1

TestOneFunction · 0.85

Calls 4

UpdateMethod · 0.45
ErrorOccurredMethod · 0.45
addMethod · 0.45
GetClassNameMethod · 0.45

Tested by

no test coverage detected