本文整理汇总了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