oo_filters.py 文件源码

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

项目:origin-ci-tool 作者: openshift 项目源码 文件源码
def oo_select_keys_from_list(data, keys):
        """ This returns a list, which contains the value portions for the keys
            Ex: data = { 'a':1, 'b':2, 'c':3 }
                keys = ['a', 'c']
                returns [1, 3]
        """

        if not isinstance(data, list):
            raise errors.AnsibleFilterError("|failed expects to filter on a list")

        if not isinstance(keys, list):
            raise errors.AnsibleFilterError("|failed expects first param is a list")

        # Gather up the values for the list of keys passed in
        retval = [FilterModule.oo_select_keys(item, keys) for item in data]

        return FilterModule.oo_flatten(retval)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号