本文整理匯總了Python中ossie.device.ExecutableDevice.__getattribute__方法的典型用法代碼示例。如果您正苦於以下問題:Python ExecutableDevice.__getattribute__方法的具體用法?Python ExecutableDevice.__getattribute__怎麽用?Python ExecutableDevice.__getattribute__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ossie.device.ExecutableDevice
的用法示例。
在下文中一共展示了ExecutableDevice.__getattribute__方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __getattribute__
# 需要導入模塊: from ossie.device import ExecutableDevice [as 別名]
# 或者: from ossie.device.ExecutableDevice import __getattribute__ [as 別名]
def __getattribute__ (self, attrname):
"""
Intercept lookup of attributes to allow any method to throw an
error via the 'exceptionPoint' and 'exceptionType' properties.
"""
# Use the base class __getattribute__ to avoid recursion.
getattribute = lambda x: ExecutableDevice.__getattribute__(self, x)
attribute = getattribute(attrname)
if callable(attribute) and attrname == getattribute('exceptionPoint'):
if getattribute('exceptionType') == 'CF.InvalidFileName':
exception = CF.InvalidFileName(CF.CF_EINVAL, "Test exception")
elif self.exceptionType == 'CF.Device.InvalidCapacity':
exception = CF.Device.InvalidCapacity("Test exception", [])
else:
exception = Exception()
return ExceptionFunc(exception)
return attribute