class documentation

class Tristate(object):

View In Hierarchy

Tri-state value: on, off or auto

Method __init__ Undocumented
Method __nonzero__ No summary
Method __repr__ No summary
Method do Run function if tristate is on or auto, only report a failure if tristate is on since failing is o.k. for autodetect.
Method is_auto Undocumented
Method is_off Undocumented
Method is_on Undocumented
Constant AUTO Undocumented
Constant OFF Undocumented
Constant ON Undocumented
Property state Get current state
Constant _VALID_NAMES Undocumented
Instance Variable _state Undocumented
def __init__(self, val):

Undocumented

def __nonzero__(self):
>>> Tristate('on').__nonzero__()
True
>>> Tristate('auto').__nonzero__()
True
>>> Tristate('off').__nonzero__()
False
def __repr__(self):
>>> Tristate('on').__repr__()
'on'
>>> Tristate(True).__repr__()
'on'
>>> Tristate(False).__repr__()
'off'
>>> Tristate('auto').__repr__()
'auto'
def 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.

def is_auto(self):

Undocumented

def is_off(self):

Undocumented

def is_on(self):

Undocumented

AUTO: int =

Undocumented

Value
-1
OFF: bool =

Undocumented

Value
False
ON: bool =

Undocumented

Value
True
@property
state =

Get current state

_VALID_NAMES: list[str] =

Undocumented

Value
['on', 'off', 'true', 'false', 'auto']
_state =

Undocumented