dbus.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:uchroma 作者: cyanogen 项目源码 文件源码
def __getattribute__(self, name):
        # Intercept everything and delegate to the device class by converting
        # names between the D-Bus conventions to Python conventions.
        prop_name = camel_to_snake(name)
        if (prop_name in DeviceAPI._PROPERTIES or prop_name in DeviceAPI._RW_PROPERTIES) \
                and hasattr(self._driver, prop_name):
            value = getattr(self._driver, prop_name)
            if isinstance(value, Enum):
                return value.name.lower()
            if isinstance(value, Color):
                return value.html
            if isinstance(value, (list, tuple)) and len(value) > 0 and isinstance(value[0], Enum):
                return [x.name.lower() for x in value]
            return value

        else:
            return super(DeviceAPI, self).__getattribute__(name)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号