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

Function TryShutdown

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

The method Shutdown() is tried on the instantiated class. Some classes do not have an Shutdown 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 er

(b, e)

Source from the content-addressed store, hash-verified

200 raise
201
202def TryShutdown(b, e):
203 '''
204 The method Shutdown() is tried on the instantiated class.
205
206 Some classes do not have an Shutdown method, if this is the case,
207 Python will generate an AttributeError, in this case, the name
208 of the class is stored in the global variable noUpdate and False
209 is returned.
210
211 If an error occurs on Shutdown() then the error handler
212 will be triggered and in this case False is returned.
213
214 :param: b - the class on which Shutdown() will be tried.
215 :param: e - the error handler.
216 :return: True if the update was successful, False otherwise.
217 '''
218 try:
219 b.Shutdown()
220 if e.ErrorOccurred():
221 return False
222 else:
223 return True
224 except AttributeError:
225 # No Shutdown() method
226 noShutdown.add(b.GetClassName())
227 return False
228 except:
229 raise
230
231def TrySetInputData(b, e, d):
232 '''

Callers 1

TestOneFunction · 0.85

Calls 4

ShutdownMethod · 0.45
ErrorOccurredMethod · 0.45
addMethod · 0.45
GetClassNameMethod · 0.45

Tested by

no test coverage detected