class MixedParser(ArchiveParser): def __init__(self): self.arc = ArcParser() self.warc = WarcParser() def parse(self, stream, offset=None): line = stream.readline() while line: if line.startswith('WARC'): return self.warc.parse(stream, offset, line=line) elif line not in ('\n','\r\n','\r'): return self.arc.parse(stream, offset, line=line) line = stream.readline() return None, (), offset
class MixedParser(ArchiveParser): def __init__(self): self.arc = ArcParser() self.warc = WarcParser() def parse(self, stream, offset=None): line = stream.readline() while line: if line.startswith('WARC'): return self.warc.parse(stream, offset, line=line) elif line not in ('\n', '\r\n', '\r'): return self.arc.parse(stream, offset, line=line) line = stream.readline() return None, (), offset
def __init__(self): self.arc = ArcParser() self.warc = WarcParser()