Package intermine :: Module constraints :: Class TemplateConstraint
[hide private]
[frames] | no frames]

Class TemplateConstraint

source code

object --+
         |
        TemplateConstraint
Known Subclasses:

A mixin to supply the behaviour and state of constraints on templates

Constraints on templates can also be designated as "on", "off" or "locked", which refers to whether they are active or not. Inactive constraints are still configured, but behave as if absent for the purpose of results. In addition, template constraints can be editable or not. Only values for editable constraints can be provided when requesting results, and only constraints that can participate in logic expressions can be editable.

Instance Methods [hide private]
 
__init__(self, editable=True, optional='locked') source code
 
get_switchable_status(self)
Returns either "locked", "on" or "off".
source code
 
switch_on(self) source code
 
switch_off(self) source code
 
to_string(self)
Provide a template specific human readable representation of the constraint.
source code
 
separate_arg_sets(self, args)
A static function to use when building template constraints.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  REQUIRED = 'locked'
  OPTIONAL_ON = 'on'
  OPTIONAL_OFF = 'off'
Properties [hide private]
bool required
True if a value must be provided for this constraint.
bool switched_off
True if this constraint is currently inactive.

Inherited from object: __class__

Method Details [hide private]

__init__(self, editable=True, optional='locked')
(Constructor)

source code 

Constructor

Parameters:
  • editable (bool) - Whether or not this constraint should accept new values.
  • optional ("locked", "on" or "off") - Whether a value for this constraint must be provided when running.
Overrides: object.__init__

switch_on(self)

source code 

Make sure this constraint is active

Raises:
  • ValueError - if the constraint is not editable and optional

switch_off(self)

source code 

Make sure this constraint is inactive

Raises:
  • ValueError - if the constraint is not editable and optional

to_string(self)

source code 

Provide a template specific human readable representation of the constraint. This method is called by repr.

separate_arg_sets(self, args)

source code 

A static function to use when building template constraints. 
------------------------------------------------------------

dict -> (dict, dict)

Splits a dictionary of arguments into two separate dictionaries, one with
arguments for the main constraint, and one with arguments for the template
portion of the behaviour


Property Details [hide private]

required

True if a value must be provided for this constraint.

Get Method:
unreachable.required(self) - True if a value must be provided for this constraint.
Type:
bool

switched_off

True if this constraint is currently inactive.

Get Method:
unreachable.switched_off(self) - True if this constraint is currently inactive.
Type:
bool