-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/bzrlib/util/configobj/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyc


Nc@@s{ddlmZddlZddlZddlZeZy&ddlmZm	Z	m
Z
mZWnAek
rdZdZdZ
ej
dkreZ	ne
Z	nXidefe6d	d
fe
6dd
fe6d
d
fe	6Zid
d
6d
d6d
d
6d
d6d	d	6d	d6d	d6dd6dd6dd6dd6dd6dd6dd6dd6Zied6e	d
6e
d	6ed6ee6ZdZdZdZdZdZdZdZyeWnek
rdZnXeZdZd Zd!Zd"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4fZd5Z d6Z!d7Z"ie#d86e$d96e#d:6e$d;6e$d<6ed=6e#d>6ed?6ed@6edA6e$dB6e$dC6Z%dDZ&d2e'fdEYZ(dFefdGYZ)e)Z*dHZ+d%e,fdIYZ-d&e-fdJYZ.d'e-fdKYZ/d0e0fdLYZ1d(e-fdMYZ2d)e-fdNYZ3d,e-fdOYZ4d-e4fdPYZ5d/e-fdQYZ6d.e4fdRYZ7d1e-fdSYZ8dTefdUYZ9dVe9fdWYZ:dXe9fdYYZ;ie:d56e;dZ6Z<d[Z=d\e>fd]YZ?d*e?fd^YZ@d+efd_YZAeed`ZBdS(ai(tabsolute_importN(tBOM_UTF8t	BOM_UTF16tBOM_UTF16_BEtBOM_UTF16_LEssstlittletutf_8tutf16_betutf_16tutf16_letu16tutf16sutf-16t	utf_16_besutf-16bet	utf_16_lesutf-16letu8tutftutf8sutf-8cC@stj|jdkS(NR(tBOM_LISTtgettlower(tencoding((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt
match_utf8_ss'%s's"%s"s%ss 
	'"s"""%s"""s'''%s'''cc@s0d}x#|D]}|d7}||fVq
WdS(senumerate for Python 2.2.iiN((tobjtititem((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt	enumeratens

s4.6.0s5$Id: configobj.py 156 2006-01-31 14:57:08Z fuzzyman $srestructuredtext ent__version__tDEFAULT_INDENT_TYPEtDEFAULT_INTERPOLATIONtConfigObjErrortNestingErrort
ParseErrortDuplicateErrortConfigspecErrort	ConfigObjt	SimpleValtInterpolationErrortInterpolationLoopErrortMissingInterpolationOptiontRepeatSectionErrortReloadErrortUnreprErrortUnknownTypet
__docformat__tflatten_errorstconfigparsers    i
t
interpolationtraise_errorstlist_valuestcreate_emptyt
file_errort
configspect	stringifytindent_typeRtdefault_encodingtunreprtwrite_empty_valuescC@sVd|}tdkr%tdntj|}|jdjdjdS(Nsa=scompiler module not availableii(tcompilertNonetImportErrortparsetgetChildren(tstp((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytgetObjs

cB@seZRS((t__name__t
__module__(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR*stBuildercB@sbeZdZdZdZdZdZdZdZdZ	dZ
d	ZRS(
cC@sGt|d|jjd}|dkr=t|jjn||S(Ntbuild_(tgetattrt	__class__RAR:R*(tselftotm((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytbuildscC@st|j|jS(N(tmapRJR=(RGRH((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt
build_ListscC@s|jS(N(tvalue(RGRH((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytbuild_ConstscC@sIi}tt|j|j}x|D]}|j||<q+W|S(N(titerRKRJR=tnext(RGRHtdRtel((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt
build_Dicts

cC@st|j|S(N(ttupleRL(RGRH((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytbuild_TuplescC@sI|jdkrdS|jdkr&tS|jdkr9tStddS(NR:tTruetFalsesUndefined Name(tnameR:RVRWR*(RGRH((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt
build_NamescC@st|j|j\}}yt|}Wntk
rMtdnXt|tsm|jdkr|tdn||S(NtAddg(	RKRNR=tfloatt	TypeErrorR*t
isinstancetcomplextreal(RGRHR_timag((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt	build_Adds
cC@s"|j|j}t||jS(N(RJtexprREtattrname(RGRHtparent((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt
build_GetattrscC@s|j|jdS(Ni(RNR=(RGRH((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytbuild_UnarySubscC@s|j|jdS(Ni(RNR=(RGRH((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytbuild_UnaryAdds(RARBRJRLRNRSRURYRaReRfRg(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRCs							
		cC@s|s
|Stjt|S(N(t_builderRJR@(R>((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR7scB@s eZdZddddZRS(sk
    This is the base class for all errors that ConfigObj raises.
    It is a subclass of SyntaxError.
    tcC@s&||_||_tj||dS(N(tlinetline_numbertSyntaxErrort__init__(RGtmessageRkRj((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRms		N(RARBt__doc__R:Rm(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRscB@seZdZRS(sE
    This error indicates a level of nesting that doesn't match.
    (RARBRo(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRscB@seZdZRS(s
    This error indicates that a line is badly written.
    It is neither a valid ``key = value`` line,
    nor a valid section marker line.
    (RARBRo(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR	scB@seZdZdZRS(sW
    A 'reload' operation failed.
    This exception is a subclass of ``IOError``.
    cC@stj|ddS(Ns#reload failed, filename is not set.(tIOErrorRm(RG((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRms(RARBRoRm(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR(scB@seZdZRS(s:
    The keyword or section specified already exists.
    (RARBRo(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR scB@seZdZRS(s7
    An error occured whilst parsing a configspec.
    (RARBRo(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR! scB@seZdZRS(s,Base class for the two interpolation errors.(RARBRo(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR$&scB@seZdZdZRS(s=Maximum interpolation depth exceeded in string interpolation.cC@stj|d|dS(Ns*interpolation loop detected in value "%s".(R$Rm(RGtoption((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRm-s(RARBRoRm(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR%*scB@seZdZRS(sk
    This error indicates additional sections in a section with a
    ``__many__`` (repeated) section.
    (RARBRo(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR'3scB@seZdZdZRS(s0A value specified for interpolation was missing.cC@stj|d|dS(Ns%missing option "%s" in interpolation.(R$Rm(RGRq((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRm=s(RARBRoRm(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR&:scB@seZdZRS(s An error parsing in unrepr mode.(RARBRo(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR)CstInterpolationEnginecB@sAeZdZejdZdZdZdZdZ	RS(s
    A helper class to help perform string interpolation.

    This class is an abstract base class; its descendants perform
    the actual work.
    s
%\(([^)]*)\)scC@s
||_dS(N(tsection(RGRs((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRmSsc@s.fd||ji}|S(Nc@s||jf|kr$t|nd|||jf<jj|}x|rj|\}}}|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.
            iRiN(	RXR%t_KEYCREtsearcht_parse_matchR:tspantjointlen(tkeyRMRst	backtrailtmatchtktvR>treplacementtstarttendtnew_search_start(trecursive_interpolateRG(sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRYs		 (Rs(RGRzRM((RRGsC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytinterpolateXs,cC@s|jjj}t|jj_|j}xptr|j|}|dk	rOPn|jdij|}|dk	rzPn|j|krPn|j}q*W||jj_|dkrt|n||fS(sHelper function to fetch values from owning section.

        Returns a 2-tuple: the value, and the section where it was found.
        tDEFAULTN(	RstmainR.RWRVRR:RdR&(RGRztsave_interptcurrent_sectiontval((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt_fetchs"		
cC@s
tdS(sImplementation-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(RGR|((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRvs(
RARBRotretcompileRtRmRRRv(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRrHs		1	"tConfigParserInterpolationcB@s&eZdZejdZdZRS(sBehaves like ConfigParser.s
%\(([^)]*)\)scC@s1|jd}|j|\}}|||fS(Ni(tgroupR(RGR|RzRMRs((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRvs(RARBRoRRRtRv(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRstTemplateInterpolationcB@s9eZdZdZejdejejBZdZ	RS(sBehaves like string.Template.t$s
        \$(?:
          (?P<escaped>\$)              |   # Two $ signs
          (?P<named>[_a-z][_a-z0-9]*)  |   # $name format
          {(?P<braced>[^}]*)}              # ${name} format
        )
        cC@s|jdp|jd}|dk	rL|j|\}}|||fS|jddk	rqd|jdfSd|jdfS(Ntnamedtbracedtescaped(RR:Rt
_delimiter(RGR|RzRMRs((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRvs
(
RARBRoRRRt
IGNORECASEtVERBOSERtRv(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRs
ttemplatecG@s|j||S(N(t__new__(tclstargs((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt
__newobj__stSectioncB@sOeZdZdZdZd!d!dZdZdZdZ	e
dZdZd!d	Z
d
ZdZdZd
Zd!dZdZdZdZdZdZeZdZdZeZde_dZdZdZee
dZ dZ!dZ"dZ#dZ$dZ%d Z&RS("sq
    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.
    cC@s,tj||d|jj|ddS(Nii(tdicttupdatet__dict__(RGtstate((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt__setstate__scC@s(t||jf}t|jf|fS(N(RRRRF(RGR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt
__reduce__scC@s{|dkri}ntj|||_||_||_||_|jx$|jD]\}}|||<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:RRmRdRtdepthRXt_initialiset	iteritems(RGRdRRtindictRXtentryRM((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRm	s	
				
cC@sCg|_g|_i|_i|_d|_g|_i|_dS(N(tscalarstsectionstcommentstinline_commentsR:R3tdefaultstdefault_values(RG((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR#s						cC@sy
|j}Wntk
r|jj}|tkr>t}n|j}tj|d}|dkrxt
|j_|S||}|_nX|j||S(N(t_interpolation_enginetAttributeErrorRR.RVRRtinterpolation_enginesRR:RWR(RGRzRMtengineRXtclass_((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt_interpolate2s

	cC@sAtj||}|jjr=t|tr=|j||S|S(s+Fetch the item and do string interpolation.(Rt__getitem__RR.R]t
basestringR(RGRzR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRIscC@st|ts"td|n||jkrNg|j|<d|j|<n||jkrp|jj|nt|tr||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
jst|trdqt|ttfrxC|D](}t|tstd|qqWqtd|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.RiiRRXsValue is not a string "%s".N(R]Rt
ValueErrorRRRtremoveRRtappendRt__setitem__RRRR4tlistRTR\(RGRzRMR7t	new_depthR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRQsF

	

cC@sZtj||||jkr2|jj|n|jj||j|=|j|=dS(s-Remove items from the sequence when deleting.N(Rt__delitem__RRRRR(RGRz((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRs
cC@s%y||SWntk
r |SXdS(s>A version of ``get`` that doesn't bypass string interpolation.N(tKeyError(RGRztdefault((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRs
cC@s#x|D]}||||<qWdS(sD
        A version of update that uses our ``__setitem__``.
        N((RGRR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRs
cG@stj|||}||jkrK|j|=|j|=|jj|n6||jkr|j|=|j|=|jj|n|jjrt	|t
r|j||S|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'
        (RtpopRRRRRRR.R]RR(RGRzRR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRs



cC@sJ|j|j}|s%tdn|d}||}||=||fS(sPops the first (key,val)s": 'popitem(): dictionary is empty'i(RRR(RGtsequenceRzR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytpopitems

cC@s>tj|g|_g|_i|_i|_d|_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(RtclearRRRRR:R3(RG((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRs
				cC@s3y||SWn tk
r.|||<||SXdS(s:A version of setdefault that sets sequence if appropriate.N(R(RGRzR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt
setdefaults


cC@st|j|j|jS(s8D.items() -> list of D's (key, value) pairs, as 2-tuples(tzipRRtvalues(RG((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytitemsscC@s|j|jS(sD.keys() -> list of D's keys(RR(RG((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytkeysscC@s%g|j|jD]}||^qS(s D.values() -> list of D's values(RR(RGRz((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRscC@st|jS(s=D.iteritems() -> an iterator over the (key, value) items of D(ROR(RG((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRscC@st|j|jS(s.D.iterkeys() -> an iterator over the keys of D(RORR(RG((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytiterkeysscC@st|jS(s2D.itervalues() -> an iterator over the values of D(ROR(RG((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt
itervaluessc	C@sHddjg|j|jD]&}dt|t||f^qS(sx.__repr__() <==> repr(x)s{%s}s, s%s: %s(RxRRtrepr(RGRz((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt__repr__ssx.__str__() <==> str(x)cC@si}x||D]t}||}t|tr;|j}n<t|trYt|}nt|trwt|}n|||<q
W|S(s 
        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]RRRRT(RGtnewdictRt
this_entry((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR	s


cC@smxf|jD]X\}}||kr[t||tr[t|tr[||j|q
|||<q
WdS(sI
        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(RR]Rtmerge(RGRRzR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR%s
cC@s||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(RRRtindexRRRRtinsertRR(RGtoldkeytnewkeytthe_listtposRtcommtinline_comment((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytrename@s"	






c	K@sOi}xtt|jD]w}|j|}y-||||}|j|}|||<Wqtk
r|rxq|j|}t||<qXqWxtt|jD]}|j|}|r!y||||Wn4tk
r|rq|j|}t||<nX|j|}n||j|d|d||||<qW|S(sX
        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(trangeRyRt	ExceptionRWRtwalk(	RGtfunctionR/RtkeywargstoutRRR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR^s:/







cC@s||}|tkrtS|tkr*tSy3t|tsHtn|jj|jSWn!tk
rtd|nXdS(s5
        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(	RVRWR]RRRt_boolsRR(RGRzR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytas_bools

cC@st||S(sY
        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(RGRz((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytas_intscC@st||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
        (R[(RGRz((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytas_floatscC@s0||}t|ttfr)t|S|gS(sM
        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(RGRztresult((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytas_lists

cC@sF|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.
        (RRRRR(RGRzR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytrestore_default"s
	
cC@sGx|jD]}|j|q
Wx|jD]}||jq+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(RRRtrestore_defaults(RGRzRs((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR2s
N('RARBRoRRR:RmRRRRWRRRRRRRRRRRRRt__iter__RRt__str__RRRRVRRRRRRR(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRsH					;																	T	,				cB@s"eZdZejdejZejdejZejdejZejdejZ	ejdejZ
ejdZejdZejdZ
ejd	Ziee
fd
6eefd6Zied6ed
6ed6ed6ed6ed6ed6ed6Zd/d/edZdZd/dZdZdZdZdZdZdZdZdZdZd 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"""tyestnotontofft1t0ttruetfalsecK@s||_tj||d||p(g}t|p7i}|j||r]t|d<ntj}x-|D]%}||krptd|qpqpW|j||j	||d}||_
|j||dS(s
        Parse a config file or create a config file object.

        ``ConfigObj(infile=None, options=None, **kwargs)``
        iR0sUnrecognised option "%s".R3N(t_inspecRRmRRRWtOPTION_DEFAULTStcopyR\Rt_original_configspect_load(RGtinfiletoptionsRtkwargsRRR3((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRms 	





	c
C@st|tr||_tjj|rXt|d}|jpHg}|jq|j	rwt
d|jq|jrt|d}|jd|jng}nt|t
tfrt
|}nt|trQt|tr|j}nx|D]}||||<q
W|`|dk	rD|j|n	d|_dSt|dttk	r~|jpxg}ntd|r |j|}xY|D]Q}|s|ddkrqnx*dD]"}|j|r||_PqqWPqWg|D]}|jd
^q}n|j||jrd|jdj}t|jd
krxd|}t|}	n
|jd}	|j|	_ ||	_!|	n|`|dkrd|_n
|j|dS(NtrbsConfig file not found: "%s".twRitreads>infile must be a filename, file like object, or list of lines.is
s
s
sat line %s.iis2Parsing failed with several errors.
First error %s(s
s
s
(s
s
s
("R]RtfilenametostpathtisfiletopenRtcloseR2RpR1twriteRRTRR"t_errorsR:t_handle_configspecR3REtMISSINGR\t_handle_bomtendswithtnewlinestrstript_parseRkRyRterrorstconfig(
RGRR3thRRjRtinfotmsgterror((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRsj	
		

	
	

	%
	

		cC@s	|dkrt}nd|_g|_|d|_|d|_|d|_|d|_|d|_|d|_	|d|_
|d|_|d	|_t
|_d|_|d
|_|d|_g|_g|_d|_|jrt
|_ntj|dS(NR/R.R0R1R2R4R5RR6R8R7(R:RRRR/R.R0R1R2R4R5RR6RWtBOMR
R8R7tinitial_commentt
final_commentR3RRR(RGR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR$s.			








		

				c	C@sHddjg|j|jD]&}dt|t||f^qS(NsConfigObj({%s})s, s%s: %s(RxRRR(RGRz((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRDs	cC@sI|jdk	r7|jjtkr7|j||jSt|ttfrY|d}n|}|jdk	rnt|jj}|dkrxKtj	D]=\}\}}|sqn|j
|r|j||SqW|j||jSt|}|j
|s|j||jS|t|}t|ttfrL||d<n|}t
|_|j||jSxtj	D]\}\}}|j
|sq{q{||_|st
|_|t|}t|ttfr||d<n|}t|tr|jt
S|Sn|j||Sq{Wt|trE|jt
S|S(s
        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]RRTtBOMSRt
startswithtBOM_SETRyRVRRt
splitlines(RGRRjtencRRtfinal_encodingtnewline((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRJsR


			


cC@s|jr|jdS|SdS(s@Decode ASCII strings to unicode if a self.encoding is specified.tasciiN(Rtdecode(RGtaString((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt_a_to_us	
cC@skt|tr%|j|jtSx?t|D]1\}}t|ts2|j|||<q2q2W|S(s
        Decode infile to unicode. Using the specified encoding.

        if is a string, it also needs converting to a list.
        (R]RRRRVRtunicode(RGRRRRj((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRscC@s9|js
|St|tr5|jr5|j|jS|S(s'Decode element to unicode if necessary.(RR]tstrR6R(RGRj((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt_decode_elements
	cC@s!t|tst|S|SdS(sh
        Used by ``stringify`` within validate, to turn non-string values
        into strings.
        N(R]RR#(RGRM((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt_strs
cC@sS|j}|jrt|_ng}t}|}t|d}d}t}x||kr|rjg}n|d7}||}	|	j}
|
s|
jdrt}|j|	qOn|s||_g}t}nt}|j	j
|	}|dk	r|j\}}
}}}|r7|j
dkr7||_
n|
jd}||jdkrw|jdt||qOn||jkry|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 dkry%|j||||\}}}Wn*tk
rc|jdt||qOqX|jrd}yt|}Wqtk
r}t|tkrd}nd}|j|t ||qOqXqn|jrHd}yt|}Wqtk
rD}t!|tr"d}nd}|j|t ||qOqXnFy|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.iit#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.RXsInvalid line at line "%s".is"""s'''s Parse error in value at line %s.Ris)Unknown name or type in value at line %s.s"Duplicate keyword name at line %s.R7N(s"""s'''(%R0R7RWRytstripRRRRVt_sectionmarkerR|R:tgroupsR5tcountt
_handle_errorRRt_match_depthRdRlt_unquoteR RRRt_keywordRt
_multilineRttypeR*R)R]t
_handle_valueRR(RGRttemp_list_valuestcomment_listt
done_starttthis_sectiontmaxlinet	cur_indext
reset_commentRjtslinetmattindentt	sect_opent	sect_namet
sect_closetcommentt	cur_depthRdRzRMteR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRs			


			
	
	

		
	
	




		
		





cC@sZx7||jkr9||jkr-tn|j}qW|j|krM|StdS(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(RRdRl(RGtsectR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR.s
cC@sV||}|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(RGttextt
ErrorClassRR9RjRnR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR-s


		cC@s8|d|dkr4|ddkr4|dd!}n|S(s%Return an unquoted version of a valueiit"t'i(RGRH((RGRM((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR/s$c	C@s=|r|jr|dkrdS|rt|ttfr|sDdSt|dkrq|j|ddtdSdjg|D]}|j|dt^q~St|ts|j	rt
|}qtd|n|sdS|jod	|kod
|k}|o-d|kr$d|kp-d	|k}|o^|o^d|ko^d|ko^d
|k}|sn|or|}|r|jst
}qd	|krtd
|q|dtkr|dtkrd|krt
}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.
        Rit,iit	multilines, sValue "%s" is not a string.s""s
R&RHRGs#Value "%s" cannot be safely quoted.i(R8R]RRTRyt_quoteRWRxRR4R#R\R0tnoquotRtwspace_plust_get_single_quotet_get_triple_quote(	RGRMRJRtno_lists_no_quotestneed_triplethash_triple_quotetcheck_for_singletquot((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRKsB	&	"*1			!cC@sJd|kr+d|kr+td|nd|kr@t}nt}|S(NRHRGs#Value "%s" cannot be safely quoted.(Rtsquottdquot(RGRMRT((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRNs	cC@se|jddkr=|jddkr=td|n|jddkr[t}nt}|S(Ns"""is'''s#Value "%s" cannot be safely quoted.(tfindRttsquotttdquot(RGRMRT((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyROs*	c	C@s||jr|dfS|jsP|jj|}|dkrFtn|jS|jj|}|dkrztn|j\}}}}|dkr|dkrtn|dk	rg|fS|dk	r|r|rd}q|pd}|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)
        Ris""N(RR0t_nolistvalueR|R:RlR+t	_valueexpR/t
_listvalueexptfindall(	RGRMR<R0tsinglet
empty_listRARR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR3s6	
	


	
"c
C@s<|d }|d}|j|d}|j|d}|j|}	|	dk	rtt|	j}
|
j||
S|j|dkrtnxZ||kr|d7}|d7}||}|j|dkr||7}qPqWt|j|}	|	dkrtn|	j\}}||||fS(s9Extract the value, where we are in a multiline situation.iiiis
N(t
_triple_quoteR|R:RR+RRWRl(
RGRMRR9R8RTtnewvaluetsingle_linet
multi_lineR<tretvalRjRA((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR1?s0






	cC@st|ts|y"t|dtdtdt}Wq|tk
rV}td|q|tk
rx}td|q|Xn||_dS(sParse the configspec.R/R2RsParsing configspec failed: %ssReading configspec failed: %sN(R]R"RVRR!RpR3(RGR3RC((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRbs	
cC@s|j}|jd}t|trZx0|jD]"}||kr1|||_q1q1Wnx|jD]}|dkr|qdn||kri||<|r|jj|g|j|<|jj|d|j|<qnt||trd||||_qdqdWdS(s
        Called by validate. Handles setting the configspec on subsections
        including sections to be validated by __many__
        t__many__RiN(R3RR]RRRRR(RGRsRR3tmanyR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt_set_configspecws 	
"cC@sq|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%sRJs = (R7R$RKRRWR!(RGt
indent_stringRRRAR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt_write_lines	cC@sRd||jd||j|j|dt|jd||j|fS(sWrite a section marker lines
%s%s%s%s%sR'RJR((R!RKR$RW(RGRhRRRA((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt
_write_markers
cC@s@|s
dS|j}|jds8||jd7}n||S(sDeal with a comment.RiR&s # (R5RR!(RGRAR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt_handle_comments	cC@s|jdkrt|_ng}|jd}|jd}|dkr|j}t|_|}x_|jD]Q}|j|}|j}|r|j	|r||}n|j
|qmWn|j|j}	x|j|j
D]}
|
|jkrqnx^|j|
D]O}|j|j}|rM|j	|rM||}n|j
|	|qW||
}|j|j|
}
t|tr|j
|j|	|j|
|
|j|jd|q|j
|j|	|
||
qW||krix\|jD]Q}|j|}|j}|rL|j	|rL||}n|j
|qW||_n||k	ry|S|jdkr*|dkr*|jrg|D]}|j|j^q}n|jr&|jdkstj|jj dkr&|s|j
dnt!|d|d<n|S|j"p9t#j$}|j|j%|}|jrr|j|j}n|jr|jdkst&|jrt!|}n|j'|s||7}n|dk	r|j|n)t(|jd}|j||j)dS(	s6
        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
        R&s# RsRRiitwbN(*R5R:RR!R.RWRR$R)RRRRRRRtlstripRkRR]RRjtextendRRiRRRtencodeRRRRRR
RtlinesepRxRR	RR(RGtoutfileRsRtcstcsptint_valRjt
stripped_lineRhRtcomment_lineRRAtlRtoutputR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRs
		




	(	'


c
@sdkrjdkr*tdnrLddlm}|_nrjj_jj_jj_jj	_	jj
_
jj_qnjjfd}it
}t
}gjD]}	|	kr|	^q}
gjD]}	|	jkr6|	^q6}gjD]}	|	jkra|	^qa}xjD]}
|
dkrqn|
jks|
jkr!t
}d}r1|
jkr1jj|
gj|
<jj|
dj|
<q1nt}|
}||
|
||||\}}qWd}djkr|d}ndjkrd}n|dk	rx<|
D]1}
|
}||
||t||\}}qWnxJ|D]B}
t}s	t|
<qt}d|
}j||
<qWxJ|D]B}
t}sVt|
<q7t}d	|
}j||
<q7WxjD]}
kr|
d
krqn|
jdkrqnrjj|
gj|
<jj|
dj|
<njddd
|
}||
<|tkrIt}q|t
kr^t}qt}t}qW|rxt
S|rtSS(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	@syj||d|}WnRjk
rp}sJt|jrWt|<n||<t}t}nfXyjj|dWn3tk
ryj|=Wqt	k
rqXnXyj
|j|<Wnt	tfk
rnXt}t|<js|rjst|t
tfrXg|D]}j|^q:}q|rs|dkrsd}qj|}n||ks|r||<qnr|r|jkrjj|n||fS(NtmissingRi(tchecktbaseErrorClassR]t_vdtMissingValueRWRRR:RRtget_default_valueRVR4RRTR%RR(	RtspecRRztret_truet	ret_falseR{RCR(R3RRtpreserve_errorsRsRGt	validator(sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytvalidate_entryXsF	






	%	Ret
___many___Ris"Value %r was provided as a sections)Section %r was provided as a single valueRRRRsN(s__many__R(R:R3RtvalidateRyR}RRRRR
R5RgRVRRRRRRRWR|(RGRRRRsRyRRRR}tunvalidatedtincorrect_sectionstincorrect_scalarsRRzRRfRR{((R3RRRRsRGRsC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRs$	!3(++"










%
		
cC@s*|j|jd|_d|_dS(s@Clear ConfigObj instance and restore to 'freshly created' state.N(RRR:R3R(RG((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytresets

	cC@st|jtstn|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]RRR(RRERRRR(RGRtcurrent_optionsRR3((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pytreloads	
	


N(/RARBRoRRRR0R*R[R\RZt_single_line_singlet_single_line_doublet_multi_line_singlet_multi_line_doubleR`RVRWRR:RmRRRRR!RR$R%RR.R-R/RKRNROR3R1RRgRiRjRkRRRR(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR"Csp


 	Z 		e									E	
		1	#						h	cB@s#eZdZdZedZRS(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``)
    cC@s
t|_dS(N(RR|(RG((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyRm	scC@s|r|jn|S(s9A dummy check method, always returns the value unchanged.(R|(RGR{tmemberRz((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR{	s(RARBRoRmRWR{(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR#		s
	cC@s|dkrg}g}n|tkr+|S|tksFt|trt|j|d|f|rp|jn|Sx|jD]w\}}|tkrqnt|j|t	r|j|t
|||||qn|j|||fqW|r|jn|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*.

    >>> import validate
    >>> vtor = validate.Validator()
    >>> my_ini = '''
    ...     option1 = True
    ...     [section1]
    ...     option1 = True
    ...     [section2]
    ...     another_option = Probably
    ...     [section3]
    ...     another_option = True
    ...     [[section3b]]
    ...     value = 3
    ...     value2 = a
    ...     value3 = 11
    ...     '''
    >>> my_cfg = '''
    ...     option1 = boolean()
    ...     option2 = boolean()
    ...     option3 = boolean(default=Bad_value)
    ...     [section1]
    ...     option1 = boolean()
    ...     option2 = boolean()
    ...     option3 = boolean(default=Bad_value)
    ...     [section2]
    ...     another_option = boolean()
    ...     [section3]
    ...     another_option = boolean()
    ...     [[section3b]]
    ...     value = integer
    ...     value2 = integer
    ...     value3 = integer(0, 10)
    ...         [[[section3b-sub]]]
    ...         value = string
    ...     [section4]
    ...     another_option = boolean()
    ...     '''
    >>> cs = my_cfg.split('\n')
    >>> ini = my_ini.split('\n')
    >>> cfg = ConfigObj(ini, configspec=cs)
    >>> res = cfg.validate(vtor, preserve_errors=True)
    >>> errors = []
    >>> for entry in flatten_errors(cfg, res):
    ...     section_list, key, error = entry
    ...     section_list.insert(0, '[root]')
    ...     if key is not None:
    ...        section_list.append(key)
    ...     else:
    ...         section_list.append('[missing]')
    ...     section_string = ', '.join(section_list)
    ...     errors.append((section_string, ' = ', error))
    >>> errors.sort()
    >>> for entry in errors:
    ...     print entry[0], entry[1], (entry[2] or 0)
    [root], option2  =  0
    [root], option3  =  the value "Bad_value" is of the wrong type.
    [root], section1, option2  =  0
    [root], section1, option3  =  the value "Bad_value" is of the wrong type.
    [root], section2, another_option  =  the value "Probably" is of the wrong type.
    [root], section3, section3b, section3b-sub, [missing]  =  0
    [root], section3, section3b, value2  =  the value "a" is of the wrong type.
    [root], section3, section3b, value3  =  the value "11" is too big.
    [root], section4, [missing]  =  0
    N(R:RVRWR]RRRRRRR,(tcfgtrestlevelstresultsRzR((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyR, 	s*a	


(Ct
__future__RtsysRRR:R9tcodecsRRRRR;t	byteorderRRRRRURVRLRMRXRYRt	NameErrortobjectRRt__revision__R+t__all__RRtMAX_INTERPOL_DEPTHRVRWRR@RR*RCRhR7RlRRRRpR(R R!R$R%R'R&R)RrRRRRRRR"R#R,(((sC/usr/lib/python2.7/dist-packages/bzrlib/util/configobj/configobj.pyt<module>s&
	





	

		
	8					w
	X}

Copyright © 2017 || Recoded By Mr.Bumblebee