def export_to_datadir(): filename = io_test.get_datadir_filename("exported_from_tenpy_{0}.hdf5") data = io_test.gen_example_data() with warnings.catch_warnings(record=True) as caught: #warnings.filterwarnings("ignore", category=UserWarning) with h5py.File(filename, 'w') as f: hdf5_io.save_to_hdf5(f, data) for w in caught: msg = str(w.message) expected = "without explicit HDF5 format" in msg if expected: expected = any(t in msg for t in [ 'io_test.DummyClass', 'tenpy.tools.events.EventHandler', 'tenpy.tools.events.Listener', 'method' ]) if not expected: warnings.showwarning(w.message, w.category, w.filename, w.lineno, w.file, w.line)
def export_to_datadir(): filename = io_test.get_datadir_filename("exported_from_tenpy_{0}.pkl") data = io_test.gen_example_data() with open(filename, 'wb') as f: pickle.dump(data, f, protocol=pickle.HIGHEST_PROTOCOL)
def export_to_datadir(): filename = io_test.get_datadir_filename("exported_from_tenpy_{0}.hdf5") data = io_test.gen_example_data() with h5py.File(filename, 'w') as f: hdf5_io.save_to_hdf5(f, data)