N
ήωO5c       sη   d  Z  k Z k Z k Z k l d e i d Z e i e  Z	 d e i d Z
 e i e
  Z d Z d f  d     YZ d e f d	     YZ d
 e f d     YZ d e f d     YZ d e f d     YZ d f  d     YZ d S(   sU  Configuration file parser.

A setup file consists of sections, lead by a "[section]" header,
and followed by "name: value" entries, with continuations and such in
the style of rfc822.

The option values can contain format strings which refer to other
values in the same section, or values in a special [DEFAULT] section.
For example:

    something: %(dir)s/whatever

would resolve the "%(dir)s" to the value of dir.  All reference
expansions are done late, on demand.

Intrinsic defaults can be specified by passing them into the
ConfigParser constructor as a dictionary.

class:

ConfigParser -- responsible for for parsing a list of
                configuration files, and managing the parsed database.

    methods:

    __init__(defaults=None) -- create the parser and specify a
                               dictionary of intrinsic defaults.  The
                               keys must be strings, the values must
                               be appropriate for %()s string
                               interpolation.  Note that `name' is
                               always an intrinsic default; it's value
                               is the section's name.

    sections() -- return all the configuration section names, sans DEFAULT

    options(section) -- return list of configuration options for the named
                        section

    read(*filenames) -- read and parse the list of named configuration files

    get(section, option, raw=0) -- return a string value for the named
                                   option.  All % interpolations are
                                   expanded in the return values, based on
                                   the defaults passed into the constructor
                                   and the DEFAULT section.

    getint(section, options) -- like get(), but convert value to an integer

    getfloat(section, options) -- like get(), but convert value to a float

    getboolean(section, options) -- like get(), but convert value to
                                    a boolean (currently defined as 0
                                    or 1, only)
s   ^\[\([-A-Za-z0-9]*\)\][s   ]*$s   ^\([-A-Za-z0-9.]+\)\(:\|[s   ]*=\)\(.*\)$s   DEFAULTs   Errorc      s   d d  Z  d   Z RS(   Nc    s   | |  _ d  S(   N(   s   msgs   selfs   _Error__msg(   s   selfs   msgs6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   __init__I s    s    c    s   |  i Sd  S(   N(   s   selfs   _Error__msg(   s   selfs6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   __repr__K s    (   s   __init__s   __repr__(    s6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   ErrorH s    s   NoSectionErrorc      s   d   Z  RS(   Nc    s!   t  i |  d |  | |  _ d  S(   Ns   No section: %s(   s   Errors   __init__s   selfs   section(   s   selfs   sections6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   __init__O s    (   s   __init__(    s6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   NoSectionErrorN s    s   DuplicateSectionErrorc      s   d   Z  RS(   Nc    s!   t  i |  d |  | |  _ d  S(   Ns   Section %s already exists(   s   Errors   __init__s   selfs   section(   s   selfs   sections6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   __init__T s    (   s   __init__(    s6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   DuplicateSectionErrorS s    s   NoOptionErrorc      s   d   Z  RS(   Nc    s0   t  i |  d | | f  | |  _ | |  _ d  S(   Ns   No option `%s' in section: %s(   s   Errors   __init__s   selfs   options   section(   s   selfs   options   sections6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   __init__Y s    	(   s   __init__(    s6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   NoOptionErrorX s    s   InterpolationErrorc      s   d   Z  RS(   Nc    s<   t  i |  d | | | f  | |  _ | |  _ | |  _ d  S(   Ns5   Bad value substitution: sect `%s', opt `%s', ref `%s'(   s   Errors   __init__s   selfs   sections   options	   reference(   s   selfs	   references   options   sections6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   __init__` s    		(   s   __init__(    s6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   InterpolationError_ s    s   ConfigParserc      s}   e  d  Z d   Z d   Z d   Z d   Z d   Z d   Z d	 d  Z d
   Z	 d   Z
 d   Z d   Z d   Z RS(   Nc    s0   h  |  _ | t j o h  |  _ n
 | |  _ d  S(   N(   s   selfs   _ConfigParser__sectionss   defaultss   Nones   _ConfigParser__defaults(   s   selfs   defaultss6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   __init__k s    	c    s   |  i Sd  S(   N(   s   selfs   _ConfigParser__defaults(   s   selfs6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   defaultsr s    c    s   |  i i   Sd S(   s3   Return a list of section names, excluding [DEFAULT]N(   s   selfs   _ConfigParser__sectionss   keys(   s   selfs6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   sectionsu s     c    s4   |  i i |  o t |   n h  |  i | <d S(   s   Create a new section in the configuration.

        Raise DuplicateSectionError if a section by the specified name
        already exists.
        N(   s   selfs   _ConfigParser__sectionss   has_keys   sections   DuplicateSectionError(   s   selfs   sections6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   add_sectionz s     c    s   |  i i |  Sd S(   s~   Indicate whether the named section is present in the configuration.

        The DEFAULT section is not acknowledged.
        N(   s   selfs   _ConfigParser__sectionss   has_keys   section(   s   selfs   sections6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   has_section s     c    sW   y |  i | i   } Wn t j
 o t |   n X| i |  i  | i	   Sd  S(   N(
   s   selfs   _ConfigParser__sectionss   sections   copys   optss   KeyErrors   NoSectionErrors   updates   _ConfigParser__defaultss   keys(   s   selfs   sections   optss6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   options s    c    ss   t  |  t  d  j o | g } n xF | d r< } y  t | d  } |  i |  Wn t j
 o n Xq/ Wd S(   s#   Read and parse a list of filenames.s    i    s   rN(   s   types	   filenamess   files   opens   fps   selfs   _ConfigParser__reads   IOError(   s   selfs	   filenamess   files   fps6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   read s     	 c    sχ   y |  i | i   } Wn6 t j
 o* | t j o
 h  } n t |   n X|  i i   } | i
 |  t i |  } y | | } Wn" t j
 o t | |   n X| o | Sn y | | SWn' t j
 o } t | | |   n Xd S(   sΦ   Get an option value for a given section.

        All % interpolations are expanded in the return values, based
        on the defaults passed into the constructor.

        The section DEFAULT is special.
        N(   s   selfs   _ConfigParser__sectionss   sections   copys   sectdicts   KeyErrors   DEFAULTSECTs   NoSectionErrors   _ConfigParser__defaultss   ds   updates   strings   lowers   options   rawvals   NoOptionErrors   raws   keys   InterpolationError(   s   selfs   sections   options   raws   sectdicts   ds   rawvals   keys6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   get s(     
i    c    s   | |  i | |   Sd  S(   N(   s   convs   selfs   gets   sections   option(   s   selfs   sections   convs   options6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   __getΌ s    c    s   |  i | t i |  Sd  S(   N(   s   selfs   _ConfigParser__gets   sections   strings   atois   option(   s   selfs   sections   options6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   getintΏ s    c    s   |  i | t i |  Sd  S(   N(   s   selfs   _ConfigParser__gets   sections   strings   atofs   option(   s   selfs   sections   options6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   getfloatΒ s    c    sM   |  i | |  } t i |  } | d d f j o t d |  n | Sd  S(   Ni    i   s   Not a boolean: %s(	   s   selfs   gets   sections   options   vs   strings   atois   vals
   ValueError(   s   selfs   sections   options   vs   vals6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys
   getbooleanΕ s
    c 	   s  t  } t  } d } xύd oυ| i   } | o Pn | d } t i |  d j p | d d j o q n t i	 t i
 |  d  d j o | d d j o q n | d d j o | t  j o | o0 t i |  } | o | | d | } n nt i |  d j os t i d  } |  i i |  o |  i | } n7 | t j o |  i } n h  | d	 <} | |  i | <t  } n t i |  d j o[ t i d d
  \ } } t i	 |  } t i |  } | d j o
 d } n | | | <n d G| i | | f GHq Wd S(   s¬  Parse a sectioned setup file.

        The sections in setup file contains a title line at the top,
        indicated by a name in square brackets (`[]'), plus key/value
        options lines, indicated by `name: value' format lines.
        Continuation are represented by an embedded newline then
        leading whitespace.  Blank lines, lines beginning with a '#',
        and just about everything else is ignored.
        i    i   s    s   #;s   rems   rs    	s   
 s   namei   s   ""s   Error in %s at %d: %sN(   s   Nones   cursects   optnames   linenos   fps   readlines   lines   strings   strips   lowers   splits   values   secthead_cres   matchs   groups   sectnames   selfs   _ConfigParser__sectionss   has_keys   DEFAULTSECTs   _ConfigParser__defaultss
   option_cres   optvals   name(	   s   selfs   fps   cursects   optnames   linenos   lines   values   sectnames   optvals6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   __readΜ sF    	  
'4%

(   s   Nones   __init__s   defaultss   sectionss   add_sections   has_sections   optionss   reads   gets   _ConfigParser__gets   getints   getfloats
   getbooleans   _ConfigParser__read(    s6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   ConfigParserj s    			
							N(   s   __doc__s   syss   strings   regexs   typess   ListTypes
   whitespaces   SECTHEAD_REs   compiles   secthead_cres	   OPTION_REs
   option_cres   DEFAULTSECTs   Errors   NoSectionErrors   DuplicateSectionErrors   NoOptionErrors   InterpolationErrors   ConfigParser(    s6   /var/tmp/python-root/usr/lib/python1.5/ConfigParser.pys   ?6 s   