Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.stsci.edu/spst/UnixTransition/doc/spst_getopt.html
Дата изменения: Fri Apr 8 12:46:15 2016
Дата индексирования: Mon Apr 11 01:32:16 2016
Кодировка:

Поисковые слова: universe
Python: module spst_getopt
 
 
spst_getopt (version 14.10.09)
index
spst_getopt.py

 PURPOSE --
 To provide a way to parse cli-type parameters/options and compare them
 against an 'allowed' list.  This routine is consistent with how the
 SPSS commands do parameter/option parsing, but is a little different
 than standard Unix (see the spst_getopt function description below).
 
 DEVELOPER --
 Merle Reinhart
 
 MODIFICATION HISTORY --
updated for Python 3 compatibility. drc 10/9/14

 
Classes
       
exceptions.Exception(exceptions.BaseException)
GetoptError

 
class GetoptError(exceptions.Exception)
    Raised when there is a commandline parser error
 
 
Method resolution order:
GetoptError
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
Functions
       
check_option_for_args(option, allowed_options)
Check to see if the option is supposed to have arguments.
check_options(option, allowed_options)
Check the option to see if it is one of the allowed_options.
If so, then see if it has a value.
spst_getopt(arg_list, allowed_options=[])
This function will parse the input list of cli-type parameters/options
looking for allowed option/values as specified in the allowed_options
list.  This is an adaptation of the Python 1.5.2 getopt.py library
routine.
 
Written by Merle Reinhart, 4-Dec-2000
 
ARGUMENTS:
    arg_list  -- (list)  This is the input argument list to be
                           parsed without the reference to the
                           running program (ie. like sys.argv[1:]).
                           Parameters and options can occur in any
                           order.  Options must be contain a leading
                           '-'.  Options which have values should have
                           a trailing '=' followed by the value.
 
    allowed_options -- (list)
                           This is a list that describes the allowed
                           options that the function may find in the
                           arg_list.  Each option should be completely
                           specified without the leading '-'.  If the
                           option allows a value, then it should
                           contain a trailing '='.
 
RETURNS:
    options -- (dictionary)
                           This is a dictionary of all option/value
                           combinations that were found in the input
                           arg_list.  The key is the option and the
                           value is the value of the option.
 
    parms -- (list)      This is a list of all the parameters that
                           were found in the input arg_list in the
                           order they occured.
 
RAISES:
    GetoptError            If an option is found in arg_list that
                             is not contained in allowed_options.
                           If an option contains a value but
                             allowed_options says no value is allowed.
                           If an option does not have a value but
                             allowed_options says it must have a value.
                           If an option in arg_list cannot be uniquely
                             mapped to an option in allowed_options.

 
Data
        __version__ = '14.10.09'