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'])
评论列表
文章目录