param.Dynamic#
- class param.Dynamic(default=None, *, doc=None, label=None, precedence=None, instantiate=False, constant=False, readonly=False, pickle_default_value=True, allow_None=False, per_instance=True, allow_refs=False, nested_refs=False, default_factory=None, metadata=None)[source]#
Parameter whose value can be generated dynamically by a callable object.
If a Parameter is declared as Dynamic, it can be set a callable object (such as a function or callable class), and getting the parameter’s value will call that callable.
Note that at present, the callable object must allow attributes to be set on itself.
If set as
time_dependent, setting theDynamic.time_fnallows the production of dynamic values to be controlled: a new value will be produced only if the current value oftime_fnis different from what it was the last time the parameter value was requested.By default, the Dynamic parameters are not
time_dependentso that new values are generated on every call regardless of the time. The defaulttime_fnused whentime_dependentis a singleTimeinstance that allows general manipulations of time. It may be set to some other callable as required so long as a number is returned on each call.- __init__(default=None, *, doc=None, label=None, precedence=None, instantiate=False, constant=False, readonly=False, pickle_default_value=True, allow_None=False, per_instance=True, allow_refs=False, nested_refs=False, default_factory=None, metadata=None)[source]#
Call the superclass’s __init__ and set instantiate=True if the default is dynamic.
Methods
__init__([default, doc, label, precedence, ...])Call the superclass's __init__ and set instantiate=True if the default is dynamic.
deserialize(value)Given a serializable Python value, return a value that the parameter can be set to.
schema([safe, subset, mode])Generate a schema for the parameters of the
Parameterizedobject.serialize(value)Given the parameter value, return a Python value suitable for serialization.
Attributes
allow_Noneallow_refsconstantdefaultdefault_factorydocinstantiatelabelGet the label for this parameter.
metadatanamenested_refsownerper_instancepickle_default_valueprecedencereadonlyrxThe reactive operations namespace.
time_dependenttime_fnwatchers