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

Version Path
cartodb-importer-0.2.19 misc/csv_normalizer.py
cartodb-importer-0.2.18 misc/csv_normalizer.py
cartodb-importer-0.2.17 misc/csv_normalizer.py
cartodb-importer-0.2.16 misc/csv_normalizer.py
cartodb-importer-0.2.15 misc/csv_normalizer.py
cartodb-importer-0.2.14 misc/csv_normalizer.py
cartodb-importer-0.2.13 misc/csv_normalizer.py
cartodb-importer-0.2.12 misc/csv_normalizer.py
cartodb-importer-0.2.11 misc/csv_normalizer.py
cartodb-importer-0.2.10 misc/csv_normalizer.py
cartodb-importer-0.2.9 misc/csv_normalizer.py
cartodb-importer-0.2.8 misc/csv_normalizer.py
cartodb-importer-0.2.7 misc/csv_normalizer.py
cartodb-importer-0.2.6 misc/csv_normalizer.py
cartodb-importer-0.2.5 misc/csv_normalizer.py
cartodb-importer-0.2.4 misc/csv_normalizer.py
cartodb-importer-0.2.3 misc/csv_normalizer.py
cartodb-importer-0.2.2 misc/csv_normalizer.py