
M9c       s!    d  Z  V X d k Z Y d k Z Z d k Z \ d Z ^ d Z c d f  d     YZ i d e f d     YZ n d e f d	     YZ s d
 e f d     YZ	 z 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(   sC  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 RFC 822.

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

    has_section(section)
        return whether the given section exists

    has_option(section, option)
        return whether the given option exists in the given section

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

    has_option(section, option)
        return whether the given section has the given option

    read(filenames)
        read and parse the list of named configuration files, given by
        name.  A single filename is also allowed.  Non-existing files
        are ignored.

    readfp(fp, filename=None)
        read and parse one configuration file, given as a file object.
        The filename defaults to fp.name; it is only used in error
        messages (if fp has no `name' attribute, the string `<???>' is used).

    get(section, option, raw=0, vars=None)
        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.  Additional substitutions may be
        provided using the `vars' argument, which must be a dictionary whose
        contents override any pre-existing defaults.

    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)

    remove_section(section)
	remove the given file section and all its options

    remove_option(section, option)
	remove the given option from the given section

    set(section, option, value)
        set the given option

    write(fp)
	write the configuration state in .ini format
Ns   DEFAULTi
   s   Errorc      s    c d d d  Z  f d   Z RS(   Nc    s   d e | |  _ d  S(   N(   s   msgs   selfs   _msg(   s   selfs   msgs)   /mit/python/lib/python2.0/ConfigParser.pys   __init__d s   s    c    s   f g |  i Sd  S(   N(   s   selfs   _msg(   s   selfs)   /mit/python/lib/python2.0/ConfigParser.pys   __repr__f s   (   s   __init__s   __repr__(    s)   /mit/python/lib/python2.0/ConfigParser.pys   Errorc s   s   NoSectionErrorc      s   i j d   Z  RS(   Nc    s*   j k t  i |  d |  l | |  _ d  S(   Ns   No section: %s(   s   Errors   __init__s   selfs   section(   s   selfs   sections)   /mit/python/lib/python2.0/ConfigParser.pys   __init__j s   (   s   __init__(    s)   /mit/python/lib/python2.0/ConfigParser.pys   NoSectionErrori s   s   DuplicateSectionErrorc      s   n o d   Z  RS(   Nc    s*   o p t  i |  d |  q | |  _ d  S(   Ns   Section %s already exists(   s   Errors   __init__s   selfs   section(   s   selfs   sections)   /mit/python/lib/python2.0/ConfigParser.pys   __init__o s   (   s   __init__(    s)   /mit/python/lib/python2.0/ConfigParser.pys   DuplicateSectionErrorn s   s   NoOptionErrorc      s   s t d   Z  RS(   Nc    s<   t u t  i |  d | | f  w | |  _ x | |  _ d  S(   Ns   No option `%s' in section: %s(   s   Errors   __init__s   selfs   options   section(   s   selfs   options   sections)   /mit/python/lib/python2.0/ConfigParser.pys   __init__t s   (   s   __init__(    s)   /mit/python/lib/python2.0/ConfigParser.pys   NoOptionErrors s   s   InterpolationErrorc      s   z { d   Z  RS(   Nc    sQ   { | t  i |  } d | | | | f   | |  _  | |  _  | |  _ d  S(   NsN   Bad value substitution:
	section: [%s]
	option : %s
	key    : %s
	rawval : %s
(   s   Errors   __init__s   selfs   sections   options	   references   rawval(   s   selfs	   references   options   sections   rawvals)   /mit/python/lib/python2.0/ConfigParser.pys   __init__{ s
   (   s   __init__(    s)   /mit/python/lib/python2.0/ConfigParser.pys   InterpolationErrorz s   s   InterpolationDepthErrorc      s     d   Z  RS(   Nc    sB     t  i |   d | | | f   | |  _  | |  _ d  S(   NsS   Value interpolation too deeply recursive:
	section: [%s]
	option : %s
	rawval : %s
(   s   Errors   __init__s   selfs   sections   options   rawval(   s   selfs   options   sections   rawvals)   /mit/python/lib/python2.0/ConfigParser.pys   __init__ s   (   s   __init__(    s)   /mit/python/lib/python2.0/ConfigParser.pys   InterpolationDepthError s   s   ParsingErrorc      s     d   Z   d   Z RS(   Nc    s6     t  i |  d |   | |  _  g  |  _ d  S(   Ns    File contains parsing errors: %s(   s   Errors   __init__s   selfs   filenames   errors(   s   selfs   filenames)   /mit/python/lib/python2.0/ConfigParser.pys   __init__ s   c    s=     |  i i | | f   |  i d | | f |  _ d  S(   Ns   
	[line %2d]: %s(   s   selfs   errorss   appends   linenos   lines   _msg(   s   selfs   linenos   lines)   /mit/python/lib/python2.0/ConfigParser.pys   append s   (   s   __init__s   append(    s)   /mit/python/lib/python2.0/ConfigParser.pys   ParsingError s   s   MissingSectionHeaderErrorc      s     d   Z  RS(   Nc    sN     t  i |   d | | | f   | |  _  | |  _  | |  _ d  S(   Ns7   File contains no section headers.
file: %s, line: %d
%s(   s   Errors   __init__s   selfs   filenames   linenos   line(   s   selfs   filenames   linenos   lines)   /mit/python/lib/python2.0/ConfigParser.pys   __init__ s
   (   s   __init__(    s)   /mit/python/lib/python2.0/ConfigParser.pys   MissingSectionHeaderError s   s   ConfigParserc      s1    e  d  Z  d   Z  d   Z  d   Z  d   Z  d   Z  d   Z  d   Z  e  d	  Z	  d e  d
  Z
 ,d   Z /d   Z 2d   Z 5d   Z <d   Z ?d   Z Hd   Z Sd   Z cd   Z qd   Z }e i d  Z e i d  Z d   Z RS(   Nc    s?     h  |  _  | t j o  h  |  _ n  | |  _ d  S(   N(   s   selfs   _ConfigParser__sectionss   defaultss   Nones   _ConfigParser__defaults(   s   selfs   defaultss)   /mit/python/lib/python2.0/ConfigParser.pys   __init__ s   c    s     |  i Sd  S(   N(   s   selfs   _ConfigParser__defaults(   s   selfs)   /mit/python/lib/python2.0/ConfigParser.pys   defaults s   c    s      |  i i   Sd S(   s3   Return a list of section names, excluding [DEFAULT]N(   s   selfs   _ConfigParser__sectionss   keys(   s   selfs)   /mit/python/lib/python2.0/ConfigParser.pys   sections s   c    sC      |  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   sections)   /mit/python/lib/python2.0/ConfigParser.pys   add_section s   c    s      | |  i   j Sd S(   s~   Indicate whether the named section is present in the configuration.

        The DEFAULT section is not acknowledged.
        N(   s   sections   selfs   sections(   s   selfs   sections)   /mit/python/lib/python2.0/ConfigParser.pys   has_section s   c    s      y  |  i | i   } Wn%  t j
 o  t |   n X | i |  i   | i	 d  o  | d =n  | i
   Sd S(   s9   Return a list of option names for the given section name.s   __name__N(   s   selfs   _ConfigParser__sectionss   sections   copys   optss   KeyErrors   NoSectionErrors   updates   _ConfigParser__defaultss   has_keys   keys(   s   selfs   sections   optss)   /mit/python/lib/python2.0/ConfigParser.pys   options s   c    s       | |  i |  j Sd S(   s6   Return whether the given section has the given option.N(   s   options   selfs   optionss   section(   s   selfs   sections   options)   /mit/python/lib/python2.0/ConfigParser.pys
   has_option s   c    s      t  |  t  d  t  d  g j o  | g } n  xh | d  r[ }  y  t |  } Wn  t j
 o  qJ n X |  i | |   | i   qJ Wd S(   s  Read and parse a filename or a list of filenames.
        
        Files that cannot be opened are silently ignored; this is
        designed so that you can specify a list of potential
        configuration file locations (e.g. current directory, user's
        home directory, systemwide directory), and all existing
        configuration files in the list will be read.  A single
        filename may also be given.
        s    u    i    N(	   s   types	   filenamess   filenames   opens   fps   IOErrors   selfs   _ConfigParser__reads   close(   s   selfs	   filenamess   filenames   fps)   /mit/python/lib/python2.0/ConfigParser.pys   read s   	( 	c    sf      | t j o9  y  | i } Wn  t j
 o  d } n Xn  |  i | |  d S(   s  Like read() but the argument must be a file-like object.

        The `fp' argument must have a `readline' method.  Optional
        second argument is the `filename', which if not given, is
        taken from fp.name.  If fp has no `name' attribute, `<???>' is
        used.

        s   <???>N(   s   filenames   Nones   fps   names   AttributeErrors   selfs   _ConfigParser__read(   s   selfs   fps   filenames)   /mit/python/lib/python2.0/ConfigParser.pys   readfp s   c    s   y |  i | i   } WnB 	t j
 o3 
| t j o h  } n t |   n X|  i i   } | i
 |  | o | i
 |  n |  i |  } y | | } Wn( t j
 o t | |   n X| o | Sn | } d }	 x |	 d j  o|  |	 d }	 !t i | d  d j oK "y #| | } Wn0 $t j
 o! }
 %t |
 | | |   n Xn 'Pq&W(| i d  d j o )t | | |   n *| Sd 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, unless the optional argument
        `raw' is true.  Additional substitutions may be provided using the
        `vars' argument, which must be a dictionary whose contents overrides
        any pre-existing defaults.

        The section DEFAULT is special.
        i    i
   i   s   %(N(   s   selfs   _ConfigParser__sectionss   sections   copys   sectdicts   KeyErrors   DEFAULTSECTs   NoSectionErrors   _ConfigParser__defaultss   ds   updates   varss   optionxforms   options   rawvals   NoOptionErrors   raws   values   depths   strings   finds   keys   InterpolationErrors   InterpolationDepthError(   s   selfs   sections   options   raws   varss   sectdicts   ds   rawvals   values   depths   keys)   /mit/python/lib/python2.0/ConfigParser.pys   get s@   


		 !	i    c    s    ,-| |  i | |   Sd  S(   N(   s   convs   selfs   gets   sections   option(   s   selfs   sections   convs   options)   /mit/python/lib/python2.0/ConfigParser.pys   __get,s   c    s    /0|  i | t i |  Sd  S(   N(   s   selfs   _ConfigParser__gets   sections   strings   atois   option(   s   selfs   sections   options)   /mit/python/lib/python2.0/ConfigParser.pys   getint/s   c    s    23|  i | t i |  Sd  S(   N(   s   selfs   _ConfigParser__gets   sections   strings   atofs   option(   s   selfs   sections   options)   /mit/python/lib/python2.0/ConfigParser.pys   getfloat2s   c    s_   56|  i | |  } 7t i |  } 8| d d f j o 9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   vals)   /mit/python/lib/python2.0/ConfigParser.pys
   getboolean5s
   c    s   <=t  i |  Sd  S(   N(   s   strings   lowers	   optionstr(   s   selfs	   optionstrs)   /mit/python/lib/python2.0/ConfigParser.pys   optionxform<s   c    so   ?@A| p
 | d j o B|  i i |  Sn7 C|  i |  o Dd Sn F|  i | i |  Sd S(   s=   Check for the existence of a given option in a given section.s   DEFAULTi    N(   s   sections   selfs   _ConfigParser__defaultss   has_keys   options   has_sections   _ConfigParser__sections(   s   selfs   sections   options)   /mit/python/lib/python2.0/ConfigParser.pys
   has_option?s   c    s~   HIJ| p
 | d j o K|  i } n@ My N|  i | } Wn% Ot j
 o Pt |   n XQ| | | <d S(   s   Set an option.s   DEFAULTN(	   s   sections   selfs   _ConfigParser__defaultss   sectdicts   _ConfigParser__sectionss   KeyErrors   NoSectionErrors   values   option(   s   selfs   sections   options   values   sectdicts)   /mit/python/lib/python2.0/ConfigParser.pys   setHs   c    s-  STU|  i of V| i d  Wx< |  i i   d Wr& \ } } X| i d | | f  q8 WY| i d  n Zx |  i   d Zr } [| i d | d  \|  i	 | } ]xS | i   d ]r@ \ } } ^| d j o
 _q n `| i d | | f  q Wa| i d  q Wd S(	   s?   Write an .ini-format representation of the configuration state.s
   [DEFAULT]
i    s   %s = %s
s   
s   [s   ]
s   __name__N(   s   selfs   _ConfigParser__defaultss   fps   writes   itemss   keys   values   sectionss   sections   _ConfigParser__sectionss   sectdict(   s   selfs   fps   keys   values   sections   sectdicts)   /mit/python/lib/python2.0/ConfigParser.pys   writeSs"     	 
c    s   cde| p
 | d j o f|  i } n@ hy i|  i | } Wn% jt j
 o kt |   n Xl| i t  } m| o n| t =n o| Sd S(   s   Remove an option.s   DEFAULTN(
   s   sections   selfs   _ConfigParser__defaultss   sectdicts   _ConfigParser__sectionss   KeyErrors   NoSectionErrors   has_keys   keys   existed(   s   selfs   sections   options   sectdicts   existeds)   /mit/python/lib/python2.0/ConfigParser.pys   remove_optioncs   
c    s?   qrs|  i i |  o t|  i | =ud Sn wd Sd S(   s   Remove a file section.i   i    N(   s   selfs   _ConfigParser__sectionss   has_keys   section(   s   selfs   sections)   /mit/python/lib/python2.0/ConfigParser.pys   remove_sectionqs
   s   \[(?P<header>[-\w_.*,(){} ]+)\]s@   (?P<option>[-\w_.*,(){}]+)[ \t]*(?P<vi>[:=])[ \t]*(?P<value>.*)$c    sa  t  } t  } d } t  } xd o| i   } | o Pn | d } t i	 |  d j p | d d j o
 q0 n t i
 t i |  d  d j o | d d j o
 q0 n | d d j o | t  j	 o | o= t i	 |  } | o | | d | | | <n n|  i i |  }	 |	 o |	 i d	  }
 |  i i |
  o |  i |
 } nC |
 t j o |  i } n# h  |
 d
 <} | |  i |
 <t  } nU| t  j o t | | |   n+|  i i |  }	 |	 o |	 i d d d  \ } } } | d d f j o
 d | j oL t i | d  } | o | | d t i j o | |  } n n t i	 |  } | d j o d } n | | |  i |  <n3 | o t  |  } n | i! | |  q0 W| o |  n d 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   rRs    	s   
 s   headers   __name__s   options   vis   values   =s   :s   ;s   ""N("   s   Nones   cursects   optnames   linenos   es   fps   readlines   lines   strings   strips   lowers   splits   values   selfs   SECTCREs   matchs   mos   groups   sectnames   _ConfigParser__sectionss   has_keys   DEFAULTSECTs   _ConfigParser__defaultss   MissingSectionHeaderErrors   fpnames   OPTCREs   vis   optvals   finds   poss
   whitespaces   optionxforms   ParsingErrors   append(   s   selfs   fps   fpnames   cursects   optnames   linenos   es   lines   values   mos   sectnames   vis   optvals   poss)   /mit/python/lib/python2.0/ConfigParser.pys   __reads^   					 
*
7
(
!

!#"
(   s   Nones   __init__s   defaultss   sectionss   add_sections   has_sections   optionss
   has_options   reads   readfps   gets   _ConfigParser__gets   getints   getfloats
   getbooleans   optionxforms   sets   writes   remove_options   remove_sections   res   compiles   SECTCREs   OPTCREs   _ConfigParser__read(    s)   /mit/python/lib/python2.0/ConfigParser.pys   ConfigParser s.   
0		(   s   __doc__s   syss   strings   res   DEFAULTSECTs   MAX_INTERPOLATION_DEPTHs   Errors   NoSectionErrors   DuplicateSectionErrors   NoOptionErrors   InterpolationErrors   InterpolationDepthErrors   ParsingErrors   MissingSectionHeaderErrors   ConfigParser(    s)   /mit/python/lib/python2.0/ConfigParser.pys   ?V s   		
