Package esys :: Package lsm :: Package examples :: Package waveprop :: Module OptionParser
[hide private]
[frames] | no frames]

Module OptionParser

Defines classes for parsing command line options of wave propagation simulations.

Classes [hide private]
  ImprovedOption
Extends optparse.Option class by adding 'int_list' and 'float_list' types
  OptionParser
Command line option parser for use in conjunction with simple wave propagation simulations.
Functions [hide private]
list
getListFromString(opt, str, mapCallable)
Parses a given string to extract a list.
 
checkIntList(option, opt, value)
Extracts a list of integers from a specified value.
 
checkFloatList(option, opt, value)
Extracts a list of floats from a specified value.
Function Details [hide private]

getListFromString(opt, str, mapCallable)

 

Parses a given string to extract a list. The expected format of the string is '[e1,e2,e3,...]'. Returns map(mapCallable, [e1,e2,e3,...]).

Parameters:
  • opt (string) - Command line option, only used for for creating messages when raising OptionValueException
  • str (string) - The option value string
  • mapCallable (callable) - Callable object which converts a string list element into another type, eg int, float, etc
Returns: list
list of converted-type elements.

checkIntList(option, opt, value)

 

Extracts a list of integers from a specified value.

Parameters:
  • option - The option.
  • opt (string) - The command line option string.
  • value (string) - The value passed to the option. @rtype list
Returns:
list of ints

checkFloatList(option, opt, value)

 

Extracts a list of floats from a specified value.

Parameters:
  • opt (string) - The command line option string.
  • value (string) - The value passed to the option. @rtype list
Returns:
list of floats