Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)

        def guess_record_type(file_handle):
    offset = file_handle.tell()
    if is_gzip_file(file_handle):
        nfh=gzip.GzipFile(fileobj=file_handle)
    else:
        nfh=file_handle
    
    line = nfh.readline()
    file_handle.seek(offset)
    for rx, record in archive_types:
        if rx.match(line):
            return record

    else:
        return None
        


src/h/a/hanzo-warc-tools-0.2/hanzo/warctools/stream.py   hanzo-warc-tools(Download)
 
from .log import debug
from .archive_detect import is_gzip_file, guess_record_type
 
def open_record_stream(record_class=None, filename=None, file_handle=None, mode="rb+", gzip="auto"):
 
        if record_class == None:
            record_class = guess_record_type(file_handle)
 
        if record_class == None: