workflow_executor.py 文件源码

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

项目:SoS 作者: vatlab 项目源码 文件源码
def match(self, target, step):
        # for sos_step, we need to match step name
        if isinstance(target, sos_step):
            return step.match(target.target_name())
        if not 'provides' in step.options:
            return False
        patterns = step.options['provides']
        if isinstance(patterns, (str, BaseTarget)):
            patterns = [patterns]
        elif not isinstance(patterns, Sequence):
            raise RuntimeError(f'Unknown target to match: {patterns}')
        #
        for p in patterns:
            # other targets has to match exactly
            if isinstance(target, BaseTarget) or isinstance(p, BaseTarget):
                if target == p:
                    return {}
                else:
                    continue
            # if this is a regular string
            res = extract_pattern(p, [target])
            if res and not any(None in x for x in res.values()):
                return {x:y[0] for x,y in res.items()}
            # string match
            elif file_target(p) == file_target(target):
                return True
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号