Exemplo 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
Exemplo 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
Exemplo 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)
Exemplo n.º 4
0
def string_io(data=None):  # cStringIO can't handle unicode
    try:
        return cStringIO(bytes(data))
    except UnicodeEncodeError:
        return pyStringIO(data)
Exemplo n.º 5
0
def string_io(data=None):  # cStringIO can't handle unicode
    try:
        return cStringIO(bytes(data))
    except UnicodeEncodeError:
        return pyStringIO(data)
Exemplo n.º 6
0
def StringIO(s=None):  # cStringIO can't handle unicode
    try:
        return cStringIO(bytes(s))
    except UnicodeEncodeError:
        return pyStringIO(s)