lmdbdict.utils

lmdbdict.utils.picklable_wrapper(obj)[source]

Wrap the object with PicklableWrapper only if it’s not natively picklable Note: it’s not intended to be run a lot of times

lmdbdict.utils.loads_either(cloudpickle_out, pickle_out)[source]

If cloudpickle dumps is available then load with cloudpickle first, because cloudpickle is safer to use for callabels then pickle. If not availble, then resort to pickle.

class lmdbdict.utils.PicklableWrapper(obj)[source]

Bases: object

Wrap an object to make it more picklable, note that it uses heavy weight serialization libraries that are slower than pickle. It’s best to use it only on closures (which are usually not picklable). This is a simplified version of https://github.com/joblib/joblib/blob/master/joblib/externals/loky/cloudpickle_wrapper.py RT change: we save both cloudpickle and pickle dumps. This is for the case that sender and receiver may not have the same enviroment. cloudpickle is preferred because it’s better for callables.