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

Class ChoiceChecker

TypeChecker --+
              |
             ChoiceChecker


Allows for a value to come from a selection of different strings. Automatically expands to one of them if it is uniquely specified.

Typeargs should be a |-delimitted list of possibly values
Method Summary
  __init__(self, typename, typeargs)
Uses the typeargs to set the choices availble.
  check(self, arg)
Checks the arg against a series of choices that were presented when this checker was instantiated.

Method Details

__init__(self, typename, typeargs)
(Constructor)

Uses the typeargs to set the choices availble.
Overrides:
lyntin.argparser.TypeChecker.__init__

check(self, arg)

Checks the arg against a series of choices that were presented when this checker was instantiated. So you could say that valid values of this argument are "high" and "low" and if the argument value the user passed in was "blue", then we would raise a ParserException since that's not a valid value.
Parameters:
arg - the argument
           (type=string)
Raises:
ParserException - if the arg is not a valid choice
Overrides:
lyntin.argparser.TypeChecker.check

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