예제 #1
0
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
예제 #2
0
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
예제 #3
0
 def __init__(self):
     self.arc = ArcParser()
     self.warc = WarcParser()
예제 #4
0
파일: mixed.py 프로젝트: trifle/warctools
 def __init__(self):
     self.arc = ArcParser()
     self.warc = WarcParser()