3 """@namespace IMP.isd.Entry 
    4    Classes to handle ISD statistics files. 
   11     """The entry class represents a column in the statistics file. 
   12     Its components are a title, a format and an additional object. 
   13     It's what gets written to the statistics file in a column. 
   14     - title: the title of the column 
   15     - format: a wisely chosen format string (see below) 
   16     - something: either something that can be formattable, a string, a number 
   17       etc. This is a static entry. In that case all remaining arguments are 
   18       discarded and get_value returns the formatted string : 
   19       format % something.  If something is a function, this is a dynamic 
   20       entry, and the format string is used on the result of the function call 
   21       something(*args,**kwargs). 
   24     def __init__(self, title, fmt, something, *args, **kwargs):
 
   27         self.is_function = isinstance(something, collections.Callable)
 
   29             self.function = something
 
   33             self.value = something
 
   34         self.was_updated_since_last_get = 
False 
   38             return "Entry('%s', '%s', f(...))" % (self.title, self.format)
 
   40             return "Entry('%s', '%s', %s)" % (self.title, self.format,
 
   46     def get_raw_value(self):
 
   48             return self.function(*self.args, **self.kwargs)
 
   50             self.was_updated_since_last_get = 
False 
   55             return self.format % self.get_raw_value()
 
   59     def set_value(self, val):
 
   61             raise RuntimeError(
"Can only set_value on static entries.")
 
   63         self.was_updated_since_last_get = 
True 
   65     def get_was_updated(self):
 
   66         return self.is_function 
or self.was_updated_since_last_get