openmmtools.multistate.multistateanalyzer.CachedProperty

class openmmtools.multistate.multistateanalyzer.CachedProperty(name, dependencies=(), check_changes=False, default=<class 'AttributeError'>, validator=None)[source]

Analyzer helper descriptor of a cached value with a dependency graph.

Automatically takes care of invalidating the values of the cache that depend on this property.

Parameters
namestr

The name of the parameter in the cache.

dependenciesiterable of str

List of cached properties on which this property depends.

check_changesbool, optional

If True, the cache dependencies will be invalidated only if the new value differs from the old one (default is False).

defaultobject, optional

The default value in case the cache doesn’t contain a value for this. If a callable, this function must have the signature default(self, instance). It is also possible to define a callable default through the default decorator. After the first cache miss, the default value is cached. By default, AttributeError is raised on a cache miss.

validatorcallable, optional

A function to call before setting a new value with signature validator(self, instance, new_value). It is also possible to define this through the validator decorator.

Methods

default

validator

__init__(name, dependencies=(), check_changes=False, default=<class 'AttributeError'>, validator=None)[source]

Methods

__init__(name[, dependencies, ...])

default(default)

validator(validator)