adapter.py 文件源码

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

项目:apimas 作者: grnet 项目源码 文件源码
def construct_action(self, instance, spec, loc, context, action):
        """
        Construct a command based on a specific actions, e.g. list,
        create, etc.
        """
        assert len(loc) == 4
        self.init_adapter_conf(instance)
        collection = loc[0] + '/' + loc[-3]
        command = self.COMMANDS[action](self.clients.get(collection))
        if action in self.RESOURCE_ACTIONS:
            command = click.argument('resource_id')(command)
        if action in self.CRITICAL_ACTIONS:
            option = click.option(
                '--yes', is_flag=True, callback=abort_if_false,
                expose_value=False,
                prompt='Are you sure you want to perform this action?')
            command = option(command)
        self._add_format_option(command, action)
        instance[self.ADAPTER_CONF][action] = command
        return instance
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号