mrv.automation.attributes

Epydoc: mrv.automation.attributes

Contains specialized attributes that judge value based on different criteria, allowing more elaborate typechecking

Classes

Epydoc: mrv.automation.attributes

class mrv.automation.attributes.Attribute(typeClass, flags, default=None)

Bases: object

Simple class defining the type of a plug and several flags that affect it. Additionally it can determine how well suited another attribute is

Flags:
exact_type: if True, derived classes of our typecls are not considered to be a valid type. i.e: basestring could be stored in a str attr if exact type is false - its less than we need, but still something. Putting a str into a basestring attribute will always work though, as it would be more than we need readonly: if True, the attribute’s plug cannot be written to. Read-only attributes can be used as storage that the user can read, but not write. You can write read-only plugs by directly setting its cache - this of course - is only for the node itself, but will never be done by the framework
computable:

Nodes are automatically computable if they are affected by another plug. If this is not the case, they are marked input only and are not computed. If this flag is true, even unaffeted plugs are computable. Plugs that affect something are automatically input plugs and will not be computed. If the plug does not affect anything and this flag is False, they are seen as input plugs anyway.

The system does not allow plugs to be input and output plugs at the same time, thus your compute cannot be triggered by your own compute

cls: if True, the plug requires classes to be set ( instances of ‘type’ ) , but no instances of these classes uncached: if False, computed values may be cached, otherwise they will always be recomputed. unconnectable: if True, the node cannot be the destination of a connection check_passing_values: check each value as it flows through a connection - usually compatability is only checked on connection and once values are set, but not if they flow through an existing connection

Default Values:
Although default values can be simple primitives are classes, a callable is specifically supported. It allows you to get a callback whenever a default value is required. The same result could be achieved by connected the plug in question, but dynamic defaults are a quick way to achive that. Your returned value will be type-checked against the required type if check_passing_values is set.
affinity(otherattr)

Compute affinity for otherattr.

Returns:rating from 0 to 255 defining how good the attribtues match each other in general - how good can we store values of otherattr ? Thus this comparison is directed.
Note:for checking connections, use connectionAffinity
compatabilityRate(value)

Compute value’s compatability rate

Returns:value between 0 and 255, 0 means no compatability, 255 a perfect match. if larger than 0, the plug can hold the value ( assumed the flags are set correctly ).
connectionAffinity(destinationattr)

Compute connection affinity for given destination attribute

Returns:rating from 0 to 255 defining the quality of the connection to otherplug. an affinity of 0 mean connection is not possible, 255 mean the connection is perfectly suited. The connection is a directed one from self -> otherplug
default()
Returns:default value stored for this attribute, or raise
Note:handles dynamic defaults, so you should not directly access the default member variable
Raises MissingDefaultValueError:
 if attribute does not have a default value
Raises TypeError:
 if value returned by dynamic attribute has incorrect type

Epydoc: mrv.automation.attributes.RegexStringAttr

class mrv.automation.attributes.RegexStringAttr(regexstring, *args, **kwargs)

Bases: mrv.dge.Attribute

Attribute that accepts string values matching a given regular expression

affinity(otherattr)

Compute affinity for otherattr.

Returns:rating from 0 to 255 defining how good the attribtues match each other in general - how good can we store values of otherattr ? Thus this comparison is directed.
Note:for checking connections, use connectionAffinity
compatabilityRate(value)
Returns:rate of base class provided that the regex matches, 0 otherwise
connectionAffinity(destinationattr)

Compute connection affinity for given destination attribute

Returns:rating from 0 to 255 defining the quality of the connection to otherplug. an affinity of 0 mean connection is not possible, 255 mean the connection is perfectly suited. The connection is a directed one from self -> otherplug
default()
Returns:default value stored for this attribute, or raise
Note:handles dynamic defaults, so you should not directly access the default member variable
Raises MissingDefaultValueError:
 if attribute does not have a default value
Raises TypeError:
 if value returned by dynamic attribute has incorrect type

Table Of Contents

Previous topic

mrv.automation.workflow

Next topic

mrv.automation.qa

This Page