
?:c       s   d  Z  d k Z d k Z d k Z d 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 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   d d  Z  d   Z RS(   Nc    s   | |  _ d  S(   N(   s   msgs   selfs   _msg(   s   selfs   msgs;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   __init__d s    s    c    s   |  i Sd  S(   N(   s   selfs   _msg(   s   selfs;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   __repr__f s    (   s   __init__s   __repr__(    s;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   Errorc 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   sections;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   __init__j s    (   s   __init__(    s;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   NoSectionErrori 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   sections;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   __init__o s    (   s   __init__(    s;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   DuplicateSectionErrorn 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   sections;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   __init__t s    	(   s   __init__(    s;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   NoOptionErrors s    s   InterpolationErrorc      s   d   Z  RS(   Nc    s?   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;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   __init__{ s
    			(   s   __init__(    s;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   InterpolationErrorz s    s   InterpolationDepthErrorc      s   d   Z  RS(   Nc    s3   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;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   __init__ s    		(   s   __init__(    s;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   InterpolationDepthError s    s   ParsingErrorc      s   d   Z  d   Z RS(   Nc    s*   t  i |  d |  | |  _ g  |  _ d  S(   Ns    File contains parsing errors: %s(   s   Errors   __init__s   selfs   filenames   errors(   s   selfs   filenames;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   __init__ s    	c    s4   |  i i | | f  |  i d | | f |  _ d  S(   Ns   
	[line %2d]: %s(   s   selfs   errorss   appends   linenos   lines   _msg(   s   selfs   linenos   lines;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   append s    (   s   __init__s   append(    s;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   ParsingError s    	s   MissingSectionHeaderErrorc      s   d   Z  RS(   Nc    s<   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;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   __init__ s
    			(   s   __init__(    s;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   MissingSectionHeaderError s    s   ConfigParserc      s   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 d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z e i d  Z e i 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   defaultss;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   __init__ s    	c    s   |  i Sd  S(   N(   s   selfs   _ConfigParser__defaults(   s   selfs;   /home/guest/edwardam/cmp2/py2/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;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   sections 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   sections;   /home/guest/edwardam/cmp2/py2/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;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   has_section s     c    sr   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;   /home/guest/edwardam/cmp2/py2/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;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys
   has_option s     c    s   t  |  t  d  t  d  g j o | g } n xS | d rI } y t |  } Wn t j
 o
 q; n X|  i | |  | i   q; 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;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   read s    	 %	 c    sN   | t j o- 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;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   readfp s     c    s  y |  i | i   } Wn6 t j
 o* | 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 }	 xu |	 d j  og |	 d }	 t i | d  d j o? y | | } Wn* 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;   /home/guest/edwardam/cmp2/py2/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;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   __get,s    c    s   |  i | t i |  Sd  S(   N(   s   selfs   _ConfigParser__gets   sections   strings   atois   option(   s   selfs   sections   options;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   getint/s    c    s   |  i | t i |  Sd  S(   N(   s   selfs   _ConfigParser__gets   sections   strings   atofs   option(   s   selfs   sections   options;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   getfloat2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   vals;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys
   getboolean5s
    c    s   t  i |  Sd  S(   N(   s   strings   lowers	   optionstr(   s   selfs	   optionstrs;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   optionxform<s    c    sZ   | p
 | d j o |  i i |  Sn. |  i |  o d Sn |  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;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys
   has_option?s     c    sc   | p
 | d j o |  i } n4 y |  i | } Wn t j
 o t |   n X| | | <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;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   setHs     c    s   |  i oW | i d  x6 |  i i   d r# \ } } | i d | | f  q) W| i d  n x |  i   d r } | i d | d  |  i	 | } xG | i   d r7 \ } } | d j o q n | i d | | f  q W| i d  qp 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;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   writeSs"     
   c    s~   | p
 | d j o |  i } n4 y |  i | } Wn t j
 o t |   n X| i t  } | o | t =n | 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;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   remove_optioncs     c    s-   |  i i |  o |  i | =d Sn d Sd S(   s   Remove a file section.i   i    N(   s   selfs   _ConfigParser__sectionss   has_keys   section(   s   selfs   sections;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   remove_sectionqs
     
s   \[(?P<header>[-\w_.*,(){} ]+)\]s@   (?P<option>[-\w_.*,(){}]+)[ \t]*(?P<vi>[:=])[ \t]*(?P<value>.*)$c    s  t  } t  } d } t  } 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 | o4 t i	 |  } | o | | d | | | <n n|  i i |  }	 |	 os |	 i d	  }
 |  i i |
  o |  i |
 } n7 |
 t j o |  i } n h  |
 d
 <} | |  i |
 <t  } n%| t  j o t | | |   n|  i i |  }	 |	 o |	 i d d d  \ } } } | d d f j o
 d | j oC t i | d  } | o | | d t i j o | |  } n n t i	 |  } | d j o
 d } n | | |  i |  <n* | o t  |  } n | i! | |  q 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;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   __reads^    	  
'4%
 
(   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;   /home/guest/edwardam/cmp2/py2/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;   /home/guest/edwardam/cmp2/py2/lib/python2.0/ConfigParser.pys   ?V s   			
