web_interface.py 文件源码

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

项目:rebus 作者: airbus-seclab 项目源码 文件源码
def __getattr__(self, attr):
        if not attr.startswith('async_'):
            raise AttributeError
        method_name = attr[6:]

        if hasattr(self, method_name + '_buscallback'):
            method = None
            bus_callback = getattr(self, method_name + '_buscallback')
        else:
            method = getattr(self._agent.bus, method_name)

            def bus_callback(method, callback, *args):
                results = method(self._agent, *args)
                self._agent.ioloop.add_callback(callback, results)
                # dbus-specific - indicates this method should only be called
                # once
                return False

        def _async(callback, *args):
            self._agent.bus.busthread_call(bus_callback, method, callback,
                                           *args)
        return _async
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号