def __init__(self, path, strict=False): """ :param path: Packed CCH file path """ self.path = path self.parser = get_parser(self.path)(strict=strict) self.filename = path self.file = get_compressed_file(path)
def __init__(self, path, fd=None, parser=None, strict=False): self.path = path self.resume_line_number = 0 if parser is None: self.parser = get_parser(self.path)(strict=strict) else: self.parser = parser if fd is None: self.fd = open(path, 'r') else: self.fd = fd
def __init__(self, path, fd=None, parser=None, strict=False): self.path = path self.resume_line_number = 0 if parser is None: self.parser = get_parser(self.path)(strict=strict) else: self.parser = parser if fd is None: self.fd = open(path, 'r') else: try: # bz compressed files ina zip file data = bz2.decompress(fd.read()) bzfd = StringIO() bzfd.write(data) self.fd = bzfd except Exception as e: self.fd = fd