Esempio n. 1
0
def parse_file(name, what="Document"):
    with open(name) as file:
        text = file.read() + "\n\0"
        doc = parser.parse(what, text)
        assert doc, "Failed to parse %s from file %s" % (what, name)
        return doc
Esempio n. 2
0
def parse_lines(lines, what='Document'):
    results = [parser.parse(what, l+'\n\0') for l in lines]
    for result in results:
        assert result
    return results