Parameterized#

Parameterized#

Parameterized

A base class for creating Parameterized objects.

ParameterizedABC

Base class for user-defined abc.ABC that extends Parameterized.

.param namespace#

These methods and properties are available under the .param namespace of Parameterized classes and instances.

Parameters(cls[, self])

Object that holds the .param namespace and implementation of Parameterized methods as well as any state that is not in __slots__ or the Parameters themselves.

__getitem__(key)

Retrieve a Parameter by its key.

__dir__()

Return the list of standard attributes and parameters.

__iter__()

Iterate over the parameters on this object.

__contains__(param)

__getattr__(attr)

Handle attribute access for Parameter objects.

add_parameter(param_name, param_obj)

Add a new Parameter object to this class.

deserialize_parameters(serialization[, ...])

Deserialize the given serialized data.

deserialize_value(pname, value[, mode])

Deserialize the value of a specific parameter.

force_new_dynamic_value(name)

Force a new value to be generated for the dynamic attribute name, and return it.

get_value_generator(name)

Retrieve the value or value-generating object of a named parameter.

inspect_value(name)

Inspect the current value of a parameter without modifying it.

log(level, msg, *args, **kw)

Log a message at the specified logging level.

method_dependencies(name[, intermediate])

Retrieve the parameter dependencies of a specified method.

objects([instance])

Return the Parameters of this instance or class.

outputs()

Retrieve a mapping of declared outputs for the Parameterized object.

pprint([imports, prefix, unknown_value, ...])

Generate a pretty-printed representation of the object.

schema([safe, subset, mode])

Generate a schema for the parameters on this Parameterized object.

set_dynamic_time_fn(time_fn[, sublistattr])

Set time_fn for all param.Dynamic Parameters of this class or instance object that are currently being dynamically generated.

serialize_parameters([subset, mode])

Return the serialized parameters of the Parameterized object.

serialize_value(pname[, mode])

Serialize the value of a specific parameter.

trigger(*param_names)

Trigger watchers for the given set of parameter names.

unwatch(watcher)

Remove a watcher from this object's list of registered watchers.

update([arg])

Update multiple parameters of this object or class before triggering events.

values([onlychanged])

Retrieve a dictionary of parameter names and their current values.

warning(msg, *args, **kw)

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

watch(fn, parameter_names[, what, ...])

Register a callback function to be invoked for parameter events.

watch_values(fn, parameter_names[, what, ...])

Register a callback function for changes in parameter values.

watchers

Dictionary of instance watchers.

ParameterizedFunction#

ParameterizedFunction(*, name)

Acts like a Python function, but with arguments that are Parameters.

ParameterizedFunction.name

ParameterizedFunction.instance(**params)

Create and return an instance of this class.

ParamOverrides(overridden, dict_[, ...])

A dictionary-like object that provides two-level lookup for parameter values.

ParamOverrides.extra_keywords()

Retrieve extra keyword arguments not matching the overridden object's parameters.

ParamOverrides.param_keywords()

Retrieve parameters matching the overridden object's declared parameters.

ParamOverrides.get(key[, default])

Retrieve the value for a given key, with a default if the key is not found.

Helpers#

parameterized.batch_call_watchers(parameterized)

Context manager to batch events to provide to Watchers on a parameterized object.

parameterized.classlist(class_)

Return a list of the class hierarchy above (and including) the given class.

concrete_descendents(parentclass)

Return a dictionary containing all subclasses of the specified parentclass, including the parentclass (prefer descendents()).

depends()

Annotates a function or Parameterized method to express its dependencies.

descendents(class_[, concrete])

Return a list of all descendent classes of a given class.

discard_events(parameterized)

Context manager that discards any events within its scope triggered on the supplied Parameterized object.

edit_constant(parameterized)

Context manager to temporarily set parameters on a Parameterized object to constant=False to allow editing them.

output(func, *output, **kw)

Annotate a method to declare its outputs with specific types.

parameterized.register_reference_transform(...)

Append a transform to extract potential parameter dependencies from an object.

parameterized.resolve_ref(reference[, recursive])

Resolve all parameters a dynamic reference depends on.

parameterized.resolve_value(value[, recursive])

Resolve the current value of a dynamic reference.

script_repr(val[, imports, prefix, ...])

Generate a nearly runnable Python script representation of a Parameterized object.

Module variables#

parameterized.warnings_as_exceptions

Returns True when the argument is true, False otherwise.