def bayesdb_csv_file(csv): with test_core.bayesdb() as bdb: with tempfile.NamedTemporaryFile(prefix='bayeslite') as f: with open(f.name, 'w') as out: out.write(csv) yield (bdb, f.name)
def bayesdb_csv_stream(csv): with test_core.bayesdb() as bdb: yield (bdb, StringIO.StringIO(csv))