ok

Mini Shell

Direktori : /proc/self/root/proc/thread-self/root/proc/self/root/usr/lib/python2.7/site-packages/
Upload File :
Current File : //proc/self/root/proc/thread-self/root/proc/self/root/usr/lib/python2.7/site-packages/configobj.pyc

�
P��Kc@s3ddlmZddlZddlZddlZddlmZmZmZm	Z	e
aide
fe6ddfe6ddfe	6ddfe6Zidd6dd6dd	6dd
6dd6dd6dd6dd6dd
6dd6dd6dd6dd6dd6dd6Z
ied6ed6ed6e	d6ee
6Zd�ZdZdZdZdZdZdZe�ZdZyeWnek
r�d�ZnXddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.fZd/Zd0Zd1Zied26e d36ed46e d56e d66e
d76ed86e
d96e
d:6e
d;6e d<6e d=6Z!d>�Z"d,e#fd?��YZ$d@efdA��YZ%e%�Z&dB�Z'de(fdC��YZ)d e)fdD��YZ*d!e)fdE��YZ+d*e,fdF��YZ-d"e)fdG��YZ.d#e)fdH��YZ/d&e)fdI��YZ0d'e0fdJ��YZ1d)e)fdK��YZ2d(e0fdL��YZ3d+e)fdM��YZ4dNefdO��YZ5dPe5fdQ��YZ6dRe5fdS��YZ7ie6d/6e7dT6Z8dU�Z9dVe:fdW��YZ;d$e;fdX��YZ<d%efdY��YZ=e
e
dZ�Z>fd[�Z?dS(\i����(t
generatorsN(tBOM_UTF8t	BOM_UTF16tBOM_UTF16_BEtBOM_UTF16_LEtutf_8tutf16_betutf_16tutf16_letu16tutf16sutf-16t	utf_16_besutf-16bet	utf_16_lesutf-16letu8tutftutf8sutf-8cCstj|j��dkS(NR(tBOM_LISTtgettlower(tencoding((s-/usr/lib/python2.7/site-packages/configobj.pyt
match_utf8Gss'%s's"%s"s%ss 
	'"s"""%s"""s'''%s'''s4.7.2cCsx|D]}|rtSqWtS(N(tTruetFalse(titerabletentry((s-/usr/lib/python2.7/site-packages/configobj.pytany[s
t__version__tDEFAULT_INDENT_TYPEtDEFAULT_INTERPOLATIONtConfigObjErrortNestingErrort
ParseErrortDuplicateErrortConfigspecErrort	ConfigObjt	SimpleValtInterpolationErrortInterpolationLoopErrortMissingInterpolationOptiontRepeatSectionErrortReloadErrortUnreprErrortUnknownTypetflatten_errorstget_extra_valuestconfigparsers    i
t
interpolationtraise_errorstlist_valuestcreate_emptyt
file_errort
configspect	stringifytindent_typeRtdefault_encodingtunreprtwrite_empty_valuescCsVtdkrddland|}tj|�}|j�dj�dj�dS(Ni����sa=ii(tcompilertNonetparsetgetChildren(tstp((s-/usr/lib/python2.7/site-packages/configobj.pytgetObj�s

cBseZRS((t__name__t
__module__(((s-/usr/lib/python2.7/site-packages/configobj.pyR*�stBuildercBsbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
cCsGt|d|jjd�}|dkr=t|jj��n||�S(Ntbuild_(tgetattrt	__class__R@R:R*(tselftotm((s-/usr/lib/python2.7/site-packages/configobj.pytbuild�scCst|j|j��S(N(tmapRIR<(RFRG((s-/usr/lib/python2.7/site-packages/configobj.pyt
build_List�scCs|jS(N(tvalue(RFRG((s-/usr/lib/python2.7/site-packages/configobj.pytbuild_Const�scCsIi}tt|j|j���}x|D]}|j�||<q+W|S(N(titerRJRIR<tnext(RFRGtdtitel((s-/usr/lib/python2.7/site-packages/configobj.pyt
build_Dict�s

cCst|j|��S(N(ttupleRK(RFRG((s-/usr/lib/python2.7/site-packages/configobj.pytbuild_Tuple�scCsI|jdkrdS|jdkr&tS|jdkr9tStd��dS(NR:RRsUndefined Name(tnameR:RRR*(RFRG((s-/usr/lib/python2.7/site-packages/configobj.pyt
build_Name�scCs�t|j|j��\}}yt|�}Wntk
rMtd��nXt|t�sm|jdkr|td��n||S(NtAddg(	RJRMR<tfloatt	TypeErrorR*t
isinstancetcomplextreal(RFRGR]timag((s-/usr/lib/python2.7/site-packages/configobj.pyt	build_Add�s
cCs"|j|j�}t||j�S(N(RItexprRDtattrname(RFRGtparent((s-/usr/lib/python2.7/site-packages/configobj.pyt
build_Getattr�scCs|j|j�d�S(Ni(RMR<(RFRG((s-/usr/lib/python2.7/site-packages/configobj.pytbuild_UnarySub�scCs|j|j�d�S(Ni(RMR<(RFRG((s-/usr/lib/python2.7/site-packages/configobj.pytbuild_UnaryAdd�s(R@RARIRKRMRSRURWR_RcRdRe(((s-/usr/lib/python2.7/site-packages/configobj.pyRB�s							
		cCs|s
|Stjt|��S(N(t_builderRIR?(R=((s-/usr/lib/python2.7/site-packages/configobj.pyR7�scBs eZdZdddd�ZRS(sk
    This is the base class for all errors that ConfigObj raises.
    It is a subclass of SyntaxError.
    tcCs&||_||_tj||�dS(N(tlinetline_numbertSyntaxErrort__init__(RFtmessageRiRh((s-/usr/lib/python2.7/site-packages/configobj.pyRk�s		N(R@RAt__doc__R:Rk(((s-/usr/lib/python2.7/site-packages/configobj.pyR�scBseZdZRS(sE
    This error indicates a level of nesting that doesn't match.
    (R@RARm(((s-/usr/lib/python2.7/site-packages/configobj.pyR�scBseZdZRS(s�
    This error indicates that a line is badly written.
    It is neither a valid ``key = value`` line,
    nor a valid section marker line.
    (R@RARm(((s-/usr/lib/python2.7/site-packages/configobj.pyR�scBseZdZd�ZRS(sW
    A 'reload' operation failed.
    This exception is a subclass of ``IOError``.
    cCstj|d�dS(Ns#reload failed, filename is not set.(tIOErrorRk(RF((s-/usr/lib/python2.7/site-packages/configobj.pyRk�s(R@RARmRk(((s-/usr/lib/python2.7/site-packages/configobj.pyR(�scBseZdZRS(s:
    The keyword or section specified already exists.
    (R@RARm(((s-/usr/lib/python2.7/site-packages/configobj.pyR �scBseZdZRS(s7
    An error occured whilst parsing a configspec.
    (R@RARm(((s-/usr/lib/python2.7/site-packages/configobj.pyR!scBseZdZRS(s,Base class for the two interpolation errors.(R@RARm(((s-/usr/lib/python2.7/site-packages/configobj.pyR$scBseZdZd�ZRS(s=Maximum interpolation depth exceeded in string interpolation.cCstj|d|�dS(Ns*interpolation loop detected in value "%s".(R$Rk(RFtoption((s-/usr/lib/python2.7/site-packages/configobj.pyRks(R@RARmRk(((s-/usr/lib/python2.7/site-packages/configobj.pyR%scBseZdZRS(sk
    This error indicates additional sections in a section with a
    ``__many__`` (repeated) section.
    (R@RARm(((s-/usr/lib/python2.7/site-packages/configobj.pyR'scBseZdZd�ZRS(s0A value specified for interpolation was missing.cCsd|}tj||�dS(Ns%missing option "%s" in interpolation.(R$Rk(RFRotmsg((s-/usr/lib/python2.7/site-packages/configobj.pyRk!s
(R@RARmRk(((s-/usr/lib/python2.7/site-packages/configobj.pyR&scBseZdZRS(s An error parsing in unrepr mode.(R@RARm(((s-/usr/lib/python2.7/site-packages/configobj.pyR)&stInterpolationEnginecBsGeZdZejd�ZdZd�Zd�Zd�Z	d�Z
RS(s�
    A helper class to help perform string interpolation.

    This class is an abstract base class; its descendants perform
    the actual work.
    s
%\(([^)]*)\)st%cCs
||_dS(N(tsection(RFRs((s-/usr/lib/python2.7/site-packages/configobj.pyRk7scsA�j|kr|S��fd���||�ji�}|S(Ncs||jf|kr$t|��nd|||jf<�jj|�}x�|r��j|�\}}}|dkr|}n�||||�}|j�\}	}
dj||	 |||
f�}|	t|�}�jj||�}qLW|||jf=|S(sxThe function that does the actual work.

            ``value``: the string we're trying to interpolate.
            ``section``: the section in which that string was found
            ``backtrail``: a dict to keep track of where we've been,
            to detect and prevent infinite recursion loops

            This is similar to a depth-first-search algorithm.
            iRgN(	RVR%t_KEYCREtsearcht_parse_matchR:tspantjointlen(tkeyRLRst	backtrailtmatchtktvR=treplacementtstarttendtnew_search_start(trecursive_interpolateRF(s-/usr/lib/python2.7/site-packages/configobj.pyR�As		 (t_cookieRs(RFRzRL((R�RFs-/usr/lib/python2.7/site-packages/configobj.pytinterpolate<s
,cCs�|jjj}t|jj_|j}x�tr�|j|�}|dk	r_t|t�r_Pn|jdi�j|�}|dk	r�t|t�r�Pn|j	|kr�Pn|j	}q*W||jj_|dkr�t
|��n||fS(s�Helper function to fetch values from owning section.

        Returns a 2-tuple: the value, and the section where it was found.
        tDEFAULTN(RstmainR.RRRR:R[tSectionRbR&(RFRztsave_interptcurrent_sectiontval((s-/usr/lib/python2.7/site-packages/configobj.pyt_fetchqs"		
cCs
t��dS(s�Implementation-dependent helper function.

        Will be passed a match object corresponding to the interpolation
        key we just found (e.g., "%(foo)s" or "$foo"). Should look up that
        key in the appropriate config file section (using the ``_fetch()``
        helper function) and return a 3-tuple: (key, value, section)

        ``key`` is the name of the key we're looking for
        ``value`` is the value found for that key
        ``section`` is a reference to the section where it was found

        ``key`` and ``section`` should be None if no further
        interpolation should be performed on the resulting value
        (e.g., if we interpolated "$$" and returned "$").
        N(tNotImplementedError(RFR|((s-/usr/lib/python2.7/site-packages/configobj.pyRv�s(R@RARmtretcompileRtR�RkR�R�Rv(((s-/usr/lib/python2.7/site-packages/configobj.pyRq+s		5	"tConfigParserInterpolationcBs,eZdZdZejd�Zd�ZRS(sBehaves like ConfigParser.Rrs
%\(([^)]*)\)scCs1|jd�}|j|�\}}|||fS(Ni(tgroupR�(RFR|RzRLRs((s-/usr/lib/python2.7/site-packages/configobj.pyRv�s(R@RARmR�R�R�RtRv(((s-/usr/lib/python2.7/site-packages/configobj.pyR��stTemplateInterpolationcBs?eZdZdZdZejdejejB�Z	d�Z
RS(sBehaves like string.Template.t$s�
        \$(?:
          (?P<escaped>\$)              |   # Two $ signs
          (?P<named>[_a-z][_a-z0-9]*)  |   # $name format
          {(?P<braced>[^}]*)}              # ${name} format
        )
        cCs�|jd�p|jd�}|dk	rL|j|�\}}|||fS|jd�dk	rqd|jdfSd|j�dfS(Ntnamedtbracedtescaped(R�R:R�t
_delimiter(RFR|RzRLRs((s-/usr/lib/python2.7/site-packages/configobj.pyRv�s
(R@RARmR�R�R�R�t
IGNORECASEtVERBOSERtRv(((s-/usr/lib/python2.7/site-packages/configobj.pyR��sttemplatecGs|j||�S(N(t__new__(tclstargs((s-/usr/lib/python2.7/site-packages/configobj.pyt
__newobj__�sR�cBsReZdZd�Zd�Zd!d!d�Zd�Zd�Zd�Z	e
d�Zd�Zd!d	�Z
d
�Zed�Zd�Zd
�Zd!d�Zd�Zd�Zd�Zd�Zd�ZeZd�Zd�ZeZde_d�Zd�Zd�Ze e
d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d �Z'RS("s�
    A dictionary-like object that represents a section in a config file.
    
    It does string interpolation if the 'interpolation' attribute
    of the 'main' object is set to True.
    
    Interpolation is tried first from this object, then from the 'DEFAULT'
    section of this object, next from the parent and its 'DEFAULT' section,
    and so on until the main object is reached.
    
    A Section will behave like an ordered dictionary - following the
    order of the ``scalars`` and ``sections`` attributes.
    You can use this to change the order of members.
    
    Iteration follows the order: scalars, then sections.
    cCs,tj||d�|jj|d�dS(Nii(tdicttupdatet__dict__(RFtstate((s-/usr/lib/python2.7/site-packages/configobj.pyt__setstate__�scCs(t|�|jf}t|jf|fS(N(R�R�R�RE(RFR�((s-/usr/lib/python2.7/site-packages/configobj.pyt
__reduce__�scCs{|dkri}ntj|�||_||_||_||_|j�x$|j�D]\}}|||<q]WdS(s�
        * parent is the section above
        * depth is the depth level of this section
        * main is the main ConfigObj
        * indict is a dictionary to initialise the section with
        N(	R:R�RkRbR�tdepthRVt_initialiset	iteritems(RFRbR�R�tindictRVRRL((s-/usr/lib/python2.7/site-packages/configobj.pyRk�s	
				
cCsUg|_g|_i|_i|_d|_g|_i|_g|_t	|_
dS(N(tscalarstsectionstcommentstinline_commentsR:R3tdefaultstdefault_valuestextra_valuesRt_created(RF((s-/usr/lib/python2.7/site-packages/configobj.pyR�
s								cCs�y
|j}Wntk
r�|jj}|tkr>t}n|j�}tj|d�}|dkrxt
|j_|S||�}|_nX|j||�S(N(t_interpolation_enginetAttributeErrorR�R.RRRtinterpolation_enginesRR:RR�(RFRzRLtengineRVtclass_((s-/usr/lib/python2.7/site-packages/configobj.pyt_interpolates

	cs�tj���}�jjr�t|t�r=�j�|�St|t�r���fd�}g|D]}||�^qe}||kr�|Sq�n|S(s+Fetch the item and do string interpolation.cs#t|t�r�j�|�S|S(N(R[t
basestringR�(R(RzRF(s-/usr/lib/python2.7/site-packages/configobj.pyt_check<s(R�t__getitem__R�R.R[R�R�tlist(RFRzR�R�Rtnew((RzRFs-/usr/lib/python2.7/site-packages/configobj.pyR�5s
cCs�t|t�s"td|��n||jkrNg|j|<d|j|<n||jkrp|jj|�nt|t�r�||kr�|jj	|�nt
j|||�n!t|t
�r'|r'||kr�|jj	|�n|jd}t
j||t|||j
d|d|��n�||krF|jj	|�n|j
js�t|t�rdq�t|ttf�r�xC|D](}t|t�s�td|��q�q�Wq�td|��nt
j|||�dS(s�
        Correctly set a value.
        
        Making dictionary values Section instances.
        (We have to special case 'Section' instances - which are also dicts)
        
        Keys must be strings.
        Values need only be strings (or lists of strings) if
        ``main.stringify`` is set.
        
        ``unrepr`` must be set when setting a value to a dictionary, without
        creating a new sub-section.
        sThe key "%s" is not a string.RgiR�RVsValue is not a string "%s".N(R[R�t
ValueErrorR�R�R�tremoveR�R�tappendR�t__setitem__R�R�R�R4R�RTRZ(RFRzRLR7t	new_depthR((s-/usr/lib/python2.7/site-packages/configobj.pyR�FsF

	

cCsZtj||�||jkr2|jj|�n|jj|�|j|=|j|=dS(s-Remove items from the sequence when deleting.N(R�t__delitem__R�R�R�R�R�(RFRz((s-/usr/lib/python2.7/site-packages/configobj.pyR��s
cCs%y||SWntk
r |SXdS(s>A version of ``get`` that doesn't bypass string interpolation.N(tKeyError(RFRztdefault((s-/usr/lib/python2.7/site-packages/configobj.pyR�s
cCs#x|D]}||||<qWdS(sD
        A version of update that uses our ``__setitem__``.
        N((RFR�R((s-/usr/lib/python2.7/site-packages/configobj.pyR��s
cCsEy||}Wn)tk
r9|tkr0�n|}nX||=|S(s�
        'D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
        If key is not found, d is returned if given, otherwise KeyError is raised'
        (R�tMISSING(RFRzR�R�((s-/usr/lib/python2.7/site-packages/configobj.pytpop�s

cCsJ|j|j}|s%td��n|d}||}||=||fS(sPops the first (key,val)s": 'popitem(): dictionary is empty'i(R�R�R�(RFtsequenceRzR�((s-/usr/lib/python2.7/site-packages/configobj.pytpopitem�s

cCsPtj|�g|_g|_i|_i|_d|_g|_g|_	dS(s�
        A version of clear that also affects scalars/sections
        Also clears comments and configspec.
        
        Leaves other attributes alone :
            depth/main/parent are not affected
        N(
R�tclearR�R�R�R�R:R3R�R�(RF((s-/usr/lib/python2.7/site-packages/configobj.pyR��s
						cCs3y||SWn tk
r.|||<||SXdS(s:A version of setdefault that sets sequence if appropriate.N(R�(RFRzR�((s-/usr/lib/python2.7/site-packages/configobj.pyt
setdefault�s


cCst|j|j|j��S(s8D.items() -> list of D's (key, value) pairs, as 2-tuples(tzipR�R�tvalues(RF((s-/usr/lib/python2.7/site-packages/configobj.pytitems�scCs|j|jS(sD.keys() -> list of D's keys(R�R�(RF((s-/usr/lib/python2.7/site-packages/configobj.pytkeys�scCs%g|j|jD]}||^qS(s D.values() -> list of D's values(R�R�(RFRz((s-/usr/lib/python2.7/site-packages/configobj.pyR��scCst|j��S(s=D.iteritems() -> an iterator over the (key, value) items of D(RNR�(RF((s-/usr/lib/python2.7/site-packages/configobj.pyR��scCst|j|j�S(s.D.iterkeys() -> an iterator over the keys of D(RNR�R�(RF((s-/usr/lib/python2.7/site-packages/configobj.pytiterkeys�scCst|j��S(s2D.itervalues() -> an iterator over the values of D(RNR�(RF((s-/usr/lib/python2.7/site-packages/configobj.pyt
itervalues�sc	sY�fd�}ddjg�j�jD](}dt|�t||��f^q)�S(sx.__repr__() <==> repr(x)cs1y�|SWntk
r,tj�|�SXdS(N(R&R�R�(Rz(RF(s-/usr/lib/python2.7/site-packages/configobj.pyt_getval�s
s{%s}s, s%s: %s(RxR�R�trepr(RFR�Rz((RFs-/usr/lib/python2.7/site-packages/configobj.pyt__repr__�ssx.__str__() <==> str(x)cCs�i}x||D]t}||}t|t�r;|j�}n<t|t�rYt|�}nt|t�rwt|�}n|||<q
W|S(s0
        Return a deepcopy of self as a dictionary.
        
        All members that are ``Section`` instances are recursively turned to
        ordinary dictionaries - by calling their ``dict`` method.
        
        >>> n = a.dict()
        >>> n == a
        1
        >>> n is a
        0
        (R[R�R�R�RT(RFtnewdictRt
this_entry((s-/usr/lib/python2.7/site-packages/configobj.pyR�s


cCsmxf|j�D]X\}}||kr[t||t�r[t|t�r[||j|�q
|||<q
WdS(sQ
        A recursive update - useful for merging config files.
        
        >>> a = '''[section1]
        ...     option1 = True
        ...     [[subsection]]
        ...     more_options = False
        ...     # end of file'''.splitlines()
        >>> b = '''# File is user.ini
        ...     [section1]
        ...     option1 = False
        ...     # end of file'''.splitlines()
        >>> c1 = ConfigObj(b)
        >>> c2 = ConfigObj(a)
        >>> c2.merge(c1)
        >>> c2
        ConfigObj({'section1': {'option1': 'False', 'subsection': {'more_options': 'False'}}})
        N(R�R[R�tmerge(RFR�RzR�((s-/usr/lib/python2.7/site-packages/configobj.pyR�s
cCs�||jkr|j}n+||jkr6|j}ntd|��|j|�}||}tj||�tj|||�|j|�|j||�|j	|}|j
|}|j	|=|j
|=||j	|<||j
|<dS(s
        Change a keyname to another, without changing position in sequence.
        
        Implemented so that transformations can be made on keys,
        as well as on values. (used by encode and decode)
        
        Also renames comments.
        sKey "%s" not found.N(R�R�R�tindexR�R�R�R�tinsertR�R�(RFtoldkeytnewkeytthe_listtposR�tcommtinline_comment((s-/usr/lib/python2.7/site-packages/configobj.pytrename9s"	






c	KsOi}x�tt|j��D]w}|j|}y-||||�}|j|}|||<Wqtk
r�|rx�q�|j|}t||<qXqWx�tt|j��D]�}|j|}|r!y||||�Wn4tk
r|r��q|j|}t||<nX|j|}n||j|d|d||�||<q�W|S(s�
        Walk every member and call a function on the keyword and value.
        
        Return a dictionary of the return values
        
        If the function raises an exception, raise the errror
        unless ``raise_errors=False``, in which case set the return value to
        ``False``.
        
        Any unrecognised keyword arguments you pass to walk, will be pased on
        to the function you pass in.
        
        Note: if ``call_on_sections`` is ``True`` then - on encountering a
        subsection, *first* the function is called for the *whole* subsection,
        and then recurses into it's members. This means your function must be
        able to handle strings, dictionaries and lists. This allows you
        to change the key of subsections as well as for ordinary members. The
        return value when called on the whole subsection has to be discarded.
        
        See  the encode and decode methods for examples, including functions.
        
        .. admonition:: caution
        
            You can use ``walk`` to transform the names of members of a section
            but you mustn't add or delete members.
        
        >>> config = '''[XXXXsection]
        ... XXXXkey = XXXXvalue'''.splitlines()
        >>> cfg = ConfigObj(config)
        >>> cfg
        ConfigObj({'XXXXsection': {'XXXXkey': 'XXXXvalue'}})
        >>> def transform(section, key):
        ...     val = section[key]
        ...     newkey = key.replace('XXXX', 'CLIENT1')
        ...     section.rename(key, newkey)
        ...     if isinstance(val, (tuple, list, dict)):
        ...         pass
        ...     else:
        ...         val = val.replace('XXXX', 'CLIENT1')
        ...         section[newkey] = val
        >>> cfg.walk(transform, call_on_sections=True)
        {'CLIENT1section': {'CLIENT1key': None}}
        >>> cfg
        ConfigObj({'CLIENT1section': {'CLIENT1key': 'CLIENT1value'}})
        R/tcall_on_sections(trangeRyR�t	ExceptionRR�twalk(	RFtfunctionR/R�tkeywargstoutRQRR�((s-/usr/lib/python2.7/site-packages/configobj.pyR�Ws:/







cCs�||}|tkrtS|tkr*tSy3t|t�sHt��n|jj|j�SWn!tk
r�td|��nXdS(s_
        Accepts a key as input. The corresponding value must be a string or
        the objects (``True`` or 1) or (``False`` or 0). We allow 0 and 1 to
        retain compatibility with Python 2.2.
        
        If the string is one of  ``True``, ``On``, ``Yes``, or ``1`` it returns 
        ``True``.
        
        If the string is one of  ``False``, ``Off``, ``No``, or ``0`` it returns 
        ``False``.
        
        ``as_bool`` is not case sensitive.
        
        Any other input will raise a ``ValueError``.
        
        >>> a = ConfigObj()
        >>> a['a'] = 'fish'
        >>> a.as_bool('a')
        Traceback (most recent call last):
        ValueError: Value "fish" is neither True nor False
        >>> a['b'] = 'True'
        >>> a.as_bool('b')
        1
        >>> a['b'] = 'off'
        >>> a.as_bool('b')
        0
        s$Value "%s" is neither True nor FalseN(	RRR[R�R�R�t_boolsRR�(RFRzR�((s-/usr/lib/python2.7/site-packages/configobj.pytas_bool�s

cCst||�S(si
        A convenience method which coerces the specified value to an integer.
        
        If the value is an invalid literal for ``int``, a ``ValueError`` will
        be raised.
        
        >>> a = ConfigObj()
        >>> a['a'] = 'fish'
        >>> a.as_int('a')
        Traceback (most recent call last):
        ValueError: invalid literal for int() with base 10: 'fish'
        >>> a['b'] = '1'
        >>> a.as_int('b')
        1
        >>> a['b'] = '3.2'
        >>> a.as_int('b')
        Traceback (most recent call last):
        ValueError: invalid literal for int() with base 10: '3.2'
        (tint(RFRz((s-/usr/lib/python2.7/site-packages/configobj.pytas_int�scCst||�S(s
        A convenience method which coerces the specified value to a float.
        
        If the value is an invalid literal for ``float``, a ``ValueError`` will
        be raised.
        
        >>> a = ConfigObj()
        >>> a['a'] = 'fish'
        >>> a.as_float('a')
        Traceback (most recent call last):
        ValueError: invalid literal for float(): fish
        >>> a['b'] = '1'
        >>> a.as_float('b')
        1.0
        >>> a['b'] = '3.2'
        >>> a.as_float('b')
        3.2000000000000002
        (RY(RFRz((s-/usr/lib/python2.7/site-packages/configobj.pytas_float�scCs0||}t|ttf�r)t|�S|gS(sU
        A convenience method which fetches the specified value, guaranteeing
        that it is a list.
        
        >>> a = ConfigObj()
        >>> a['a'] = 1
        >>> a.as_list('a')
        [1]
        >>> a['a'] = (1,)
        >>> a.as_list('a')
        [1]
        >>> a['a'] = [1]
        >>> a.as_list('a')
        [1]
        (R[RTR�(RFRztresult((s-/usr/lib/python2.7/site-packages/configobj.pytas_lists

cCsF|j|}tj|||�||jkrB|jj|�n|S(s
        Restore (and return) default value for the specified key.
        
        This method will only work for a ConfigObj that was created
        with a configspec and has been validated.
        
        If there is no default value for this key, ``KeyError`` is raised.
        (R�R�R�R�R�(RFRzR�((s-/usr/lib/python2.7/site-packages/configobj.pytrestore_defaults
	
cCsGx|jD]}|j|�q
Wx|jD]}||j�q+WdS(s'
        Recursively restore default values to all members
        that have them.
        
        This method will only work for a ConfigObj that was created
        with a configspec and has been validated.
        
        It doesn't delete or modify entries without default values.
        N(R�R�R�trestore_defaults(RFRzRs((s-/usr/lib/python2.7/site-packages/configobj.pyR�+s
N((R@RARmR�R�R:RkR�R�R�RR�R�RR�R�R�R�R�R�R�R�R�R�R�t__iter__R�R�t__str__R�R�R�RR�R�R�R�R�R�R�(((s-/usr/lib/python2.7/site-packages/configobj.pyR��sH					;												
				T	,				cBsFeZdZejdej�Zejdej�Zejdej�Zejdej�Z	ejdej�Z
ejd�Zejd�Zejd�Z
ejd	�Ziee
fd
6eefd6Zied6ed
6ed6ed6ed6ed6ed6ed6Zd/d/d/d/eeeeeed/d/eeed�Zd�Zd/d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd �Z ed!�Z!d"�Z"d#�Z#d$�Z$d%�Z%d&�Z&d'�Z'd(�Z(d)�Z)d*�Z*d/d/d+�Z+eed/d,�Z,d-�Z-d.�Z.RS(0s2An object to read, create, and write config files.s�^ # line start
        (\s*)                   # indentation
        (                       # keyword
            (?:".*?")|          # double quotes
            (?:'.*?')|          # single quotes
            (?:[^'"=].*?)       # no quotes
        )
        \s*=\s*                 # divider
        (.*)                    # value (including list values and comments)
        $   # line end
        s=^
        (\s*)                     # 1: indentation
        ((?:\[\s*)+)              # 2: section marker open
        (                         # 3: section name open
            (?:"\s*\S.*?\s*")|    # at least one non-space with double quotes
            (?:'\s*\S.*?\s*')|    # at least one non-space with single quotes
            (?:[^'"\s].*?)        # at least one non-space unquoted
        )                         # section name close
        ((?:\s*\])+)              # 4: section marker close
        \s*(\#.*)?                # 5: optional comment
        $s�^
        (?:
            (?:
                (
                    (?:
                        (?:
                            (?:".*?")|              # double quotes
                            (?:'.*?')|              # single quotes
                            (?:[^'",\#][^,\#]*?)    # unquoted
                        )
                        \s*,\s*                     # comma
                    )*      # match all list items ending in a comma (if any)
                )
                (
                    (?:".*?")|                      # double quotes
                    (?:'.*?')|                      # single quotes
                    (?:[^'",\#\s][^,]*?)|           # unquoted
                    (?:(?<!,))                      # Empty value
                )?          # last item in a list - or string value
            )|
            (,)             # alternatively a single comma - empty list
        )
        \s*(\#.*)?          # optional comment
        $s�
        (
            (?:".*?")|          # double quotes
            (?:'.*?')|          # single quotes
            (?:[^'",\#]?.*?)       # unquoted
        )
        \s*,\s*                 # comma
        s^
        (
            (?:".*?")|          # double quotes
            (?:'.*?')|          # single quotes
            (?:[^'"\#].*?)|     # unquoted
            (?:)                # Empty value
        )
        \s*(\#.*)?              # optional comment
        $s^'''(.*?)'''\s*(#.*)?$s^"""(.*?)"""\s*(#.*)?$s^(.*?)'''\s*(#.*)?$s^(.*?)"""\s*(#.*)?$s'''s"""tyestnotontofft1t0ttruetfalsecCs�||_tj||d|�|p(g}i|d6|d6|d6|d6|d6|d6|	d6|
d	6|d
6|d6|
d6|d
6}|dkr�|}n�ddl}|jdtdd�x-|D]%}|tkr�td|��q�q�WxVtj	�D]H\}}||kr|||<n||}||kr�|||<q�q�W|rXt
|d<n|j|�|d}||_|j
||�dS(s�
        Parse a config file or create a config file object.
        
        ``ConfigObj(infile=None, configspec=None, encoding=None,
                    interpolation=True, raise_errors=False, list_values=True,
                    create_empty=False, file_error=False, stringify=True,
                    indent_type=None, default_encoding=None, unrepr=False,
                    write_empty_values=False, _inspec=False)``
        iR3RR.R/R0R1R2R4R5R6R7R8i����NsUPassing in an options dictionary to ConfigObj() is deprecated. Use **options instead.t
stacklevelisUnrecognised option "%s".(t_inspecR�RkR:twarningstwarntDeprecationWarningtOPTION_DEFAULTSRZR�RR�t_original_configspect_load(RFtinfiletoptionsR3RR.R/R0R1R2R4R5R6R7R8R�t_optionsR�RRLt
keyword_value((s-/usr/lib/python2.7/site-packages/configobj.pyRk�s<	

		






	c
s�t|t�r�||_tjj|�rXt|d�}|j�pHg}|j�q�|j	rwt
d|j��q�|jr�t|d�}|jd�|j�ng}n�t|t
tf�r�t
|�}n�t|t�rat|t�r�fd���||�nx|D]}||||<qW|`|dk	rT|j|�n	d|_dSt|dt�tk	r�|j�p�g}ntd��|r0|j|�}xY|D]Q}|s�|ddkr�q�nx*dD]"}|j|�r�||_Pq�q�WPq�Wg|D]}|jd�^q}n|j|�|jr�d|jd
j}t|j�dkr�d|}t|�}	n
|jd
}	|j|	_ ||	_!|	�n|`|dkr�d|_n
|j|�dS(NtrbsConfig file not found: "%s".twRgcsYx|jD]}||||<q
Wx0|jD]%}i||<�||||�q,WdS(N(R�R�(t
in_sectiontthis_sectionRRs(tset_section(s-/usr/lib/python2.7/site-packages/configobj.pyR	�s

treads>infile must be a filename, file like object, or list of lines.i����s
s
s
sat line %s.iis2Parsing failed with several errors.
First error %s(s
s
s
(s
s
s
("R[R�tfilenametostpathtisfiletopenR
tcloseR2RnR1twriteR�RTR�R"t_errorsR:t_handle_configspecR3RDR�RZt_handle_bomtendswithtnewlinestrstript_parseRiRyRterrorstconfig(
RFRR3thRRhR�tinfoRpterror((R	s-/usr/lib/python2.7/site-packages/configobj.pyR�sl	
		

	
	

	%
	

		cCs	|dkrt}nd|_g|_|d|_|d|_|d|_|d|_|d|_|d|_	|d|_
|d|_|d	|_t
|_d|_|d
|_|d|_g|_g|_d|_|jr�t
|_ntj|�dS(NR/R.R0R1R2R4R5RR6R8R7(R:R�RRR/R.R0R1R2R4R5RR6RtBOMRR8R7tinitial_commentt
final_commentR3R�R�R�(RFR((s-/usr/lib/python2.7/site-packages/configobj.pyR�>s.			








		

				c	sY�fd�}ddjg�j�jD](}dt|�t||��f^q)�S(Ncs1y�|SWntk
r,tj�|�SXdS(N(R&R�R�(Rz(RF(s-/usr/lib/python2.7/site-packages/configobj.pyR�_s
sConfigObj({%s})s, s%s: %s(RxR�R�R�(RFR�Rz((RFs-/usr/lib/python2.7/site-packages/configobj.pyR�^s	cCsI|jdk	r7|jj�tkr7|j||j�St|ttf�rY|d}n|}|jdk	rnt|jj�}|dkr�xKtj	�D]=\}\}}|s�q�n|j
|�r�|j||�Sq�W|j||j�St|}|j
|�s|j||j�S|t|�}t|ttf�rL||d<n|}t
|_|j||j�Sx�tj	�D]�\}\}}|j
|�s�q{q{||_|st
|_|t|�}t|ttf�r�||d<n|}t|t�r|jt
�S|Sn|j||�Sq{Wt|t�rE|jt
�S|S(s1
        Handle any BOM, and decode if necessary.
        
        If an encoding is specified, that *must* be used - but the BOM should
        still be removed (and the BOM attribute set).
        
        (If the encoding is wrongly specified, then a BOM for an alternative
        encoding won't be discovered or removed.)
        
        If an encoding is not specified, UTF8 or UTF16 BOM will be detected and
        removed. The BOM attribute will be set. UTF16 will be decoded to
        unicode.
        
        NOTE: This method must not be called with an empty ``infile``.
        
        Specifying the *wrong* encoding is likely to cause a
        ``UnicodeDecodeError``.
        
        ``infile`` must always be returned as a list of lines, but may be
        passed in as a single string.
        iRN(RR:RRt_decodeR[R�RTtBOMSR�t
startswithtBOM_SETRyRRR�t
splitlines(RFRRhtencRRtfinal_encodingtnewline((s-/usr/lib/python2.7/site-packages/configobj.pyRisR


			


cCs|jr|jd�S|SdS(s@Decode ASCII strings to unicode if a self.encoding is specified.tasciiN(Rtdecode(RFtaString((s-/usr/lib/python2.7/site-packages/configobj.pyt_a_to_u�s	
cCskt|t�r%|j|�jt�Sx?t|�D]1\}}t|t�s2|j|�||<q2q2W|S(s�
        Decode infile to unicode. Using the specified encoding.
        
        if is a string, it also needs converting to a list.
        (R[R�R*R%Rt	enumeratetunicode(RFRRRQRh((s-/usr/lib/python2.7/site-packages/configobj.pyR!�scCs9|js
|St|t�r5|jr5|j|j�S|S(s'Decode element to unicode if necessary.(RR[tstrR6R*(RFRh((s-/usr/lib/python2.7/site-packages/configobj.pyt_decode_element�s
	cCs!t|t�st|�S|SdS(sh
        Used by ``stringify`` within validate, to turn non-string values
        into strings.
        N(R[R�R/(RFRL((s-/usr/lib/python2.7/site-packages/configobj.pyt_str�s
cCsS|j}|jrt|_ng}t}|}t|�d}d}t}x�||kr�|rjg}n|d7}||}	|	j�}
|
s�|
jd�r�t}|j|	�qOn|s�||_g}t}nt}|j	j
|	�}|dk	r�|j�\}}
}}}|r7|j
dkr7||_
n|
jd�}||jd�krw|jdt||�qOn||jkr�y|j||�j}Wqtk
r�|jdt||�qOqXnM||jkr�|j}n2||jdkr|}n|jdt||�|j|�}||krS|jd	t||�qOnt|||d
|�}|||<||j|<||j|<qOn|jj
|	�}|dkr�|jdt||�qO|j�\}}}|r|j
dkr||_
n|d dkr�y%|j||||�\}}}Wn*tk
rc|jdt||�qOq�X|jr�d}yt|�}Wq�tk
r�}t|�tkr�d}nd}|j|t ||�qOq�Xq�n�|jrHd}yt|�}Wq�tk
rD}t!|t�r"d}nd}|j|t ||�qOq�XnFy|j"|�\}}Wn*tk
r�|jdt||�qOnX|j|�}||kr�|jdt||�qOn|j#||dt�||j|<||j|<qOqOW|j
dkrd|_
n|r4|jr4||_n|sF||_$n||_dS(sActually parse the config file.ii����t#t[t]s,Cannot compute the section depth at line %s.s(Cannot compute nesting level at line %s.sSection too nested at line %s.s"Duplicate section name at line %s.RVsInvalid line at line "%s".is"""s'''s Parse error in value at line %s.Rgs)Unknown name or type in value at line %s.s"Duplicate keyword name at line %s.R7N(s"""s'''(%R0R7RRytstripR#R�RRt_sectionmarkerR|R:tgroupsR5tcountt
_handle_errorRR�t_match_depthRbRjt_unquoteR R�R�R�t_keywordRt
_multilineR�ttypeR*R)R[t
_handle_valueR�R (RFRttemp_list_valuestcomment_listt
done_startRtmaxlinet	cur_indext
reset_commentRhtslinetmattindentt	sect_opent	sect_namet
sect_closetcommentt	cur_depthRbRzRLteRp((s-/usr/lib/python2.7/site-packages/configobj.pyR�s�			


			
	
	

		
	
	




		
		





cCsZx7||jkr9||jkr-t��n|j}qW|j|krM|St��dS(s�
        Given a section and a depth level, walk back through the sections
        parents to see if the depth level matches a previous section.
        
        Return a reference to the right section,
        or raise a SyntaxError.
        N(R�RbRj(RFtsectR�((s-/usr/lib/python2.7/site-packages/configobj.pyR:�s
cCsV||}|d7}||}||||�}|jrB|�n|jj|�dS(s�
        Handle an error according to the error settings.
        
        Either raise the error or store it.
        The error will have occured at ``cur_index``
        iN(R/RR�(RFttextt
ErrorClassRRDRhRlR((s-/usr/lib/python2.7/site-packages/configobj.pyR9�s


		cCsG|st�n|d|dkrC|ddkrC|dd!}n|S(s%Return an unquoted version of a valueii����t"t'i(RRRS(Rj(RFRL((s-/usr/lib/python2.7/site-packages/configobj.pyR;�s
	$c	Cs=|r|jr|dkrdS|r�t|ttf�r�|sDdSt|�dkrq|j|ddt�dSdjg|D]}|j|dt�^q~�St|t�s�|j	r�t
|�}q�td|��n|s�dS|jod	|kod
|k}|o-d|kr$d|kp-d	|k}|o^|o^d|ko^d|ko^d
|k}|sn|or|}|r�|js�t
}qd	|kr�td
|��q|dtkr�|dtkr�d|kr�t
}q|j|�}n|j|�}|t
kr5d
|kr5|jr5|j|�}n||S(s�
        Return a safely quoted version of a value.
        
        Raise a ConfigObjError if the value cannot be safely quoted.
        If multiline is ``True`` (default) then use triple quotes
        if necessary.
        
        * Don't quote values that don't need it.
        * Recursively quote members of a list and return a comma joined list.
        * Multiline is ``False`` for lists.
        * Obey list syntax for empty and single member lists.
        
        If ``list_values=False`` then the value is only quoted if it contains
        a ``\n`` (is multiline) or '#'.
        
        If ``write_empty_values`` is set, and the value is an empty string, it
        won't be quoted.
        Rgt,iit	multilines, sValue "%s" is not a string.s""s
R2RSRRs#Value "%s" cannot be safely quoted.i����(R8R[R�RTRyt_quoteRRxR�R4R/RZR0tnoquotRtwspace_plust_get_single_quotet_get_triple_quote(	RFRLRUR�tno_lists_no_quotestneed_triplethash_triple_quotetcheck_for_singletquot((s-/usr/lib/python2.7/site-packages/configobj.pyRV�sB	&	"*1			!cCsJd|kr+d|kr+td|��nd|kr@t}nt}|S(NRSRRs#Value "%s" cannot be safely quoted.(Rtsquottdquot(RFRLR_((s-/usr/lib/python2.7/site-packages/configobj.pyRYs	cCse|jd�dkr=|jd�dkr=td|��n|jd�dkr[t}nt}|S(Ns"""i����s'''s#Value "%s" cannot be safely quoted.(tfindRttdquotttsquot(RFRLR_((s-/usr/lib/python2.7/site-packages/configobj.pyRZ$s*	c	Cs||jr|dfS|jsP|jj|�}|dkrFt��n|j�S|jj|�}|dkrzt��n|j�\}}}}|dkr�|dkr�t��n|dk	r�g|fS|dk	r|r�|r�d}q|p�d}|j|�}n|dkr"||fS|j	j
|�}g|D]}|j|�^q;}|dk	rr||g7}n||fS(s�
        Given a value string, unquote, remove comment,
        handle lists. (including empty and single member lists)
        Rgs""N(R�R0t_nolistvalueR|R:RjR7t	_valueexpR;t
_listvalueexptfindall(	RFRLRGR0tsinglet
empty_listRLR�R�((s-/usr/lib/python2.7/site-packages/configobj.pyR?.s6	
	


	
"c
Cs<|d }|d}|j|d}|j|d}|j|�}	|	dk	rtt|	j��}
|
j|�|
S|j|�dkr�t��nxZ||kr�|d7}|d7}||}|j|�dkr�||7}q�Pq�Wt��|j|�}	|	dkrt��n|	j�\}}||||fS(s9Extract the value, where we are in a multiline situation.iiii����s
N(t
_triple_quoteR|R:R�R7R�RbRj(
RFRLRRDRCR_tnewvaluetsingle_linet
multi_lineRGtretvalRhRL((s-/usr/lib/python2.7/site-packages/configobj.pyR=_s0






	cCs�t|t�s|y"t|dtdtdt�}Wq|tk
rV}td|��q|tk
rx}td|��q|Xn||_dS(sParse the configspec.R/R2R�sParsing configspec failed: %ssReading configspec failed: %sN(R[R"RRR!RnR3(RFR3RN((s-/usr/lib/python2.7/site-packages/configobj.pyR�s	
cCs|j}|jd�}t|t�rZx0|jD]"}||kr1|||_q1q1Wnx�|jD]�}|dkr|qdn||kr�i||<t||_|r�|jj|g�|j|<|jj|d�|j|<q�nt||t	�rd||||_qdqdWdS(s�
        Called by validate. Handles setting the configspec on subsections
        including sections to be validated by __many__
        t__many__RgN(
R3RR[R�R�RR�R�R�R�(RFRstcopyR3tmanyR((s-/usr/lib/python2.7/site-packages/configobj.pyt_set_configspec�s"	

"cCsq|js$|j|j|��}nt|�}d||j|j|dt��|jd�||j|�fS(s.Write an individual line, for the write methods
%s%s%s%s%sRUs = (R7R0RVR�RR,(RFt
indent_stringRR�RLR�((s-/usr/lib/python2.7/site-packages/configobj.pyt_write_line�s	cCsRd||jd|�|j|j|�dt�|jd|�|j|�fS(sWrite a section marker lines
%s%s%s%s%sR3RUR4(R,RVR0R(RFRtR�RRL((s-/usr/lib/python2.7/site-packages/configobj.pyt
_write_marker�s
cCs@|s
dS|j}|jd�s8||jd�7}n||S(sDeal with a comment.RgR2s # (R5R#R,(RFRLR�((s-/usr/lib/python2.7/site-packages/configobj.pyt_handle_comment�s	cCsV|jd
krt|_ng}|jd�}|jd�}|d
kr�|j}t|_|}x_|jD]Q}|j|�}|j�}|r�|j	|�r�||}n|j
|�qmWn|j|j}	x|j|j
D]}
|
|jkrq�nx^|j|
D]O}|j|j��}|rM|j	|�rM||}n|j
|	|�qW||
}|j|j|
�}
t|t�r�|j
|j|	|j|
|
��|j|jd|��q�|j
|j|	|
||
��q�W||krix\|jD]Q}|j|�}|j�}|rL|j	|�rL||}n|j
|�qW||_n||k	ry|S|jd
kr*|d
kr*|jr�g|D]}|j|j�^q�}n|jr&|jd
ks�tj|jj ��dkr&|s|j
d�nt!|d|d<n|S|j"p9t#j$}t%|dd
�d
k	r�|j&dkr�t'j(d	kr�|d
kr�d}n|j|�j)|�}|jr�|j|j�}n|jr�|jd
ks�t*|j�r�t!|}n|j+|�s
||7}n|d
k	r)|j|�n)t,|jd�}|j|�|j-�d
S(s~
        Write the current ConfigObj as a file
        
        tekNico: FIXME: use StringIO instead of real files
        
        >>> filename = a.filename
        >>> a.filename = 'test.ini'
        >>> a.write()
        >>> a.filename = filename
        >>> a == ConfigObj('test.ini', raise_errors=True)
        1
        >>> import os
        >>> os.remove('test.ini')
        R2s# RsRRgitmodeRtwin32s
s
twbN(.R5R:RR,R.RRR0R5R#R�R�R�R�R�R�tlstripRwR�R[R�RvtextendRRuR RRtencodeRRRRRRRtlinesepRDRxtsystplatformRxRRRR(RFtoutfileRsR�tcstcsptint_valRht
stripped_lineRtRtcomment_lineR�RLtlR(toutputR((s-/usr/lib/python2.7/site-packages/configobj.pyR�s�		




	('		'


cs��dkr��jdkr*td��n�rLddlm}|�_n���r��jj�_�jj�_�jj�_�jj	�_	�jj
�_
�jj�_q�n�j��j����������fd�}i�t
}t
}g�jD]}	|	�kr|	^q}
g�jD]}	|	�jkr6|	^q6}g�jD]}	|	�jkra|	^qa}x��jD]�}
|
dkr�q�n|
�jks�|
�jkr!t
}d}�r1|
�jkr1�jj|
g��j|
<�jj|
d��j|
<q1nt}�|
}||
�|
||||�\}}q�Wd}d�jkr|�d}nd�jkr��d}n|dk	r�x9|
D]1}
�|
}||
||t||�\}}q�Wg}
nxJ|D]B}
t}�st�|
<q�t}d|
}�j|��|
<q�WxJ|D]B}
t}�s\t�|
<q=t}d	|
}�j|��|
<q=Wx��jD]�}
��kr�|
d
kr�q�n�|
jdkr�|
j|
�q�n�r�jj|
g��j|
<�jj|
d��j|
<n�j�d�d�d
�|
�}|�|
<|tkr\t}q�|t
krqt}q�t}q�W|
�_�r��jr�t}n|r��r��r�t�j��}n|r�t
S|r�tS�S(s;
        Test the ConfigObj against a configspec.
        
        It uses the ``validator`` object from *validate.py*.
        
        To run ``validate`` on the current ConfigObj, call: ::
        
            test = config.validate(validator)
        
        (Normally having previously passed in the configspec when the ConfigObj
        was created - you can dynamically assign a dictionary of checks to the
        ``configspec`` attribute of a section though).
        
        It returns ``True`` if everything passes, or a dictionary of
        pass/fails (True/False). If every member of a subsection passes, it
        will just have the value ``True``. (It also returns ``False`` if all
        members fail).
        
        In addition, it converts the values from strings to their native
        types if their checks pass (and ``stringify`` is set).
        
        If ``preserve_errors`` is ``True`` (``False`` is default) then instead
        of a marking a fail with a ``False``, it will preserve the actual
        exception object. This can contain info about the reason for failure.
        For example the ``VdtValueTooSmallError`` indicates that the value
        supplied was too small. If a value (or section) is missing it will
        still be marked as ``False``.
        
        You must have the validate module to use ``preserve_errors=True``.
        
        You can then use the ``flatten_errors`` function to turn your nested
        results dictionary into a flattened list of failures - useful for
        displaying meaningful error messages.
        sNo configspec supplied.i����(tVdtMissingValuec	s��jj|d�y�j�|��j|<Wntt�jfk
rPnXy�j||d|�}WnR�jk
r�}�s�t|�j	�r�t
�|<n|�|<t
}t
}n�Xt
}t�|<�js�|rs�jsQt|t
tf�r$g|D]}�j|�^q}qQ|r?|dkr?d}qQ�j|�}n||ksc|rs|�|<qsn�r�|r�|�jkr��jj|�n||fS(NtmissingRg(R�R�R:tget_default_valueR�R�tbaseErrorClasstcheckR[t_vdtMissingValueRRR4R�RTR1R�R�(	RtspecR�R�tret_truet	ret_falseR�RNtitem(R3RqR�tpreserve_errorsRsRFt	validator(s-/usr/lib/python2.7/site-packages/configobj.pytvalidate_entry�s:	




	%	Rpt
___many___Rgs"Value %r was provided as a sections)Section %r was provided as a single valueR�R�RqRsN(s__many__R�(R:R3R�tvalidateR�R�RR RRRR5RsRR�R�R�R�RR�RR�R�R�R�RR�(RFR�R�RqRsR�R�R�R�R}tunvalidatedtincorrect_sectionstincorrect_scalarsRR�R�RrRpR�((R3RqR�R�RsRFR�s-/usr/lib/python2.7/site-packages/configobj.pyR�Ds�$	!-(++"




	






%
		
		cCs*|j�|j�d|_d|_dS(s@Clear ConfigObj instance and restore to 'freshly created' state.N(R�R�R:R3R�(RF((s-/usr/lib/python2.7/site-packages/configobj.pytreset	s

	cCs�t|jt�st��n|j}i}x3tD]+}|dkrLq4nt||�||<q4W|j}||d<|j�|j|�|j	||�dS(s�
        Reload a ConfigObj from file.
        
        This method raises a ``ReloadError`` if the ConfigObj doesn't have
        a filename attribute pointing to a file.
        R3N(
R[RR�R(R�RDR�R�R�R(RFRtcurrent_optionsRR3((s-/usr/lib/python2.7/site-packages/configobj.pytreload	s	
	


N(/R@RARmR�R�R�R<R6RfRgRet_single_line_singlet_single_line_doublet_multi_line_singlet_multi_line_doubleRkRRR�R:RkRR�R�RR,R!R0R1RR:R9R;RVRYRZR?R=RRsRuRvRwRR�R�R�(((s-/usr/lib/python2.7/site-packages/configobj.pyR"<sx


			6	a 		e						�			
E	
	
	1	#						n�	cBs#eZdZd�Zed�ZRS(s�
    A simple validator.
    Can be used to check that all members expected are present.
    
    To use it, provide a configspec with all your members in (the value given
    will be ignored). Pass an instance of ``SimpleVal`` to the ``validate``
    method of your ``ConfigObj``. ``validate`` will return ``True`` if all
    members are present, or a dictionary with True/False meaning
    present/missing. (Whole missing sections will be replaced with ``False``)
    cCs
t|_dS(N(RR�(RF((s-/usr/lib/python2.7/site-packages/configobj.pyRkD	scCs|r|j��n|S(s9A dummy check method, always returns the value unchanged.(R�(RFR�tmemberR�((s-/usr/lib/python2.7/site-packages/configobj.pyR�G	s(R@RARmRkRR�(((s-/usr/lib/python2.7/site-packages/configobj.pyR#8	s
	cCs|dkrg}g}n|tkr+|S|tksFt|t�rt|j|d|f�|rp|j�n|Sx�|j�D]w\}}|tkr�q�nt|j|�t	�r�|j|�t
|||||�q�n|j|||f�q�W|r|j�n|S(s�
    An example function that will turn a nested dictionary of results
    (as returned by ``ConfigObj.validate``) into a flat list.
    
    ``cfg`` is the ConfigObj instance being checked, ``res`` is the results
    dictionary returned by ``validate``.
    
    (This is a recursive function, so you shouldn't use the ``levels`` or
    ``results`` arguments - they are used by the function.)
    
    Returns a list of keys that failed. Each member of the list is a tuple::
    
        ([list of sections...], key, result)
    
    If ``validate`` was called with ``preserve_errors=False`` (the default)
    then ``result`` will always be ``False``.

    *list of sections* is a flattened list of sections that the key was found
    in.
    
    If the section was missing (or a section was expected and a scalar provided
    - or vice-versa) then key will be ``None``.
    
    If the value (or section) was missing then ``result`` will be ``False``.
    
    If ``validate`` was called with ``preserve_errors=True`` and a value
    was present, but failed the check, then ``result`` will be the exception
    object returned. You can use this as a string that describes the failure.
    
    For example *The value "3" is of the wrong type*.
    N(R:RRR[R�R�R�R�RR�R+(tcfgtrestlevelstresultsRzR�((s-/usr/lib/python2.7/site-packages/configobj.pyR+N	s* 	


cCszg}|jg|jD]}||f^q�xD|jD]9}||jkr9|jt||||f��q9q9W|S(s�
    Find all the values and sections not in the configspec from a validated
    ConfigObj.
    
    ``get_extra_values`` returns a list of tuples where each tuple represents
    either an extra section, or an extra value.
    
    The tuples contain two values, a tuple representing the section the value 
    is in and the name of the extra values. For extra values in the top level
    section the first member will be an empty tuple. For values in the 'foo'
    section the first member will be ``('foo',)``. For members in the 'bar'
    subsection of the 'foo' section the first member will be ``('foo', 'bar')``.
    
    NOTE: If you call ``get_extra_values`` on a ConfigObj instance that hasn't
    been validated it will return an empty list.
    (R|R�R�R,(tconft_prependR�RV((s-/usr/lib/python2.7/site-packages/configobj.pyR,�	s)((@t
__future__RRR�RtcodecsRRRRR:R9R"RR$RR`RaRWRXRdRctobjectR�RRt	NameErrort__all__RRtMAX_INTERPOL_DEPTHRRR�R?R�R*RBRfR7RjRRRRnR(R R!R$R%R'R&R)RqR�R�R�R�R�R�R"R#R+R,(((s-/usr/lib/python2.7/site-packages/configobj.pyt<module>s�"




		

	
		8				|
	��g�����<

Zerion Mini Shell 1.0