3.11.5. sciexp2.common.progress.UnpicklerStart

Methods

get_stop()

Get the sister UnpicklerStop object.

class UnpicklerStart(obj, **kwargs)

Bases: object

Picklable proxy to a progress indicator.

In order to provide a progress indicator when unpickling large objects, you can prefix the pickle stream with a UnpicklerStart instance and postfix it with its UnpicklerStop sister instance:

def dump (self, file_obj):
    start = UnpicklerStart(len(self))
    pickle.dump((start, self, start.get_stop()), file_obj)

When unpickled, the first will call Stack.push and the last will call Stack.pop, so that your object will be able to update the CURRENT progress indicator by calling Stack.

When pickled, it will also push a progress indicator for your code to use while pickling your large object.

Parameters:
obj

Object to show the progress indicator for

no_picklebool, optional

Do not create a progress indicator while pickling

msg_picklestring, optional

Message during pickling (otherwise use default)

no_unpicklebool, optional

Do not create a progress indicator while unpickling

msg_unpicklestring, optional

Message during unpickling (otherwise use default)togg

get_stop()

Get the sister UnpicklerStop object.