4ed172063fc1ec493c91b327e4761192dbb227dd,pyemma/_base/serialization/jsonpickler_handlers.py,NumpyNPZHandler,flatten,#NumpyNPZHandler#Any#Any#,50
Before Change
def flatten(self, obj, data):
assert isinstance(obj, np.ndarray)
buff = BytesIO()
np.savez_compressed(buff, x=obj)
buff.seek(0)
flattened_bytes = util.b64encode(buff.read())
data["npz_file_bytes"] = flattened_bytes
After Change
return self.context.h5_file
def flatten(self, obj, data):
if obj.dtype == np.object_:
raise NotImplementedError()
res = [self.context.flatten(x) for x in obj]
//raise Exception(str(obj))
// TODO: how to deal with obj dtype? eg. return list
//data.clear()
data["py/object"] = "list"
else:
import uuid
array_id = "{group}/{id}".format(group=self.file.name, id=uuid.uuid4())
self.file.create_dataset(name=array_id, data=obj,
chunks=True, compression="gzip", compression_opts=4, shuffle=True)
data["array_ref"] = array_id
return data
def restore(self, obj):
array_ref = obj["array_ref"]
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: markovmodel/PyEMMA
Commit Name: 4ed172063fc1ec493c91b327e4761192dbb227dd
Time: 2017-08-31
Author: m.scherer@fu-berlin.de
File Name: pyemma/_base/serialization/jsonpickler_handlers.py
Class Name: NumpyNPZHandler
Method Name: flatten
Project Name: cve-search/cve-search
Commit Name: 0f2d4db89845b9fe748bb8df19c166ebc937c930
Time: 2020-08-11
Author: paul.tikken@gmail.com
File Name: sbin/db_mgmt_cpe_dictionary.py
Class Name: CPEDownloads
Method Name: download_site
Project Name: cve-search/cve-search
Commit Name: 0f2d4db89845b9fe748bb8df19c166ebc937c930
Time: 2020-08-11
Author: paul.tikken@gmail.com
File Name: sbin/db_mgmt_json.py
Class Name: CVEDownloads
Method Name: download_site