Sha256: e983a9ee06027d4b82c1d5c5dff5f8092e041251e80c1e281b2d83ca2a1d84f9
Contents?: true
Size: 769 Bytes
Versions: 18
Compression:
Stored size: 769 Bytes
Contents
import sys import brewery.ds as ds import brewery.dq as dq from chardet.universaldetector import UniversalDetector filename = sys.argv[1] detector = UniversalDetector() for line in file(filename, 'rb'): detector.feed(line) if detector.done: break detector.close() src = ds.CSVDataSource(filename, read_header = True, encoding=detector.result["encoding"], delimiter=',' ) src.initialize() if len(src.field_names) == 1: src.finalize() src = ds.CSVDataSource(filename, read_header = True, encoding=detector.result["encoding"], delimiter=';' ) src.initialize() out = ds.CSVDataTarget(sys.stdout, encoding='utf-8') out.fields = ds.fieldlist(src.field_names) out.initialize() for record in src.records(): out.append(record) src.finalize() out.finalize()
Version data entries
18 entries across 18 versions & 1 rubygems