403Webshell
Server IP : 217.160.0.36  /  Your IP : 216.73.216.190
Web Server : Apache
System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User : u90690018 ( 2806576)
PHP Version : 8.4.27
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /kunden/lib/python3/dist-packages/configobj/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /kunden/lib/python3/dist-packages/configobj/__pycache__/__init__.cpython-313.pyc
�

Bf�f�[����SSKrSSKrSSKrSSKJrJrJrJr SSKJ	r	 Sq
\S\S\S\S0rS	S	S	S	S
S
S
SSSSSSSSS
.r\\\\\S.r
SrSrSrSrSrSrSr\"5rSrSrSrSrSSSSSSSSSSSSS.rSr"SS\5r"S S!\5r\"5r S"r!"S#S$\"5r#"S%S&\#5r$"S'S(\#5r%"S)S*\&5r'"S+S,\#5r("S-S.\#5r)"S/S0\#5r*"S1S2\*5r+"S3S4\#5r,"S5S6\*5r-"S7S8\#5r."S9S:\5r/"S;S<\/5r0"S=S>\/5r1\0\1S?.r2S@r3"SASB\45r5"SCSD\55r6"SESF\5r7SISGjr8SJSHjr9g)K�N)�BOM_UTF8�	BOM_UTF16�BOM_UTF16_BE�BOM_UTF16_LE�)�__version__)�utf_8N)�utf16_be�utf_16)�utf16_ler)rrrr
rr	)r�u16�utf16zutf-16r
�	utf_16_bezutf-16ber�	utf_16_lezutf-16ler	�u8�utf�utf8�utf-8)r	rr
rNc�N�[RUR55S:H$)Nr	)�BOM_LIST�get�lower)�encodings �4/usr/lib/python3/dist-packages/configobj/__init__.py�
match_utf8rCs���<�<����(�)�W�4�4�z'%s'z"%s"z%sz 
	'"z"""%s"""z'''%s''')�DEFAULT_INDENT_TYPE�DEFAULT_INTERPOLATION�ConfigObjError�NestingError�
ParseError�DuplicateError�ConfigspecError�	ConfigObj�	SimpleVal�InterpolationError�InterpolationLoopError�MissingInterpolationOption�RepeatSectionError�ReloadError�UnreprError�UnknownType�flatten_errors�get_extra_values�configparserz    �
TF)�
interpolation�raise_errors�list_values�create_empty�
file_error�
configspec�	stringify�indent_typer�default_encoding�unrepr�write_empty_valuesc��[cSSKqSU-n[RU5nUR5SR5SR5S$)Nrza=r)�compiler�parse�getChildren)�s�ps  r�getObjrB{sO������q��A����q��A��=�=�?�1��)�)�+�A�.�:�:�<�Q�?�?rc��\rSrSrSrg)r,��N)�__name__�
__module__�__qualname__�__firstlineno__�__static_attributes__rErrr,r,�s��rr,c�P�\rSrSrSrSrSrSrSrSr	Sr
S	rS
rSr
Srg
)�Builder�c�d�[c[URR5e[U5$�N)�mr,�	__class__rF��self�os  r�build�
Builder.build�s%���9��a�k�k�2�2�3�3���t�rc�\�[[URUR555$rO)�list�maprUr?rRs  r�
build_List�Builder.build_List�s���C��
�
�A�M�M�O�4�5�5rc��UR$rO)�valuerRs  r�build_Const�Builder.build_Const�s���w�w�rc��0n[[URUR555nUHn[	U5X$'M U$rO)�iterrYrUr?�next)rSrT�d�i�els     r�
build_Dict�Builder.build_Dict�s<������T�Z�Z�����1�2���B���G�A�E���rc�6�[URU55$rO)�tuplerZrRs  r�build_Tuple�Builder.build_Tuple�s���T�_�_�Q�'�(�(rc�~�URS:XagURS:XagURS:Xag[S5e)N�None�TrueT�FalseFzUndefined Name)�namer,rRs  r�
build_Name�Builder.build_Name�s=���6�6�V����6�6�V����6�6�W����*�+�+rc��[[URUR555up#[	U5n[U[5(aURS:wa[
S5eX#-$![
a [
S5ef=f)N�Addg)
rXrYr^r?�float�	TypeErrorr,�
isinstance�complex�real)rSrTry�imags    r�	build_Add�Builder.build_Add�sx���#�d�.�.��
�
��@�A�
��	%���;�D��$��(�(�D�I�I��,<��e�$�$��y���	�	%��e�$�$�	%�s�A0�0Bc�b�URUR5n[X!R5$rO)rU�expr�getattr�attrname)rSrT�parents   r�
build_Getattr�Builder.build_Getattr�s#�����A�F�F�#���v�z�z�*�*rc�H�URUR5S5*$�Nr�r^r?rRs  r�build_UnarySub�Builder.build_UnarySub�s!��� � ������!3�4�4�4rc�F�URUR5S5$r�r�rRs  r�build_UnaryAdd�Builder.build_UnaryAdd�s������
�
��� 2�3�3rrEN)rFrGrHrIrUrZr^rfrjrqr{r�r�r�rJrErrrLrL�s4���
6���)�	,��+�5�4rrLc�>�U(dU$SSKnURU5$r�)�ast�literal_eval)r@r�s  rr:r:�s ���������A��rc�"�\rSrSrSrSSjrSrg)r��z_
This is the base class for all errors that ConfigObj raises.
It is a subclass of SyntaxError.
Nc�F�X0lX l[RX5 grO)�line�line_number�SyntaxError�__init__)rS�messager�r�s    rr��ConfigObjError.__init__�s���	�&�����T�+r)r�r�)�Nr��rFrGrHrI�__doc__r�rJrErrrr�s���,rrc��\rSrSrSrSrg)r ��z=
This error indicates a level of nesting that doesn't match.
rEN�rFrGrHrIr�rJrErrr r ����rr c��\rSrSrSrSrg)r!��z�
This error indicates that a line is badly written.
It is neither a valid ``key = value`` line,
nor a valid section marker line.
rENr�rErrr!r!�s��rr!c��\rSrSrSrSrSrg)r*��zK
A 'reload' operation failed.
This exception is a subclass of ``IOError``.
c�0�[RUS5 g)Nz#reload failed, filename is not set.)�IOErrorr��rSs rr��ReloadError.__init__�s������D�ErrENr�rErrr*r*�s
���Frr*c��\rSrSrSrSrg)r"��z2
The keyword or section specified already exists.
rENr�rErrr"r"�r�rr"c��\rSrSrSrSrg)r#��z/
An error occured whilst parsing a configspec.
rENr�rErrr#r#�r�rr#c��\rSrSrSrSrg)r&�z,Base class for the two interpolation errors.rENr�rErrr&r&�s��6rr&c��\rSrSrSrSrSrg)r'�z=Maximum interpolation depth exceeded in string interpolation.c�6�[RUSU-5 g)Nz*interpolation loop detected in value "%s".�r&r�)rS�options  rr��InterpolationLoopError.__init__s���#�#��8�6�A�	CrrENr�rErrr'r'�s��G�Crr'c��\rSrSrSrSrg)r)iz_
This error indicates additional sections in a section with a
``__many__`` (repeated) section.
rENr�rErrr)r)s��rr)c��\rSrSrSrSrSrg)r(i
z0A value specified for interpolation was missing.c�8�SU-n[RX5 g)Nz%missing option "%s" in interpolation.r�)rSr��msgs   rr��#MissingInterpolationOption.__init__s��5��>���#�#�D�.rrENr�rErrr(r(
s
��:�/rr(c��\rSrSrSrSrg)r+iz An error parsing in unrepr mode.rENr�rErrr+r+s��*rr+c�X�\rSrSrSr\R"S5rSrSr	Sr
SrSrS	r
g
)�InterpolationEngineiz�
A helper class to help perform string interpolation.

This class is an abstract base class; its descendants perform
the actual work.
�
%\(([^)]*)\)s�%c��XlgrO��section)rSr�s  rr��InterpolationEngine.__init__%s���rc�d^^�TRU;aU$UU4SjmT"XTR05nU$)Nc�>�XR4U;a[U5eSX0UR4'T
RRU5nU(a�T
R	U5upVnUcUnO	T"XVXs5nUR5up�SR
USU	X�U
S45nU	[U5-nT
RRX5nU(aM�X0UR4	U$)a0The 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.
rNr�)rpr'�_KEYCRE�search�_parse_match�span�join�len)�keyr]r��	backtrail�match�k�vr@�replacement�start�end�new_search_start�recursive_interpolaterSs            ��rr��>InterpolationEngine.interpolate.<locals>.recursive_interpolate/s�����\�\�"�i�/�,�S�1�1�-.�I�G�L�L�)�*��L�L�'�'��.�E���+�+�E�2���a��9�"#�K�#8��a�"K�K�"�Z�Z�\�
������v����3�4�[� I�J��#(�3�{�+;�#;� ����+�+�E�D��!�%�&����-�.��Lr)�_cookier�)rSr�r]r�s`  @r�interpolate�InterpolationEngine.interpolate*s3����|�|�u�$��L�(	�X&�c�$�,�,��C���rc���URRRnSURRlURnURU5nUb[	U[
5(dOXURS05RU5nUb[	U[
5(dOURULaOURnM�X RRlUc[U5eXC4$)zxHelper function to fetch values from owning section.

Returns a 2-tuple: the value, and the section where it was found.
F�DEFAULT)r��mainr1rrw�Sectionr�r()rSr��save_interp�current_section�vals     r�_fetch�InterpolationEngine._fetch_s����l�l�'�'�5�5��*/������'��,�,���!�%�%�c�*�C���z�#�w�'?�'?��!�%�%�i��4�8�8��=�C���z�#�w�'?�'?���%�%��8��-�4�4�O��"+6�����'��;�,�S�1�1��#�#rc��[5e)aiImplementation-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 "$").
)�NotImplementedError)rSr�s  rr�� InterpolationEngine._parse_match�s
�� "�#�#rr�N)rFrGrHrIr��re�compiler�r�r�r�r�r�rJrErrr�r�s3����j�j�)�*�G��G��
2�j$�D$rr�c�F�\rSrSrSrSr\R"S5rSr	Sr
g)�ConfigParserInterpolationi�zBehaves like ConfigParser.r�r�c�R�URS5nURU5up4X#U4$)Nr)�groupr��rSr�r�r]r�s     rr��&ConfigParserInterpolation._parse_match�s*���k�k�!�n�����S�)����7�"�"rrEN)rFrGrHrIr�r�r�r�r�r�rJrErrr�r��s��$��G��j�j�)�*�G�#rr�c�z�\rSrSrSrSrSr\R"S\R\R-5rSrSr
g)�TemplateInterpolationi�zBehaves like string.Template.�$z�
        \$(?:
          (?P<escaped>\$)              |   # Two $ signs
          (?P<named>[_a-z][_a-z0-9]*)  |   # $name format
          {(?P<braced>[^}]*)}              # ${name} format
        )
        c���URS5=(d URS5nUbURU5up4X#U4$URS5bSURS4$SUR5S4$)N�named�braced�escaped)r�r��
_delimiterr�s     rr��"TemplateInterpolation._parse_match�sq���k�k�'�"�;�e�k�k�(�&;���?�!�[�[��-�N�E��w�&�&��;�;�y�!�-�����$�.�.��U�[�[�]�D�(�(rrEN)rFrGrHrIr�r�r�r�r��
IGNORECASE�VERBOSEr�r�rJrErrr�r��s9��'��G��J��j�j���]�]�R�Z�Z�
'�
)�G�)rr�)r/�templatec�(�UR"U/UQ76$rO)�__new__)�cls�argss  r�
__newobj__r��s���;�;�s�"�T�"�"rc��\rSrSrSrSrSrS%SjrSrSr	S	r
S&S
jrSrS'Sjr
S
r\4SjrSrSrS'SjrSrSrSrSrSr\rSrSr\rS\lSrSrSrS(Sjr Sr!Sr"S r#S!r$S"r%S#r&S$r'g))r�i�aE
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.
c�p�[RXS5 URRUS5 g)Nrr)�dict�update�__dict__�rS�states  r�__setstate__�Section.__setstate__�s(�����D��(�#��
�
���U�1�X�&rc�X�[U5UR4n[UR4U4$rO)r�rr�rQrs  r�
__reduce__�Section.__reduce__�s(���d��T�]�]�+���T�^�^�-�u�5�5rNc���Uc0n[RU5 XlX0lX lXPlUR
5 UR5H	upgXpU'M g)z�
* 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�r�r��depthrp�_initialise�items)rSr�r	r��indictrp�entryr]s        rr��Section.__init__�sU���>��F��
�
�d�����	��
��	�����#�L�L�N�L�E���K�+rc��/Ul/Ul0Ul0UlSUl/Ul0Ul/UlSUlg)NF)	�scalars�sections�comments�inline_commentsr6�defaults�default_values�extra_values�_createdr�s rr
�Section._initialise�sD�������
���
�!��������
� ��������
rc�:�URnURX5$![aq URRnUS:Xa[nUR5n[RUS5nUcSURlUs$U"U5=o0lN�f=f)NTF)	�_interpolation_engine�AttributeErrorr�r1rr�interpolation_enginesrr�)rSr�r]�enginerp�class_s      r�_interpolate�Section._interpolates���	C��/�/�F�"�!�!�#�-�-��!�	C��9�9�*�*�D��t�|�,���:�:�<�D�*�.�.�t�T�:�F��~�*/��	�	�'���7=�T�l�B��3�	C�s��A(B�	B�Bc�8^^�[RTT5nTRR(aa[	U[
5(aTR
TU5$[	U[5(a%UU4SjnUVs/sH
oC"U5PM nnXR:waU$U$s snf)z+Fetch the item and do string interpolation.c�V>�[U[5(aTRTU5$U$rO)rw�strr)r
r�rSs ��r�_check�#Section.__getitem__.<locals>._check*s(���!�%��-�-�#�0�0��e�<�<� �Lr)r��__getitem__r�r1rwr#rrX)rSr�r�r$r
�news``    rr&�Section.__getitem__#s�������t�S�)���9�9�"�"��#�s�#�#��(�(��c�2�2��#�t�$�$�!�36�6�#��v�e�}�#��6��:��J��
��7s�;Bc��[U[5(d[SU-5eXR;a/URU'SURU'XR
;aUR
R
U5 [U[5(a7X;aURRU5 [RXU5 g[U[5(acU(d\X;aURRU5 URS-n[RUU[UUURUUS95 gX;aURRU5 URR(dl[U[5(aOV[U[ ["45(a-UH&n[U[5(aM[%SU-5e O[%SU-5e[RXU5 g)aS
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.
zThe key "%s" is not a string.r�r)rrpzValue is not a string "%s".N)rwr#�
ValueErrorrrr�remover�r�appendr��__setitem__r	r�rr7rXrirv)rSr�r]r:�	new_depthr
s      rr-�Section.__setitem__4s����#�s�#�#��<�s�B�C�C��m�m�#�!#�D�M�M�#��(*�D� � ��%��-�-���M�M� � ��%��e�W�%�%����
�
�$�$�S�)����T��.�
��t�
$�
$�V����
�
�$�$�S�)��
�
�Q��I����������I�I� ���
������#�#�C�(��9�9�&�&��e�S�)�)�����e�}�5�5�!&��)�%��5�5�"+�,I�E�,Q�"R�R�"'�$�$A�E�$I�J�J����T��.rc���[RX5 XR;aURRU5 OURRU5 UR
U	URU	g)z-Remove items from the sequence when deleting.N)r��__delitem__rr+rrr�rSr�s  rr1�Section.__delitem__osX�����$�$��,�,���L�L����$��M�M� � ��%��M�M�#��� � ��%rc�0�X$![a Us$f=f)z>A version of ``get`` that doesn't bypass string interpolation.��KeyError�rSr��defaults   rr�Section.getzs#��	��9����	��N�	�s���c�"�UH	nXX'M g)z4
A version of update that uses our ``__setitem__``.
NrE)rSrr
s   rr��Section.update�s���E� �-�D�K�rc�N�XnX	U$![a U[LaeUnU$f=f)z�
'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'
)r6�MISSING)rSr�r8r�s    r�pop�Section.pop�sB��
	��)�C��	��
��
�	��'�!���C��
�
	�s�
�$�$c�t�URUR-nU(d[S5eUSnXnX	X#4$)zPops the first (key,val)z": 'popitem(): dictionary is empty'r)rrr6)rS�sequencer�r�s    r�popitem�Section.popitem�s?���L�L�4�=�=�0����?�@�@��q�k���y���I��x�rc��[RU5 /Ul/Ul0Ul0UlSUl/Ul/Ulg)z�
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��clearrrrrr6rrr�s rrE�
Section.clear�sC��	
�
�
�4�������
���
�!��������
���rc�<�X$![a X U'Xs$f=f)z:A version of setdefault that sets sequence if appropriate.r5r7s   r�
setdefault�Section.setdefault�s-��	��9����	���I��9��	�s���c	��[[URUR-[UR	5555$)z8D.items() -> list of D's (key, value) pairs, as 2-tuples)rX�ziprr�valuesr�s rr�
Section.items�s,���C�����
�
�5��T�[�[�]�8K�L�M�Mrc�4�URUR-$)zD.keys() -> list of D's keys�rrr�s r�keys�Section.keys�s�����t�}�}�,�-rc�d�URUR-Vs/sHoUPM	 sn$s snf)z D.values() -> list of D's valuesrOr2s  rrL�Section.values�s+��&*�l�l�T�]�]�&B�D�&B�c�S�	�&B�D�D��Ds�-c�F�[[UR555$)z=D.iteritems() -> an iterator over the (key, value) items of D)rarXrr�s r�	iteritems�Section.iteritems�s���D�����&�'�'rc�F�[URUR-5$)z.D.iterkeys() -> an iterator over the keys of D)rarrr�s r�iterkeys�Section.iterkeys�s���T�\�\�D�M�M�1�3�3rc�F�[[UR555$)z2D.itervalues() -> an iterator over the values of D)rarXrLr�s r�
itervalues�Section.itervalues�s���D�����'�(�(rc
��^�U4SjnSSRTRTR-Vs/sH$n[U5<S[U"U55<3PM& sn5-$s snf)zx.__repr__() <==> repr(x)c�\>�TU$![a [RTU5s$f=frO�r(r�r&�r�rSs �r�_getval�!Section.__repr__.<locals>._getval��4���
3��C�y� ��-�
3��'�'��c�2�2�
3���� +�+z{%s}�, �: �r�rr�repr�rSrar�s`  r�__repr__�Section.__repr__�sa���	3�
��	�	����t�}�}�4�#7�4��15�S�	�4����;M�$N�4�#7�8�8�	8��#7��+A#
zx.__str__() <==> str(x)c��0nUHrnXn[U[5(aUR5nOA[U[5(a[U5nO [U[5(a[	U5nX1U'Mt U$)z�
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
)rwr�r�rXri)rS�newdictr
�
this_entrys    rr��Section.dict�so�����E���J��*�g�.�.�'�_�_�.�
��J��-�-�!�*�-�
��J��.�.�"�:�.�
�'�E�N���rc���[UR55HOup#X ;aA[X[5(a*[U[5(aXR	U5 MKX0U'MQ g)a�
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)rXrrwr��merge)rSrr�r�s    rrr�
Section.mergesP��&�V�\�\�^�,�H�C���
�4�9�d� ;� ;� *�3�� 5� 5��	����$��S�	�-rc��XR;a
URnO*XR;a
URnO[SU-5eURU5nXn[RX5 [R
XU5 URU5 URXB5 URUnURUnURU	URU	X`RU'XpRU'g)z�
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.
zKey "%s" not found.N)rrr6�indexr�r1r-r+�insertrr)rS�oldkey�newkey�the_list�posr��comm�inline_comments        r�rename�Section.rename's����\�\�!��|�|�H�
�}�}�
$��}�}�H��0�6�9�:�:��n�n�V�$���l������&�����s�+����������$��}�}�V�$���-�-�f�5���M�M�&�!�� � ��(� $�
�
�f��'5���V�$rc�6�0n[[UR55H/nURUnU"X40UD6nURUnX�U'M1 [[UR55HLnURUnU(aU"X40UD6 URUnXR
"U4UUS.UD6XW'MN U$![a U(aeURUnSXW'M�f=f![a U(aeURUnSXW'N�f=f)a8
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'}})
F)r2�call_on_sections)�ranger�r�	Exceptionr�walk)	rS�functionr2r��keywargs�outrdr
r�s	         rr��Section.walkEs-��^���s�4�<�<�(�)�A��L�L��O�E�

'��t�7�h�7�����Q��� �E�
�
*��s�4�=�=�)�*�A��M�M�!�$�E��+��T�5�H�5��
�
�a�(����)�)���)�!1���	�C�J�+�&�
��5�
'��� �L�L��O�E�!&�C�J�
'��!�+�#�� $�
�
�a� 0��%*��
�+�s#�C�	C0�%C-�,C-�0%D�Dc���XnUS:XagUS:Xag[U[5(d
[5eURRUR5$![a [
SU-5ef=f)a�
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
TFz$Value "%s" is neither True nor False)rwr#r6r��_boolsrr*)rSr�r�s   r�as_bool�Section.as_bool�sw��8�i���$�;��
�E�\��
O�!�#�s�+�+�"�*�$��9�9�+�+�C�I�I�K�8�8���
O� �!G�#�!M�N�N�
O�s�AA�A3c��[X5$)a�
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'
)�intr2s  r�as_int�Section.as_int�s��(�4�9�~�rc��[X5$)a�
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')  #doctest: +IGNORE_EXCEPTION_DETAIL
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')  #doctest: +ELLIPSIS
3.2...
)rur2s  r�as_float�Section.as_float�s��&�T�Y��rc�\�Xn[U[[45(a[U5$U/$)z�
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]
)rwrirX)rSr��results   r�as_list�Section.as_list�s-�� ����f�u�d�m�,�,���<���x�rc��URUn[RXU5 XR;aURR	U5 U$)z�
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.
)rr�r-rr,r7s   r�restore_default�Section.restore_default	sE���%�%�c�*������G�,��m�m�#��M�M� � ��%��rc��URHnURU5 M URHnXR5 M g)z�
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)rr�r�restore_defaults)rSr�r�s   rr��Section.restore_defaultss@���&�&�C�� � ��%�'��}�}�G��M�*�*�,�%r)rrrr6rrr	rrr�rpr�rr�NN�FrO)TF)(rFrGrHrIr�rrr�r
rr&r-r1rr�r=r>rBrErHrrPrLrUrX�__iter__r[rj�__str__r�rrr}r�r�r�r�r�r�r�rJrErrr�r��s����$'�6�
 �4�".�.�"8/�v&��(� '�
� ��$�N�
.�
E�
(�
4��H�)�
8��G�/�G�O�
�8 �66�<+/�"�R�j)O�X�. �,�,
� -rr�c	��\rSrSrSr\R"S\R5r\R"S\R5r	\R"S\R5r
\R"S\R5r\R"S\R5r\R"S5r
\R"S	5r\R"S
5r\R"S5r\
\4\\4S.rS
SS
SS
SS
SS.rS-SjrSrS.SjrSrSrSrSrSrSrSrSrSrSrS/Sjr Sr!S r"S!r#S"r$S#r%S$r&S%r'S&r(S'r)S0S(jr*S1S)jr+S*r,S+r-S,r.g)2r$i*z2An object to read, create, and write config files.a�^ # line start
        (\s*)                   # indentation
        (                       # keyword
            (?:".*?")|          # double quotes
            (?:'.*?')|          # single quotes
            (?:[^'"=].*?)       # no quotes
        )
        \s*=\s*                 # divider
        (.*)                    # value (including list values and comments)
        $   # line end
        a=^
        (\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
        $a�^
        (?:
            (?:
                (
                    (?:
                        (?:
                            (?:".*?")|              # 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
        $z�
        (
            (?:".*?")|          # double quotes
            (?:'.*?')|          # single quotes
            (?:[^'",\#]?.*?)       # unquoted
        )
        \s*,\s*                 # comma
        a^
        (
            (?:".*?")|          # double quotes
            (?:'.*?')|          # single quotes
            (?:[^'"\#].*?)|     # unquoted
            (?:)                # Empty value
        )
        \s*(\#.*)?              # optional comment
        $z^'''(.*?)'''\s*(#.*)?$z^"""(.*?)"""\s*(#.*)?$z^(.*?)'''\s*(#.*)?$z^(.*?)"""\s*(#.*)?$)�'''�"""TF)�yes�no�on�off�1�0�true�falseNc
���X�l[RXSU5 U=(d /nUXEXgX�X�X�US.nUcUnO~SSKnUR	S[
SS9 UHnU[;dM[SU-5e [[R55H#unnUU;aUUU'UUnUU:wdMUUU'M% U(aSUS	'URU5 US
nX0lURX5 g)aq
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)``
r)r6rr1r2r3r4r5r7r8r9r:r;NzUPassing in an options dictionary to ConfigObj() is deprecated. Use **options instead.�)�
stacklevelzUnrecognised option "%s".Fr3r6)
�_inspecr�r��warnings�warn�DeprecationWarning�OPTION_DEFAULTSrvrXrr
�_original_configspec�_load)rS�infile�optionsr6rr1r2r3r4r5r7r8r9r:r;r��_optionsr�r
r]�
keyword_values                     rr��ConfigObj.__init__�s��������Q��-���2��",� (�$0�$0�!*�(8�*<�
>���?��G���M�M�?�,��
�
<�
!����/�#�$?�%�$G�H�H�!�!%�_�%:�%:�%<� =���u���'�%*�G�E�N� (���
��M�)�%2�G�E�N�!>��%*�G�M�"�����!��\�*�
�$.�!��
�
�6�&rc�0^�[U[5(a�Xl[RRU5(a0[
US5nUR5=(d /nSSS5 GO.UR(a[SUR-5eUR(a&[
US5nURS5 SSS5 /nO�[U[[45(a[U5nO�[U[5(aR[U[5(aU4SjmT"X5 OUH	nXX'M U?UbUR#U5 gSUlg['US[(5[(LaUR+5=(d /nO[-S5eW(aSUR/U5nUH<nU(a	USS	;aMS
H!nUR1U5(dMXpl O  O [5SU55(d[7U55eUVs/sHofR9S5PM nnUR;U5 UR (anS
UR SR<-n[?UR 5S:�aSU-n	[AU	5n
OUR Sn
UR U
l!X
l"U
eU?UcSUlgUR#U5 g!,(df   GN_=f!,(df   GN?=fs snf)N�rbzConfig file not found: "%s".�wr�c�>�URH	nXX'M URHn0X'T"XX5 M grOrO)�
in_section�this_sectionr
r��set_sections    �rr��$ConfigObj._load.<locals>.set_section�sF���!+�!3�!3��.8�.?��+�"4�#-�#6�#6��02��-�#�J�$7��9N�O�$7r�readz>infile must be a filename, file like object, or list of lines.���)�
�
)�
r�r�c3�B# �UHn[U[5v� M g7frO�rwr#)�.0r�s  r�	<genexpr>�"ConfigObj._load.<locals>.<genexpr>s���=�W�T�:�d�C�(�(�W�s�r�zat line %s.rrz2Parsing failed with several errors.
First error %s)#rwr#�filename�os�path�isfile�open�	readlinesr5r�r4�writerXrir�r$�_errors�_handle_configspecr6rr=r�rv�_handle_bom�endswith�newlines�allrh�rstrip�_parser�r�r�errors�config)rSr�r6�h�contentr
r�r��infor��errorr�s           @rr��ConfigObj._load�s�����f�c�"�"�"�M��w�w�~�~�f�%�%��&�$�'�1��k�k�m�1�r�G�(�'�����<�t�}�}�L�M�M��$�$��f�c�*�a������+���
���u�
�
.�
.��6�l�G�
���
%�
%��&�)�,�,�P��F�)�$�E�"(�-�D�K�$����%��'�'�
�3�
�#'����
�V�V�W�
-�W�
<��k�k�m�)�r�G��\�]�]���&�&�w�/�G�
 ���$�r�(�,�">��/�C��}�}�S�)�)�(+�
��0�� ��=�W�=�=�=�L�t�G�}�L�=�3:�;�7�4�;�;�v�&�7��;����G���<�<� �4�<�<��?�#>�#>�>�D��4�<�<� �1�$�K�d�R��&�s�+�����Q��� �<�<�E�L��L��K��L���"�D�O��#�#�J�/�s(�'��+�*��p<s�
K/�7L�$L�/
K>�
Lc��Uc[nSUl/UlUSUlUSUlUSUlUSUlUSUlUSUlUSUl	USUl
US	UlS
UlSUl
USUlUSUl/Ul/UlSUlUR&(aS
Ul[(R+U5 g)
Nr2r1r3r4r5r7r8rr9Fr;r:)r�r�r�r2r1r3r4r5r7r8rr9�BOMr�r;r:�initial_comment�
final_commentr6r�r�r
)rSr�s  rr
�ConfigObj._initialise+s����?�%�G���
����#�N�3���$�_�5���"�=�1���#�N�3���!�,�/��� ��-���"�=�1����
�+��
� '�(:� ;��������
�")�*>�"?����h�'���!����������<�<�$�D��	���D�!rc
��^�U4SjnSSRTRTR-Vs/sH$n[U5<S[U"U55<3PM& sn5-$s snf)Nc�\>�TU$![a [RTU5s$f=frOr_r`s �rra�#ConfigObj.__repr__.<locals>._getvalLrcrdzConfigObj({%s})rerfrgris`  rrj�ConfigObj.__repr__Ksb���	3�
"��	�	� �L�L�4�=�=�8�;�8�C�)-�S�	�4����3E�F�8�;�<�<�	=��;rlc�t�URb=URR5[;aURXR5$[	U[
[45(aUSnOUn[	U[5(aURXR5$URGb)[URR5nUS:Xav[[R55H:unupVU(dMURU5(dM)URX5s $ URXR5$[UnURU5(dURXR5$U[U5Sn[	U[
[45(aXqS'OUnSUl
URXR5$[[R55H�unupV[	U[5(aURU5(dM5X`lU(d�SUl
U[U5Sn[	U[
[45(aXqS'OUn[	U[5(aURS5s $[	U[5(a"UR!S5RS5s $URUS5s $URX5s $ [	U[5(a UR!S5RS5$URUS5$)a�
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.
NrrTr)rrr�_decoderwrXrir#�BOMSr�
startswith�BOM_SETr�r��bytes�
splitlines�decode)rSr�r��encr�r�final_encoding�newlines        rr��ConfigObj._handle_bomVs���.�]�]�
&�
�]�]�
 �
 �
"�(�
2��<�<��
�
�6�6��f�t�U�m�,�,��!�9�D��D��d�C� � ��<�<��
�
�6�6��=�=�$�
�4�=�=�.�.�0�1�C��h��7;�D�J�J�L�7I�3�C�3�(�)� ��(�(��-�-� $�|�|�F�=�=�8J��|�|�F�M�M�:�:��#�,�C��?�?�3�'�'��|�|�F�M�M�:�:��3�s�8�9�o�G��&�4��-�0�0�#�q�	� ���D�H��<�<��
�
�6�6�04�D�J�J�L�/A�+�C�+�(��d�E�*�*�$�/�/�#�2F�2F��!/�
�%�#�D�H�#�3�s�8�9�o�G�!�&�4��-�8�8�$+�q�	�!(��!�&�#�.�.�%�0�0��6�6�#�F�E�2�2�%�}�}�W�5�@�@��F�F�#�|�|�F�G�<�<��|�|�F�5�5�10B�8�f�e�$�$��=�=��)�4�4�T�:�:��<�<���0�0rc��[U[5(a,UR(aURUR5$U$)z@Decode ASCII strings to unicode if a self.encoding is specified.)rwr�rr�)rS�aStrings  r�_a_to_u�ConfigObj._a_to_u�s-���g�u�%�%�$�-�-��>�>�$�-�-�0�0��Nrc�v�[U[5(aURS5$[U[5(a8U(a UR	U5RS5$URS5$U(a>[U5H/up4[U[5(dMUR	U5X'M1 U$)zn
Decode infile to unicode. Using the specified encoding.

if is a string, it also needs converting to a list.
T)rwr#r�r�r��	enumerate)rSr�rrdr�s     rr��ConfigObj._decode�s����f�c�"�"��$�$�T�*�*��f�e�$�$���}�}�X�.�9�9�$�?�?��(�(��.�.��$�V�,����d�E�*�*�!%���H� 5�F�I�-��
rc��[U[5(a,UR(aURUR5$U$)z'Decode element to unicode if necessary.)rwr�r9r�)rSr�s  r�_decode_element�ConfigObj._decode_element�s1���d�E�"�"�t�'<�'<��;�;�t�4�4�5�5��Krc�F�[U[5(d[U5$U$)zP
Used by ``stringify`` within validate, to turn non-string values
into strings.
r��rSr]s  r�_str�ConfigObj._str�s"��
�%��%�%��u�:���Lrc�~	�URnUR(aSUl/nSnUn[U5S-
nSnSnXv:Ga&U(a/nUS-
nXn	U	R5n
U
(aU
R	S5(aSnURU	5 MZU(d
X0l/nSnSnURRU	5nUGbKUR5up�p�nU(aURcX�l
U
RS5nUURS5:waURS	[X5 M�UUR:aURUU5R nOMUUR:Xa
UR nO0UURS-:XaUnOURS[X5 GMtUR%U5nUU;aURS[&X5 GM�[)UUUUS
9nUUU'UUR*U'UUR,U'GM�UR.RU	5nUc(URSR1U	5[2X5 GOUR5unnnU(aURcX�l
USSS;a9UR5UXU5unnnUR(aSn[U5nO6O5UR(aSn[U5nOURAU5unnUR%U5nUU;aURS[&X5 GM�URCUUSS9 UUR*U'X5R,U'GM$Xv:aGM&URcSUl
U(dUR(dX0lO
U(dX0l"X lg!["a URS
[X5 GM�f=f![6a<n[9U5[::XaSnOSnURU[<UU5 SnAGM�SnAff=f!["a URS[2X5 GM
f=f![6a>n[?U[:5(aSnOSnURU[<UU5 SnAGMQSnAff=f!["a URS[2X5 GM~f=f)zActually parse the config file.Frr��#TN�[�]z Cannot compute the section depthzCannot compute nesting levelzSection too nestedzDuplicate section name)rpz=Invalid line ({0!r}) (matched as neither section nor keyword)�)r�r�r�zUnknown name or type in valuez+Parse error from unrepr-ing multiline valuezParse error in multiline valuez!Parse error from unrepr-ing valuezParse error in valuezDuplicate keyword name)r:)#r3r:r��stripr�r,r��_sectionmarkerr��groupsr8�count�
_handle_errorr r	�_match_depthr�r��_unquoter"r�rr�_keyword�formatr!�
_multiliner��typer,r+rw�
_handle_valuer-r�)rSr��temp_list_values�comment_list�
done_startr��maxline�	cur_index�
reset_commentr��sline�mat�indent�	sect_open�	sect_name�
sect_close�comment�	cur_depthr�r�r]�er�s                       rr��ConfigObj._parse�s����+�+���;�;�$�D�����
����f�+��/���	��
��!��!����N�I��$�D��J�J�L�E��E�,�,�S�1�1� %�
��#�#�D�)���'3�$�!��!�
� �M��%�%�+�+�D�1�C���FI�j�j�l�C��I�7��t�/�/�7�'-�$�%�O�O�C�0�	��
� 0� 0�� 5�5��&�&�'I�'3�V�H���|�1�1�1�!�!%�!2�!2�<�3<�">�>D�f���,�"4�"4�4�)�0�0�F��,�"4�"4�q�"8�8�)�F��&�&�';�'3�V�H�� �M�M�)�4�	���&��&�&�'?�'5�v�J�� '����"�	 $��
%1��y�!�4;��&�&�y�1�-9����	�*���-�-�%�%�d�+�C��{��"�"�S�Z�Z�[_�`���3�(+�z�z�|�$���e��t�/�/�7�'-�$���!�9��.�)�48�O�O�!�6�g�5?�1��w�	� �;�;�&(�G�	)�(.�u�
��'��{�{�"$��	%�$*�5�M�E�%�/3�/A�/A�%�/H�,�U�G��m�m�C�(���,�&��&�&�0�&��;���(�(��e�D�(�A�4;��,�,�S�1�-9�%�%�c�*��Y�!�\���#�!�D���D�0�0�#/� ��!-��+���e'�!��*�*�+I�+7��L� �!��x$-�)�#'��7�k�#9�*I�C�*W�C� $� 2� 2�3��V�$-�!/� (��)��'�!��*�*�<�&��;�!�	!��. )�%�)�!�[�9�9�&E��&I�� �.�.�s�K�� )�+�$��%�� +�%� �.�.� 6� *�F�?�%�	%�sf�N0�P"�=O�Q�+R�0!O�O�
P�#0P�P�"!Q�Q�
R�2R�R�!R<�;R<c���X!R:a5XRLa
[5eURnX!R:aM5URU:XaU$[5e)z�
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.
)r	r�r�)rS�sectr	s   rr�ConfigObj._match_depth�sP���j�j� ��{�{�"�!�m�#��;�;�D�	�j�j� �
�:�:����K��m�rc��X4nUS-
nSRX5nU"XdU5nUR(aUeURRU5 g)z�
Handle an error according to the error settings.

Either raise the error or store it.
The error will have occured at ``cur_index``
rz{0} at line {1}.N)rr2r�r,)rS�text�
ErrorClassr�rr�r�r�s        rr�ConfigObj._handle_error�sS��� ���Q��	�$�+�+�D�<���7�t�4������K�	
�����E�"rc�T�U(d[eUSUS:XaUSS;aUSSnU$)z%Return an unquoted version of a valuerr�)�"�'r)r�rs  rr�ConfigObj._unquote�s6������!�H��b�	�!��a��J�(>��!�B�K�E��rc
��U(aUR(aUS:XagU(ax[U[[45(a]U(dg[	U5S:XaURUSSS9S-$SR
UVs/sHnURUSS9PM sn5$[U[5(d+UR(a[U5nO[SU-5eU(dg	UR(+=(a S
U;=(a SU;nU=(a SU;=(a S
U;=(d S
U;nU=(a+ U(+=(a SU;=(a S
U;=(a SU;nU=(d U(+=(a U(+nU(aeUR(d[nO^S
U;a[SU-5eUS[;aUS[;a
SU;a[nO#URU5nOURU5nU[:Xa(SU;a"UR(aURU5nX�-$s snf)a<
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.
r��,rrF��	multilinerezValue "%s" is not a string.�""r�rr0r/�#Value "%s" cannot be safely quoted.r�)r;rwrXrir��_quoter�r#r7rvr3�noquotr�wspace_plus�_get_single_quote�_get_triple_quote)	rSr]r5r��no_lists_no_quotes�need_triple�hash_triple_quote�check_for_single�quots	         rr8�ConfigObj._quote�s���&��0�0�U�b�[����E�D�%�=�9�9����U��q���{�{�5��8�u�{�=��C�C��9�9� �"� �C�#�k�k�#��k�?� �"�#�
#��%��%�%��~�~��E�
��� =�� E�F�F���!%�!1�!1�1�\�d�%�6G�\�C�W\�L\���]�s�e�|�&G�#��,�%\�T�UZ�]��%�r�k�/�r�s�e�|�r�RU�Y^�R^�r�eh�lq�eq��.�A�k�/�\�K\�G\����#�#������$�%J�U�%R�S�S���8�;�.��2�Y�k�1���%����-�-�e�4���)�)�%�0�D��6�>�c�U�l�t�/?�/?��)�)�%�0�D��|���O"s�>H;c�b�SU;aSU;a[SU-5eSU;a[nU$[nU$)Nr0r/r7)r�squot�dquot�rSr]rAs   rr;�ConfigObj._get_single_quotes?���5�L�s�e�|� �!F��!N�O�O�
�E�\��D����D��rc��URS5S:wa#URS5S:wa[SU-5eURS5S:Xa[nU$[nU$)Nr�r�r�r7)�findr�tdquot�tsquotrFs   rr<�ConfigObj._get_triple_quote&s]���J�J�u���#�%�*�*�U�*;�r�*A� �!F��!N�O�O��:�:�e���"��D����D��rc�p�UR(aUS4$UR(d8URRU5nUc
[	5eUR5$URRU5nUc
[	5eUR5up4pVUS:Xa
Uc
[	5eUb/U4$Ub-U(a
U(dSnOU=(d SnURU5nUS:XaXF4$URRU5nUVs/sHo�RU5PM nnUbXt/-
nXv4$s snf)zh
Given a value string, unquote, remove comment,
handle lists. (including empty and single member lists)
r�Nr6)
r�r3�_nolistvaluer�r�r
�	_valueexpr�
_listvalueexp�findall)	rSr]rr3�single�
empty_listr#ryr�s	         rr�ConfigObj._handle_value0s/��
�<�<��2�;������#�#�)�)�%�0�C��{�!�m�#��:�:�<���n�n�"�"�5�)���;��-��58�Z�Z�\�2��j��2��F�N��-���!���=� ����6�����4�����v�.���"���$�$��%�%�-�-�k�:��2:�;�(�3�M�M�#�&�(��;����� �H��"�"��<s�D3c��USSnUSSnURUSnURUSnURU5n	U	b,[U	R55n
U
R	U5 U
$URU5S:wa
[
5eX4:a0US-
nUS-
nX#nURU5S:XaXk-
nOOX4:aM0[
5eURU5n	U	c
[
5eU	R5upXa-X�4$)z9Extract the value, where we are in a multiline situation.Nr
rrr�r�)�
_triple_quoter�rXr
r,rIr�)
rSr]r�rrrA�newvalue�single_line�
multi_liner�retvalr�r#s
             rr�ConfigObj._multilineas���R�a�y�����9���(�(��.�q�1���'�'��-�a�0�
�����&���?��#�*�*�,�'�F��M�M�)�$��M�
�]�]�4�
 �B�
&��-���!���N�I����H��$�D��y�y���"�$�� ����!��-�����t�$���;��-���:�:�<���� �'�5�5rc���[U[5(d
[USSSS9nXlg![an[SU-5eSnAf[an[	SU-5eSnAff=f)zParse the configspec.T)r2r5r�zParsing configspec failed: %sNzReading configspec failed: %s)rwr$rr#r�r6)rSr6r%s   rr��ConfigObj._handle_configspec�su���*�i�0�0�

C�&�z�48�26�/3�5�
�%���"�
K�&�&E��&I�J�J���
C��=��A�B�B��
C�s �*�
A"�A�
A"�A�A"c��URnURS5n[U[5(a#URHnXS;dM
XAUlM URH�nUS:XaMXQ;af0X'SXlU(aRURRU/5URU'URRUS5URU'[X[5(dM�X5XlM� g)zr
Called by validate. Handles setting the configspec on subsections
including sections to be validated by __many__
�__many__Tr�N)	r6rrwr�rrrrr�)rSr��copyr6�manyr
s      r�_set_configspec�ConfigObj._set_configspec�s���
�'�'�
��~�~�j�)���d�D�!�!� �)�)���*�04�E�N�-�*� �(�(�E��
�"���#�!#���*.���'��.8�.A�.A�.E�.E�e�R�.P�G�$�$�U�+�5?�5O�5O�5S�5S�TY�[]�5^�G�+�+�E�2��'�.�'�2�2�,6�,=���)�)rc��UR(d!URURU55nO[U5nU<URURUSS95<UR	S5<U<URU5<3$)z.Write an individual line, for the write methodFr4z = )r:rr8rhr�)rS�
indent_stringr
ror#r�s      r�_write_line�ConfigObj._write_line�st���{�{��&�&�t�{�{�:�'>�?�C��z�"�C�,�#�3�3�D�K�K��QV�K�4W�X�#�|�|�E�2�"�#�3�3�G�<�	>�	>rc���U<URSU-5<URURU5SS9<URSU-5<URU5<3$)zWrite a section marker linerFr4r	)r�r8r)rSrer	r
r#s     r�
_write_marker�ConfigObj._write_marker�sY��,�#�|�|�C�%�K�8�#�{�{�4�+?�+?��+F�RW�{�X�#�|�|�C�%�K�8�#�3�3�G�<�	>�	>rc��U(dgURnURS5(dX RS5-
nX!-$)zDeal with a comment.r�rz # )r8r�r�)rSr#r�s   r�_handle_comment�ConfigObj._handle_comment�s=����� � ���!�!�#�&�&��\�\�%�(�(�E��� rc	�	�URc[Ul/nURS5nURS5nUc{URnSUlUnURHVnURU5nUR
5nU(aURU5(dXW-nURU5 MX URUR-n	URUR-GH&n
X�R;aMURU
HVnURUR55nU(aURU5(dX[-nURX�-5 MX X*nURUR U
5n
[#U[$5(aNURUR'U	URU
U
55 UR)UR+US95 GMURUR-U	U
UU
55 GM) X LamUR.HVnURU5nUR
5nU(aURU5(dXW-nURU5 MX WUlX LaU$UR0c�Uc�UR2(a*UVs/sHo�R5UR25PM nnUR6(aeUR2b1[8R;UR2R=55S:Xa'U(dURS5 [>US-US'U$UR@=(d [BRDn[GUS	S5b,URHS
:Xa[JRLS:XaUS:XaS
nURU5ROU5nURQU5(dUU-
n[#U[R5(aUnO7UR5UR2=(d URT=(d S5nUR6(a0UR2b[WUR25(a	[>U-nUbUR+U5 g[YUR0S5nUR+U5 SSS5 gs snf!,(df   g=f)a
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')
Nrz# Fr�r	r�r�moder��win32r�r��ascii�wb)-r8rr�r1r�rrr�r,r	rrrr�lstriprlrrwr�ri�extendr�rfr�r�r�encoder�rrrrr�r��lineseprro�sys�platformr�r�r�r9rr�)rS�outfiler�r��cs�csp�int_valr��
stripped_linerer
�comment_lineror#�lr��output�output_bytesr�s                   rr��ConfigObj.write�s������#�2�D����
�\�\�#�
���l�l�4� ���?��(�(�G�!&�D���G��,�,���+�+�D�1�� $�
�
��
� ��)A�)A�"�)E�)E��:�D��
�
�4� �-��(�(�7�=�=�8�
��o�o��(8�(8�8�E��(�(�(�� '� 0� 0�� 7��#�3�3�L�4G�4G�4I�J����(?�(?��(C�(C�#&�#5�L��
�
�=�7�8�	!8�
!��J��*�*�7�+B�+B�5�+I�J�G��*�g�.�.��
�
�4�-�-�!��$�$���	��
�
�
�4�:�:�j�:�9�:��
�
�4�+�+�!����	��+9�6�?��*�*���+�+�D�1�� $�
�
��
� ��)A�)A�"�)E�)E��:�D��
�
�4� �+�")�D�����J��M�M�!����}�}�8;�<��1�x�x��
�
�.���<����t�}�}�4����d�m�m�1�1�3�4��?���J�J�r�N�!�C��F�*��A���J��-�-�-�2�:�:���G�V�T�*�6�7�<�<�3�;N�����'�G�v�,=��G����g�&�+�+�C�0�����w�'�'��g��F��f�e�$�$�!�L�!�=�=����*1�)-�)>�)>�*1�)0�2�L��8�8�$�-�-�/�J�t�}�}�4M�4M�#�l�2�L����M�M�,�'��d�m�m�T�*�a�����%�+�*��C=�B+�*�s�4$S�%S�
Sc	�^^^^^^^�Tc�TRc[S5eT(a
SSKJn UTlTmT(a�TRR
TlTRRTlTRRTlTRRTlTRRTl	TRRTl
TRmTRTT5 UUUUUUU4Sjn0mSnSnTRV	s/sHo�T;dM
U	PM n
n	TRV	s/sHo�TR;dMU	PM nn	TRV	s/sHo�TR;dMU	PM nn	TRH�n
U
S;aMU
TR;dU
TR;anSnSnT(abU
TR;aRTRR!U
/5TRU
'TR"R!U
S5TR"U
'OS	nTU
nU"U
TU
UX�U5upxM� SnS
TR;aTS
nOSTR;aTSnUbU
Hn
TU
nU"U
UUS	Xx5upxM /n
UH.n
S	nT(dS	TU
'MS	nSU
-nTR%U5TU
'M0 UH.n
S	nT(dS	TU
'MS	nS
U
-nTR%U5TU
'M0 TRH�n
TTLaU
S:XaMTU
RcU
R'U
5 M3T(aRTRR!U
/5TRU
'TR"R!U
S5TR"U
'TR)TTTTU
S9nUTU
'US	:XaS	nM�US:XaS	nM�S	nM� U
TlT(aTR,(dS	nU(a,T(a%T(a[/TR155(+nU(agU(ag	T$s sn	fs sn	fs sn	f)a3
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.
NzNo configspec supplied.r)�VdtMissingValuec�B>�T
RRUS5 TRT	U5T
RU'TR
UUUS9nSnSTU'TR(dU(a}TR(d[[U[[45(a"UVs/sHnTRU5PM nnOU(aUcSnOTRU5nXb:wdU(aUT
U'T
(d2U(a+UT
R;aT
RRU5 XE4$![[TR
4a GNf=fs snf!TR
a=nT(a[UTR5(aSTU'OUTU'SnSnSnAXE4$SnAff=f)N)�missingFTr�)rr>�get_default_valuer6r�baseErrorClass�checkr7rwrXrirrr,�_vdtMissingValue)r
�specr�r��ret_true�	ret_falser��itemr%r6r`r��preserve_errorsr�rS�	validators         �������r�validate_entry�*ConfigObj.validate.<locals>.validate_entry�s�����"�"�&�&�u�d�3�
�09�0K�0K�J�W\�L]�0^��&�&�u�-�
3�!����(+�07�(�*��"�	�!��E�
��>�>�W� �>�>�%�e�d�E�]�;�;�AF�$G���T�Y�Y�t�_��E�$G�E�$���$&�E�$(�I�I�e�$4�E����).������E��9I�9I�,I��$�$�+�+�E�2��&�&��K�n�i�.F�.F�G�
��
��6%H��#�+�+�
!�&�*�Q��8M�8M�*N�*N�!&�C��J�"#�C��J� %�I� ��(�&�&��7
!�s/�!D*�E�!E�*E	�E	�F�!1F�FT)r_�
___many___r�Fr_r�z"Value %r was provided as a sectionz)Section %r was provided as a single valuer�)r�r`r�)r6r*�configobj.validater�r�r�r�rr�r�r8rbrrrrrrr�r,�validaterr�anyrL)rSr�r�r`r�r�r�r�r�r��unvalidated�incorrect_sections�incorrect_scalarsr
r�r�rar�r�r6r�s`````              @@rr��ConfigObj.validateJs=���H�?����&� �!:�;�;��?�(7��%��G��*1�*<�*<�*L�*L��'�(/�(:�(:�(H�(H��%�#*�#5�#5�#>�#>�� �%�0�0�4�4���#*�#5�#5�#>�#>�� �&-�&8�&8�&D�&D��#��'�'�
����W�d�+�*	'�*	'�Z�����	�")�/�/�I�/�Q�j�5H�q�/��I�)3�)<�)<�U�)<�A�W�_�_�@T�a�)<��U�(2�(:�(:�T�(:�1�7�CS�CS�>S�Q�(:��T��'�'�E��2�2���W�_�_�,�%�7�;K�;K�2K������E����8�#�+�+�/�/��r�:��$�$�U�+�#�2�2�6�6�u�b�A��+�+�E�2�� ���e�n��"0��
�5�8I�3�18�I�#O��H�i�)(�.����+�+�+��j�)�D�
�Z�/�/�
/��l�+�D���$���e�n��&4�U�D�#�u�5=�'J�#��)�%��K�&�E��H�"�"��E�
�!�	�:�U�B��&�5�5�c�:��E�
�'�(�E��H�"�"��E�
�!�	�A�E�I��&�5�5�c�:��E�
�(��%�%�E��$��5�I�#5���u�~�(�(�0��"�"�5�)���*4�*=�*=�*A�*A�%��*L�� � ��'�1;�1K�1K�1O�1O�PU�WY�1Z��'�'��.��M�M�)�_�SW�ah�in�ao�M�p�E��C��J���~� ���$��!�	� ��#&�& +����7�#3�#3��I���S�
 ��
�
��-�-�I���
���
��}J��U��Ts$� 	P8�-P8�P=�P=�0Q�Qc�`�UR5 UR5 SUlSUlg)z@Clear ConfigObj instance and restore to 'freshly created' state.N)rEr
r6r�r�s r�reset�ConfigObj.reset	s(���
�
���������$(��!rc�:�[UR[5(d
[5eURn0n[HnUS:XaM[X5X#'M URnXBS'UR5 URU5 URX5 g)z�
Reload a ConfigObj from file.

This method raises a ``ReloadError`` if the ConfigObj doesn't have
a filename attribute pointing to a file.
r6N)
rwr�r#r*r�rr�rEr
r�)rSr��current_optionsr
r6s     r�reload�ConfigObj.reload$	s����$�-�-��-�-��-���=�=����$�E���$��%,�T�%9�O�"�%�
�.�.�
�(2��%��
�
������)��
�
�8�(r)r�r�r�r�r�r6r4r9rr5r�r�r8r�r1r3r�r2r7r:r;)NNNNTFTFFTNNFFFrO)Tr�)FFN)/rFrGrHrIr�r�r�r�rrrOrPrN�_single_line_single�_single_line_double�_multi_line_single�_multi_line_doublerVr�r�r�r
rjr�r�r�rrr�rrrr8r;r<rrr�rbrfrirlr�r�r�r�rJrErrr$r$*s���<��z�z�
�	�
�
��H��Z�Z�
!
�	�
�
��N�"�
�
�
�0	�
�
�1�I�6�J�J� �	�
�
��M��:�:�
�	�
�
�	�L��*�*�%>�?���*�*�%>�?�����$:�;�����$:�;��$�%7�8�#�%7�8��M��5��5�
���u�	
�F�MQ�EI�AE�AF�38�	7'�t]0�@"�@=�n1�b��2�
�d,�N�&#�&�D�N��.#�b 6�F%�*>�8>�>�!�p&�d?D��L�^)�)rr$c�(�\rSrSrSrSrSSjrSrg)r%i>	a�
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``)
c��[UlgrO)rr�r�s rr��SimpleVal.__init__J	s
��,��rc�4�U(aUR5eU$)z9A dummy check method, always returns the value unchanged.�r�)rSr��memberr�s    rr��SimpleVal.checkM	s����%�%�'�'��
rr�Nr�)rFrGrHrIr�r�r�rJrErrr%r%>	s��	�-�rr%c�*�Uc/n/nUS:Xa[U5$US:Xd[U[5(a9URUSSSU45 U(aUR	5 [U5$[UR
55HiupEUS:XaM
[URU5[5(a"URU5 [XXRU5 MSURUSSXE45 Mk U(aUR	5 [U5$)ao
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*.
NTF)
�sortedrwr�r,r>rXrrr�r-)�cfg�res�levels�resultsr�r�s      rr-r-T	s���@�~�����
�d�{��g���
�e�|�z�#�y�1�1�����q�	�4��-�.���J�J�L��g����3�9�9�;�'�
���$�;���c�g�g�c�l�D�)�)��M�M�#���3�8�S�'�:������q�	�3�,�-�(���
�
���'�?�rc��/nURURVs/sHo1U4PM sn5 URH4nX0R;dMUR[XX4-55 M6 U$s snf)a�
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.
)rtrrr.)�conf�_prependr�rps    rr.r.�	sq��"
�C��J�J�T�->�->�?�->�T�4� �->�?�@��
�
���(�(�(��J�J�'��
�H�w�4F�G�H���J��	@s�
A6r�)rE):r�r�rw�codecsrrrr�_versionrr=r�rr�rrDrEr9r:rKrJ�objectr=�__all__rr�MAX_INTERPOL_DEPTHr�rBr�r,rL�_builderr:r�rr r!r�r*r"r#r&r'r)r(r+r�r�r�rr�r�r�r$r%r-r.rErr�<module>r�s4�� 
�	�
�B�B�!���
�o��(��(�
�#�	����
��������
�
���
���(����
���5�
	����	
����	��	���(����*'�������������������� @�	�)�	�44�f�44�n�9���,�[�,��>�����F�'�F��^���n��7��7�C�/�C����/�!3�/�+�.�+�
x$�&�x$�x#� 3�#�)�/�)�6.�%���#�b	-�d�b	-�JP)��P)�h(���,9�x�4Hr

Youez - 2016 - github.com/yon3zu
LinuXploit