%PDF- %PDF-
Mini Shell

Mini Shell

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

�

��S$���dZdZdZddlZddlZddlZejd�ZGd�de�Z	Gd�d	e�Z
d
�Zedk(re�yy)zHandling configuration files.z%Sebastian Heinlein <devel@glatzor.de>)�ConfigWriter�NzAptDaemon.ConfigWriterc�"�eZdZdZd�Zd�Zd�Zy)�Valuea�Represents a value with position information.

    .. attribute:: string
        The value string.

    .. attribute:: line
        The line number of the configuration file in which the value is set.

    .. attribute:: start
        The position in the line at which the value starts.

    .. attribute:: end
        The position in the line at which the value ends.

    .. attribute:: quotes
        The outer qoutes of the value: ' or "
    c�J�d|_||_d|_||_||_y)N�)�string�start�end�line�quotes)�selfrr	rs    �2/usr/lib/python3/dist-packages/aptdaemon/config.py�__init__zValue.__init__4s%�������
������	����c� �|j|k(S)N)r)r
�others  r�__cmp__z
Value.__cmp__;s���{�{�e�#�#rc	�p�d|j�d|j�d|j�d|j�d�	S)NzValue: 'z' (line z: z to �))rrr	r
)r
s r�__repr__zValue.__repr__>s(��48�K�K����48�J�J����J�	JrN)�__name__�
__module__�__qualname__�__doc__rrr�rrrr s���$�$�Jrrc��eZdZdZd�Zd�Zy)rz!Modifies apt configuration files.c	���i}d}d}d}g}d}d}g}	d}
d}t|�D�]I\}}
t|
�D�]4\}}|s|dk(r
|dk(rd}d}�|r|dk(r|dk(r
d}d}|dd}�.|r�n|s|dk(r|dk(s|d	k(r	d}|dd}�^|d
vrH|r|j|k(r||_|}�n�|st|||�}|}�n�|xj|z
c_�n�|r|xj|z
c_�n�|r"|dk(r|dk(r|j|dd�d}�n^|j
�s|dvr||j�z
}�n5|d
k(r�|
r|	j|�d}��|	r=tjddj|�|	�|	|dj|�<g}	nb|r;tjddj|�|�||dj|�<n%tjddj|��d}|dkDr|j�n`g}n]|dk(r|dz}d}
nP|dk(r|dz
}|r|j|�d}d}
n.|dvr|r(|j|�d}d}
ntd|�d|
�d���|}��7��L|S)z�Parse an ISC based apt configuration.

        :param lines: The list of lines of a configuration file.

        :returns: Dictionary of key, values found in the parsed configuration.
        FNrTr�*�/����#z'"�:z/-:._+�;z
Found %s "%s"z::zSkipping empty key %s�}��{z	
 zUnknown char 'z' in line: '�')
�	enumeraterr
rr�append�isalpha�lower�log�debug�join�pop�
ValueError)r
�lines�options�
in_comment�in_value�	prev_char�option�value�option_name�
value_list�in_brackets�level�line_nor�char_no�chars                r�parsezConfigWriter.parseGs������
����	��������
�����&�u�-�K	!�M�G�T�!*�4��J
!�
���!�d�c�k�i�3�6F�!%�J� "�I���D�C�K�I��4D�!&�J� "�I�"-�c�r�"2�K����!����	�S�8H�'+�s�{�!#�I�"-�c�r�"2�K���U�]��E�L�L�D�$8�$+��	�'/�<��"� %�g�w�� =��'/�<������,����L�L�D�(�L� �T�S�[�Y�#�5E��M�M�+�c�r�"2�3�"$�K��\�\�^�t�x�'7��4�:�:�<�/�K��S�[�"�"�)�)�%�0� $�� �!��	�	�"3�T�Y�Y�v�5F�",�.�5?���	�	�&� 1�2�%'�
���	�	�"3�T�Y�Y�v�5F��N�5:���	�	�&� 1�2��	�	�"9�4�9�9�V�;L�M� �E��q�y��
�
��!#���S�[��Q�J�E�"'�K��S�[��Q�J�E�"��
�
�k�2�&(��"&�K��W�_�"��
�
�k�2�&(��&+��$�&*�D�&2�3�3� �	�UJ
!�K	!�X�rc�,�|durd}n|durd}nt|�}tjjtj
j
d�tj
j
d��}tj|�D�]�}||kr�
ttjj||��5}|j�}ddd�|j�}	||j�}	|dk(r|	jj�dvs9|dk(r|	jj�d	vst|�|	jk(r��||k(rH||	j}
|
d|	jd
z}||z
}||
|	jdz
}|||	j<n d||	jz||	j<	ttjj||�d�5}t$j'd|�|j)|�ddd����tjj+tjj||��scttjj||�d�5}t$j'd�|�d|�d
�}
|j-|
�ddd�yy#1swY���xYw#t $r$||k(r|j#|�d|�d
��nY��mY��7wxYw#1swY��~xYw#1swYyxYw)aChange the value of an option in the configuration.

        :param option: The name of the option, e.g.
            'apt::periodic::AutoCleanInterval'.
        :param value: The value of the option. Will be converted to string.
        :param defaultfile: The filename of the ``/etc/apt/apt.conf.d``
            configuration snippet in which the option should be set.
            If the value is overriden by a later configuration file snippet
            it will be disabled in the corresponding configuration file.
        T�trueF�falsezDir::EtczDir::Etc::PartsN)�yes�with�on�enable)�no�without�off�disabler%z// %sz 'z';
�wzWritting %s)�str�os�pathr.�apt_pkg�config�find_dir�listdir�open�	readlinesr?r+rrr	r
�KeyErrorr)r,r-�
writelines�exists�write)r
r6r7�defaultfile�	etc_parts�filename�fdr1rP�valr�new_lines            r�	set_valuezConfigWriter.set_value�s����D�=��E�
�e�^��E���J�E��G�G�L�L����!8�!8��!D�!(���!8�!8�9J�!K�M�	��
�
�9�-�$	%�H��+�%���b�g�g�l�l�9�h�7�8�
'�B������
'��Z�Z��&�F�
@��V�\�\�^�,���f�_��
�
�(�(�*�/9�9��'�)����)�)�+�0;�;��U��s�z�z�1���{�*� ����?�D�#�N�S�Y�Y��]�3�H���%�H���S�W�W�X��.�H�&.�E�#�(�(�O�
'.��c�h�h��&?�E�#�(�(�O��b�g�g�l�l�9�h�7��=�
%���	�	�-��2��
�
�e�$�
%�
%�E$	%�J�w�w�~�~�b�g�g�l�l�9�k�B�C��b�g�g�l�l�9�k�:�C�@�
�B��	�	�-��2�'-�u�5�������
�
�D�E
'�
'��
�
��{�*��L�L���!?�@��A�
��4
%�
%��
�
�s6�<K�'K
�,(K=�0L
�K
	�
&K:�9K:�=L	�
LN)rrrrr?r_rrrrrCs��+�]�~?rrc��tj�t�}tt	j
d��D]/}t
d|z�j�}|j|��1t|jddd��y)Nz/etc/apt/apt.conf.d/z/etc/apt/apt.conf.d/%sz	huhu::abc�lumpi�	10glatzor)rO�init_configr�sortedrMrRrSrTr?�printr_)�cwr[r1s   r�mainrg�sn������	��B��2�:�:�&<�=�>����-��8�9�C�C�E��
������
�2�<�<��W�k�:�<r�__main__)
r�
__author__�__all__�loggingrMrO�	getLoggerr,�objectrrrgrrrr�<module>rnsg��#�&5�
�
���	���g���0�1�� J�F� J�Fb�6�b�J=��z���F�r

Zerion Mini Shell 1.0