foreach.py 文件源码

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

项目:civet 作者: TheJacksonLaboratory 项目源码 文件源码
def __init__(self, e, pipeline_files):
        atts = e.attrib
        for a in atts:
            if a not in ForEachFile.requiredAtts:
                msg = ("Unknown attribute in foreach file: {}\n\n"
                       "{}\n\nValid Attributes: '{}'".format(a, ET.tostring(e).rstrip(),
                                                             ", ".join(ForEachFile.requiredAtts)))
                raise ParseError(msg)
        for a in ForEachFile.requiredAtts:
            if a not in atts:
                msg = ("foreach file tag missing required attribute:\n\n{}\n\n"
                       "Required Attributes: '{}'".format(ET.tostring(e).rstrip(),
                                                          ", ".join(ForEachFile.requiredAtts)))
                raise ParseError(msg)
        self.id = atts['id']
        if self.id in pipeline_files:
            msg = "a foreach file's id must not be the same as a pipeline file id: {}\n\n{}".format(self.id, ET.tostring(e))
            raise ParseError(msg)
        self.pattern = re.compile(atts['pattern'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号