manialink.py 文件源码

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

项目:PyPlanet 作者: PyPlanet 项目源码 文件源码
def handle(self, player, action, values, **kwargs):
        if not action.startswith(self.id):
            return

        if not self._is_global_shown and player.login not in self._is_player_shown.keys():
            # Ignore if id is unique (uuid4)
            try:
                uuid.UUID(self.id, version=4)
            except:
                raise ManialinkMemoryLeakException(
                    'Old view instance (ml-id: {}) is not yet destroyed, but is receiving player callbacks!, '
                    'Make sure you are not removing old view instances with .destroy() and del variable! '
                    'Potential Memory Leak!! Should be fixed asap!'.format(self.id)
                )

        action_name = action[len(self.id)+2:]
        if action_name not in self.receivers:
            return await self.handle_catch_all(player, action_name, values)

        # Call receivers.
        for rec in self.receivers[action_name]:
            try:
                if iscoroutinefunction(rec):
                    await rec(player, action, values)
                else:
                    rec(player, action, values)
            except Exception as e:
                if self.throw_exceptions:
                    raise
                else:
                    logging.exception('Exception has been silenced in ManiaLink Action receiver:', exc_info=e)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号