Manager API reference

This document describes the Switch Manager API. This is generally referred to as the global gargoyle object, which lives in gargoyle.gargoyle.

Switches are handled through the ModelDict interface, which is registered under the Switch model.

class gargoyle.models.Switch(name, state=1, compounded=False)

A switch encapsulates the concept of an item that is either ‘on’ or ‘off’ depending on the input. The swich determines this by checking each of its conditions and seeing if it applies to a certain input. All the switch does is ask each of its Conditions if it applies to the provided input. Normally any condition can be true for the Switch to be enabled for a particular input, but of switch.componded is set to True, then all of the switches conditions need to be true in order to be enabled.

See the Condition class for more information on what a Condition is and how it checks to see if it’s satisfied by an input.

enabled_for(inpt)

Checks to see if this switch is enabled for the provided input, which is an instance of the Input class. The switch is enabled if any of its conditions are met by the input.