Package lyntin :: Module argparser :: Class BooleanOrNoneChecker
[show private | hide private]
[frames | no frames]

Class BooleanOrNoneChecker

TypeChecker --+
              |
             BooleanOrNoneChecker


Accept only boolean values or special "not specified" values. Booleans are handled by utils.convert_boolean. Values not handled by that function will throw an exception.
Method Summary
  __init__(self, typename, typeargs)
Initializes the TypeChecker.
int (0 or 1) or None check(self, arg)
Verfies the argument is a boolean (using utils.convert_boolean function) and converts it to a boolean value (0 or 1).

Method Details

__init__(self, typename, typeargs)
(Constructor)

Initializes the TypeChecker. Over-ridden by all the TypeChecker subclasses.
Parameters:
typename - the name of the type
           (type=string)
typeargs - the arguments passed to the TypeChecker to initialize it
           (type=tuple)
Overrides:
lyntin.argparser.TypeChecker.__init__ (inherited documentation)

check(self, arg)

Verfies the argument is a boolean (using utils.convert_boolean function) and converts it to a boolean value (0 or 1). Also handles None, "-" and the empty string as None.
Parameters:
arg - the argument to check the type-hood and convert
           (type=string)
Returns:
the converted argument
           (type=int (0 or 1) or None)
Raises:
ParserException - if the arg is not a valid boolean
Overrides:
lyntin.argparser.TypeChecker.check

Generated by Epydoc 2.1 on Mon Aug 9 09:17:41 2004 http://epydoc.sf.net