keephistory#

pypillometry.keephistory(func)[source]#

Decorator that records a method call in the history of the returned object.

After the decorated method has run, a short text version of the call is added (via add_to_history()) to the object it returned (or to self if it returned nothing, e.g. for setters), provided that object is an eyedata object (i.e., has an add_to_history method). Calls made from inside another decorated method are not recorded, and large arguments are only summarized (e.g., Intervals(13)); the inplace argument is left out (it does not change the result). The history is a log of the operations; show it with print_history().

Parameters:

func (callable) – method to wrap; its first argument must be the object (self) or a Namespace of it

Return type:

callable

Returns:

wrapped method that returns the same value as func