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.
int check(self, args)
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.

check(self, args)

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:
args - the argument
           (type=string)
Returns:
the choice
           (type=int)
Raises:
ParserException - if the arg is not a valid choice

Generated by Epydoc 1.1 on Mon Apr 28 21:11:24 2003 http://epydoc.sf.net