Esempio n. 1
0
 def __init__(self):
     """Create an empty Batch object."""
     self.nbytes = 0  # bytes in batch so far
     self.nlines = 0  # lines in batch so far
     self.data = pyStringIO()
     Batch.total_batches += 1  # sequentially number these
     self.batchno = Batch.total_batches
     self.csv_writer = csv.writer(self.data) if _args.delim else None
Esempio n. 2
0
 def __init__(self):
     """Create an empty Batch object."""
     self.nbytes = 0        # bytes in batch so far
     self.nlines = 0        # lines in batch so far
     self.data = pyStringIO()
     Batch.total_batches += 1     # sequentially number these
     self.batchno = Batch.total_batches
     self.csv_writer = csv.writer(self.data) if _args.delim else None
Esempio n. 3
0
def string_io(data=None):  # cStringIO can't handle unicode
    '''
    Pass data through to stringIO module and return result
    '''
    try:
        return cStringIO(bytes(data))
    except UnicodeEncodeError:
        return pyStringIO(data)
Esempio n. 4
0
def string_io(data=None):  # cStringIO can't handle unicode
    try:
        return cStringIO(bytes(data))
    except UnicodeEncodeError:
        return pyStringIO(data)
Esempio n. 5
0
def string_io(data=None):  # cStringIO can't handle unicode
    try:
        return cStringIO(bytes(data))
    except UnicodeEncodeError:
        return pyStringIO(data)
Esempio n. 6
0
def StringIO(s=None):  # cStringIO can't handle unicode
    try:
        return cStringIO(bytes(s))
    except UnicodeEncodeError:
        return pyStringIO(s)