gbp :: tristate :: Tristate :: Class Tristate

[hide private]
[frames] | no frames]

# Class Tristate

    object --+
             |
            Tristate

Tri-state value: on, off or auto

Instance Methods | [hide private]

__init__(self, val) x.__init__(...) initializes x; see help(type(x)) for signature |

__repr__(self) |

__nonzero__(self) |

is_auto(self) |

is_on(self) |

is_off(self) |

do(self, function, *args, **kwargs) Run function if tristate is on or auto, only report a failure if tristate is on since failing is o.k. |

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

Class Variables | [hide private]

| ON = `True`
| OFF = `False`
| AUTO = `-1`
| _VALID_NAMES = ``[``'``on``'``,` `'``off``'``,` `'``true``'``,` `'``false``'``,` `'``auto``'``]``

Properties | [hide private]

| state Get current state
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, val)
(Constructor)

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
  (inherited documentation)

### __repr__(self)
(Representation operator)

    >>> Tristate('on').__repr__()
    'on'
    >>> Tristate(True).__repr__()
    'on'
    >>> Tristate(False).__repr__()
    'off'
    >>> Tristate('auto').__repr__()
    'auto'

Overrides: object.__repr__

### do(self, function, *args, **kwargs)

Run function if tristate is on or auto, only report a failure if tristate is on since failing is o.k. for autodetect.

Property Details | [hide private]

### state

Get current state

Get Method:
  unreachable.state(self) - Get current state