%PDF- %PDF-
Mini Shell

Mini Shell

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

�

�|f�q����ddlZddlZddlZddlZddlZddlmZddlmZm	Z	m
Z
ddlmZddl
m
ZddlmZddlmZmZmZej*�dZGd	�d
e�ZGd�de�ZGd
�de�Zy)�N)�
get_distro)�SourceEntry�SourcesList�Deb822SourceEntry)�suppress)�gettext)�urlparse)�get_source_entry_from_list�copy_source_entry�deb822_source_entry_containsz=gpg -q --no-options --no-default-keyring --batch --keyring %sc��eZdZdZ		d-d�Zed��Zed��Zed��Zed��Z	e
d��Ze
d	��Ze
d
��Z
e
d��Ze
d��Ze
d
��Zd.d�Ze
d��Ze
d��Zd�Zd�Zd�Zd�Zd�Zd�Ze
d��Ze
d��Ze
d��Ze
d��Zd�Zd�Ze
d��Z e
d��Z!e
d��Z"e
d ��Z#e
d!��Z$d"�Z%d#�Z&e
d$��Z'e
d%��Z(e
d&��Z)e
d'��Z*e
d(��Z+d)�Z,d.d*�Z-d.d+�Z.d,�Z/y)/�ShortcutHandleraCSuperclass for shortcut handler implementations.

    This provides a way to take a apt repository reference, in various forms,
    and write the specific apt configuration to local files.  This also can
    remove previously written configuration from local files.

    This class and any subclasses should never modify any main apt configuration
    files, only specifically named files in '.d' subdirs (e.g. sources.list.d, etc)
    should be modified.  The only exception to that rule is adding or removing
    sourceslist lines or components of existing source entries.
    Nc���||_|xsg|_||_t�|_|xs|jj
|_||_||_||_d|_	d|_
d|_d|_y�N)
�shortcut�
components�
enable_sourcer�distro�codename�pocket�dry_run�deb822�
_source_entry�	_filebase�	_username�	_password)	�selfrrrrrrr�kwargss	         �D/usr/lib/python3/dist-packages/softwareproperties/shortcuthandler.py�__init__zShortcutHandler.__init__7sr�� ��
�$�*����*��� �l��� �8�D�K�K�$8�$8��
����������"������������c�L�t|�}|jxr|jS)z(Return if the uri is in valid uri format)r	�scheme�netloc��cls�uri�parseds   r�is_valid_urizShortcutHandler.is_valid_uriKs ���#����}�}�.����.r!c��t|�}|j|jjd�d��j	�S)z6Return the uri with the username and password stripped�@��r$)r	�_replacer$�
rpartition�geturlr%s   r�uri_strip_authzShortcutHandler.uri_strip_authQs=���#������f�m�m�&>�&>�s�&C�A�&F��G�N�N�P�Pr!c��t|j|��}|�d|�d|j��}|j|��j	�S)z6Return the uri with the username and password included�:r+r-)r	r1r$r.r0)r&r'�username�passwordr(r$s      r�uri_insert_authzShortcutHandler.uri_insert_authYsC���#�,�,�S�1�2��%�x����?�����f��-�4�4�6�6r!c��d}|dz
}	tj�5}|d|��z
}t|t�s|j	�}tj|j�d|t
j��jj�}ddd�	j�D�cgc](}|jd�s�|jd	�d
��*c}S#1swY�LxYw#t
j$r#}ttd�|z�gcYd}~Sd}~wwxYwcc}w#t $rttd�z�gcYSwxYw)z�Return an array of fingerprint(s) for provided key(s).

        The 'keys' parameter should be in text (str) or binary (bytes) format;
        it is converted to bytes if needed, and then passed to the 'gpg' program.
        z6gpg -q --no-options --no-keyring --batch --with-colonsz& --with-fingerprint --with-fingerprint� --homedir T)�check�input�stdoutNz,Warning: gpg error while processing keys:
%s�fprr3�	zWarning: invalid gpg output:
%s)�tempfile�TemporaryDirectory�
isinstance�bytes�encode�
subprocess�run�split�PIPEr;�decode�CalledProcessError�print�_�
splitlines�
startswith�KeyError)r&�keys�cmd�homedirr;�e�ls       r�fingerprintszShortcutHandler.fingerprints`s)��G���(�(��		��,�,�.�
P�'���W�I�.�.��!�$��.��;�;�=�D�#����	�	��4�t�/9���@�@F��v�v�x��	
P�	�-3�->�->�-@�X��A�L�L�QV�DW�A�G�G�C�L��O�X�X�
P�
P���,�,�	��!�C�D�q�H�I��I��	��Y���	��!�6�7�&�@�A��I�	�s_�C*�A6C�C*�D(�.D#�D#�D(�C'�#C*�*D �=D�D �D �#D(�("E
�E
c	��td|j�j�ddj|j�j����S)NzArchive for codename: z
 components: �,)rJr�dist�join�comps�rs r�descriptionzShortcutHandler.description|sA����#�#�%�*�*��8�8�D�,�,�.�4�4�5�7�8�	9r!c��|jSr)�archive_linkrYs r�web_linkzShortcutHandler.web_link�s��� � � r!c�6�|j�jSr)rr'rYs rr\zShortcutHandler.archive_link�s�����!�%�%�%r!c�h�|jr|j�d|j��S|jS)N�-)rrrYs rrVzShortcutHandler.dist�s&���;�;�"�m�m�T�[�[�9�9��}�}�r!c�.�|jjS)z*Text indicating a binary-type SourceEntry.)r�binary_typerYs rrbzShortcutHandler.binary_type�����{�{�&�&�&r!c�.�|jjS)z*Text indicating a source-type SourceEntry.)r�source_typerYs rrezShortcutHandler.source_type�rcr!c��|jstd��t|j�}|s|S||jk(r|j	d�n9||j
k(r|j	|j�ntd|z��t|t�r|g|_
t|�S||_t|�S)a"Get the SourceEntry representing this archive/shortcut.

        This should never include any authentication data; if required,
        the username and password should only be available from the
        username and password properties, as well as from the
        netrcparts_content property.

        If pkgtype is provided, it must be either binary_type or source_type,
        in which case this returns a SourceEntry with the requested type.
        If pkgtype is not specified, this returns a SourceEntry with an
        implementation-dependent type (in most cases, implementations should
        default to binary_type).

        Note that the default SourceEntry will be returned without modification,
        and the implementation will determine if it is enabled or disabled;
        while the source-type SourceEntry will be enabled or disabled based on
        self.enable_source.  The binary-type SourceEntry will always be enabled.

        The SourceEntry 'file' field should always be set to the value of
        sourceparts_file.
        z3Implementation class did not set self._source_entryTzInvalid pkgtype: %s)r�NotImplementedErrorrrb�set_enabledrer�
ValueErrorr@r�types�type)r�pkgtyperQs   rrzShortcutHandler.SourceEntry�s���,�!�!�%�&[�\�\��d�0�0�1����H��d�&�&�&�
�M�M�$��
��(�(�
(�
�M�M�$�,�,�-��2�W�<�=�=��a�*�+��i�A�G�!��#�#��A�F� ��#�#r!c��|jS)aWReturn the username used for authentication

        If authentication is used, return the username; otherwise return None.

        By default, this returns the private variable self._username, which
        defaults to None.  Subclasses should override this method and/or
        set self._username if they have authentication data.
        )rrYs rr4zShortcutHandler.username�����~�~�r!c��|jS)aWReturn the password used for authentication

        If authentication is used, return the password; otherwise return None.

        By default, this returns the private variable self._password, which
        defaults to None.  Subclasses should override this method and/or
        set self._password if they have authentication data.
        )rrYs rr5zShortcutHandler.password�rnr!c�d�|j�|j�|j�y)z�Save all data for this shortcut to file(s).

        This writes everything to the relevant files.  By default, it
        calls add_source(), add_key(), and add_login().  Subclasses
        should override it if other actions are required.
        N)�
add_source�add_key�	add_loginrYs r�addzShortcutHandler.add�s!��	
�����������r!c�D�|j�|j�y)a<Remove all data for this shortcut from file(s).

        This removes everything from the relevant files.  By default, it
        only calls remove_source() and remove_login().  Subclasses
        should override it if other actions are required.  Note that by
        default is does not call remove_key().
        N)�
remove_source�remove_loginrYs r�removezShortcutHandler.remove�s��	
�������r!c�B�td��}d}|j|j�}|D]#}t|t�s�t||�s�!|}n|�.t
td�|j|jfz�n�|jdddg|j��}|j|_|j|_|j|_
|j|_|jr_|jj!�}|D�cgc]}d|j#�r|ndz��}}ddj%|�z|j&d	<|}|j(r�|j*t-|j�vr�d}|j|j*�}|D]#}t|t�s�t||�s�!|}n|�.t
td�|j*|jfz�n|j|j*g|_|j.s�t0j2j5|j�s�|jj7|j8�rIt0j2j5|j8�s t1j:|j8d
�t=|jd�5t1j>|j|j@�ddd�|jC�yycc}w#1swY� xYw)NT�r�Found existing %s entry in %s���file� �.�
z	Signed-By���w)"rrrbr@rrrIrJr~rt�sourceparts_filerj�uris�suitesrX�trustedparts_contentrK�striprW�sectionrre�setr�os�path�existsrL�sourceparts_path�mkdir�open�chmod�sourceparts_mode�save)r�sourceslist�newentry�binentry�s�linesrR�srcentrys        r�_add_deb822_sourcez"ShortcutHandler._add_deb822_source�s���!��.�����#�#�D�$4�$4�5���	�A��a�!2�3��+�A�x�8����
	����!�3�4��8H�8H�8@�
�
�8G�G�
H�#���r�2�r�2�,0�,A�,A�'�C�H�%�^�^�H�N�$�M�M�H�M�&�o�o�H�O�%�^�^�H�N��(�(��1�1�<�<�>��BG�H�Q��Q�W�W�Y��C�8�H��H�04�t�y�y��7G�0G�� � ��-������$�"2�"2�#�h�n�n�:M�"M��H��'�'��(8�(8�9�H� �
��!�!�%6�7��/��8�<� �H��

��#��a�7�8�D�<L�<L�<D�M�M�<K�K�L�#'�"2�"2�D�4D�4D�!E����|�|��7�7�>�>�(�-�-�0��M�M�,�,�T�-B�-B�C��G�G�N�N�4�+@�+@�A��H�H�T�2�2�E�:��(�-�-��-�C��H�H�X�]�]�D�,A�,A�B�C�������/I�:C�C�s�L�+L�Lc�h�|jr|j�y|j|j�}|j|j�}|j
}t
�}t||�}|�.ttd�|j|jfz�nY|j|j|j|j|j|j��}|j |_|j|jk7r"ttd�|jz�n�|j"r<td�j|_ttd�|jz�ng|j r.ttd�|j|jfz�n-ttd�|j|jfz�|}|j|_t||�}|�.ttd�|j|jfz�nY|j|j|j|j|j|j��}|j |_|j|jk7r"ttd�|jz�ng|j r.ttd�|j|jfz�n-ttd�|j|jfz�|}|j$s�t'|j|jg�D]�}t(j*j-|�r�#|j/|j0�rIt(j*j-|j0�s t)j2|j0d	�t5|d
�5t)j6||�ddd���|j9�yy#1swY��xYw)aOAdd the apt SourceEntries.

        This uses SourcesList to add the binary-type and source-type
        SourceEntries.

        If the SourceEntry matches a known apt template, this will ignore
        the sourceparts_file and instead place the SourceEntries into
        the main/default sources.list file.  Otherwise, this will add
        the SourceEntries into the sourceparts_file.

        If either the binary-type or source-type entry exist in the current
        SourcesList, the existing entries are updated instead of placing
        the entries in the sourceparts_file.
        Nr{)r'rVr~rk�
orig_compsz+Updating existing entry instead of using %sr|z!Archive has template, updating %szAdding disabled %s entry to %szAdding %s entry to %sr�r�)rr�rrbrer�rr
rIrJrkr~rtr'rVrX�disabled�templaterr�r�r�r�rLr�r�r�r�r�)rr�r��moder�r��	entryfiles       rrqzShortcutHandler.add_source,s+���;�;��#�#�%���#�#�D�$4�$4�5���#�#�D�$4�$4�5���$�$��!�m��-�k�8�D�����!�3�4��
�
�x�}�}�7U�U�V�"����L�L��]�]��]�]��]�]�#�>�>�'��H�!)� 1� 1�H���=�=�H�M�M�)��!�A�B�X�]�]�R�S�
�
�
�'��O�0�0�H�M��!�7�8�8�=�=�H�I�
�
�
��!�4�5�����
�
�8V�V�W��!�+�,��
�
�x�}�}�/M�M�N���!�
�
��
�-�k�8�D�����!�3�4��
�
�x�}�}�7U�U�V�"����L�L��]�]��]�]��]�]�#�>�>�'��H�!)� 1� 1�H���=�=�H�M�M�)��!�A�B�X�]�]�R�S�
�
�
��!�4�5�����
�
�8V�V�W��!�+�,��
�
�x�}�}�/M�M�N����|�|� �(�-�-����!?�@�
2�	��w�w�~�~�i�0�!�,�,�T�-B�-B�C� "�����t�/D�/D� E�����!6�!6��>��i��-�2�����D�1�2�2�

2�
�����2�2�s�5P(�(P1	c�
�td��}|j|j�}|D]U}t|t�s�t||�s�!t
td�|jz�|}|j|�n|js\|j�|D�cgc]}|j|jk(s�|�� c}s!	tj|j�yyycc}w#ttf$rYywxYw)NTrzzRemoving entry from %s)rrrbr@rrrIrJr~rxrr�r��OSError�IOError)rr�r�r�s    r�_remove_deb822_sourcez%ShortcutHandler._remove_deb822_source�s���!��.���#�#�D�$4�$4�5���	�A��a�!2�3��+�A�x�8��a�0�1�Q�V�V�<�=����"�"�8�,��	��|�|�����*�F�!�a�f�f��
�
�.E�A�F���I�I�h�m�m�,�G���F�� ��)����s�"C+�C+�	C0�0D�Dc�
�|jr|j�yt�}t|D�cgc]}|j��c}�}|j|j�}|j|j�}d|_d|_|D]E}t||g|���ttd�|j|jfz�d|_�G|D�cgc]}|j|jk(s�|�� }}|D�cgc]}|jr�|jr�|�� c}sQ|D]L}|js-ttd�|j|jfz�|j|��N|j sR|j#�|t|D�cgc]}|j��c}�z
D]}	t%j|��yycc}wcc}wcc}wcc}w#t&t(f$rY�BwxYw)a~Remove the apt SourceEntries.

        This uses SourcesList to remove the binary-type and source-type
        SourceEntries.

        This must disable the corresponding SourceEntries, from whatever file(s)
        they are located in.  This must not disable more than matches, e.g.
        if the existing SourceEntry line contains more components this must
        edit the existing line to remove this SourceEntry's component(s).

        After disabling all matching SourceEntries, if the sourceparts_file is
        empty or contains only invalid and/or disabled SourceEntries, this
        may remove the sourceparts_file.
        NFzDisabling %s entry in %sTz"Removing disabled %s entry from %s)rr�rr�r~rrbrer�r
rIrJrkr��invalidrxrr�r�r�r�)	rr�rQ�
orig_filesr�r�r��file_entriesr~s	         rrvzShortcutHandler.remove_source�s����;�;��&�&�(��!�m���+�6�Q�!�&�&�6�7�
��#�#�D�$4�$4�5���#�#�D�$4�$4�5��!���!����	"�A�)�8�H�*=�q�A�M��a�2�3�q�v�v�q�v�v�6F�F�G�!��
�	"�
$/�R�a�!�&�&�D�<Q�<Q�2Q��R��R�'�L�a�q�y�y�����L�!�
&���y�y��!�@�A�Q�V�V�Q�V�V�DT�T�U��"�"�1�%�
&�
�|�|�����"�S�+�)F�Q�!�&�&�)F�%G�G�
����I�I�d�O�
���+7��S��L��*G�� ��)����s;�G�G!�<G!�G&�G&�%G&�#G+
�G0�0H�Hc�@�tjjd�S)zAReturn result of apt_pkg.config.find_dir("Dir::Etc::sourceparts")zDir::Etc::sourceparts��apt_pkg�config�find_dirrYs rr�z ShortcutHandler.sourceparts_path�s���~�~�&�&�'>�?�?r!c�\�|jrdnd}|j||j��S)aiGet the sources.list.d filename, without the leading path.

        By default, this combines the filebase with the codename, and uses a
        extension of 'list' if deb822 is not enabled, and 'sources' if deb822
        is enabled.  This is different than the trustedparts or
        netrcparts filenames, which use only the filebase plus extension.
        �sources�list��suffix)r�_filebase_to_filenamer)r�exts  r�sourceparts_filenamez$ShortcutHandler.sourceparts_filename�s+�� �;�;�i�F���)�)�#�d�m�m�)�D�Dr!c�N�|j|j|j�S)a�Get the sources.list.d absolute-path filename.

        Note that the add_source() function will not use this file if this shortcut's
        SourceEntry matches a known apt template; instead the entries will be placed
        in the main sources.list file.  Also, if the SourceEntry already exists in
        the SourcesList, it will be edited in place, instead of using this file.
        See add_source() for more details.
        )�_filename_to_filer�r�rYs rr�z ShortcutHandler.sourceparts_file�s#���%�%�d�&;�&;�T�=V�=V�W�Wr!c��y)z�Mode of sourceparts file.

        Note that add_source() will only use this mode if it creates a new file
        for sourceparts_file; if the file already exists or if the SourceEntry is
        saved in a different file, this mode is not used.
        ��rYs rr�z ShortcutHandler.sourceparts_mode�s��r!c��|jryt|j|jf�sy|j}|j}t	|t
�s|j
�}|j|�}ttd�|dj|�fz�t|z}d}|j�stjj|�s�|j!|j"�rJtjj|j"�s!tj$|j"d��|j&r5t)|d�5tj*||j&�ddd�	t-j.�5}|d|�d	|��z
}t1j2|j5�d
|��ddd�yy#1swY�ZxYw#1swYyxYw#t0j6$r}t9|��d}~wwxYw)a[Add the GPG key(s) corresponding to this repo.

        By default, if self.trustedparts_content contains content,
        and self.trustedparts_file points to a file, the key(s) will
        be added to the file.

        If the file does not yet exist, and self.trustedparts_mode is set,
        the file will be created with that mode.
        Nz$Adding key to %s with fingerprint %srUz--importr��r��wbr8rT)r9r:)r�all�trustedparts_filer�r@rArBrSrIrJrW�GPG_KEYRING_CMDrr�r�r�rL�trustedparts_pathr��trustedparts_moder�r�r>r?rCrDrErH�ShortcutException)r�destrN�fprO�actionrPrQs        rrrzShortcutHandler.add_key�s����;�;���D�*�*�D�,E�,E�F�G���%�%���(�(���$��&��;�;�=�D�
�
�
�t�
$��
�a�6�7�4����"��:N�N�O���$�����|�|��7�7�>�>�$�'��O�O�D�$:�$:�;��G�G�N�N�4�+A�+A�B��H�H�T�3�3�%�@��)�)��d�D�)�?�����t�'=�'=�>�?�
+��0�0�2�H�g��[��	��6�(�;�;�C��N�N�3�9�9�;�d�$�G�H�H��?�?��H�H���0�0�
+�'��*�*��
+�sB�!G�?G'�2G�G'�G�G$� G'�$G'�'H
�:H�H
c�,�t|j|jf�sy|j}|j|j�}tj
j
|�syttd�|dj|�fz�t|z}ddj|�z}|js�	tj�5}|d|�d|��z
}tj|j!�d��ddd�t'|d	�5}|j|j)��}ddd�rt	j*|�yyy#1swY�XxYw#tj"$r}t%|��d}~wwxYw#1swY�UxYw)
a�Remove the GPG key(s) corresponding to this repo.

        By default, if self.trustedparts_content contains content,
        and self.trustedparts_file points to a file, the key(s) will
        be removed from the file.

        If the file contains no more keys after removal, the file will
        be removed.

        This does not consider other files; multiple repositories may
        use the same signing key.  This only modifies/removes
        self.trustedparts_file.
        Nz(Removing key from %s with fingerprint %srUz--delete-keys %srr8T)r9�rb)r�r�r�rSr�r�r�rIrJrWr�rr>r?rCrDrErHr�r��readrx)	rr�r�rOr�rPrQ�f�emptys	         r�
remove_keyzShortcutHandler.remove_keys`���D�*�*�D�,E�,E�F�G���%�%��
�
�
�t�8�8�
9���w�w�~�~�d�#��
�a�:�;�t�S�X�X�b�\�>R�R�S���$��#�c�h�h�r�l�2���|�|�
+��0�0�2�<�g��[��	��6�(�;�;�C��N�N�3�9�9�;�d�;�<��d�D�!�
8�Q� �-�-�a�f�f�h�7�7��
8���	�	�$����<�<���0�0�
+�'��*�*��
+��
8�
8�s<�<E$�1E�E$�!F
�E!�E$�$F�7F�F�
Fc�@�tjjd�S)zBReturn result of apt_pkg.config.find_dir("Dir::Etc::trustedparts")zDir::Etc::trustedpartsr�rYs rr�z!ShortcutHandler.trustedparts_pathGs���~�~�&�&�'?�@�@r!c�$�|jd�S)z9Get the trusted.gpg.d filename, without the leading path.�gpg�r�rYs r�trustedparts_filenamez%ShortcutHandler.trustedparts_filenameLs���)�)�%�0�0r!c�N�|j|j|j�S)z-Get the trusted.gpg.d absolute-path filename.)r�r�r�rYs rr�z!ShortcutHandler.trustedparts_fileQs#���%�%�d�&<�&<�d�>X�>X�Y�Yr!c��y)z&Content to put into trusted.gpg.d fileNr�rYs rr�z$ShortcutHandler.trustedparts_contentVs��r!c��y)zMode of trustedparts filer�r�rYs rr�z!ShortcutHandler.trustedparts_mode[���r!c��t|j|jf�sy|j}|j}tjj|�}d}|s�t
|d�5}|j�D�cgc]}|j���}}ddd�tt�5dd}ddd�t|j�D�cgc]}|j�v��c}�rttd�|z�yttd�|z�|js�|r�|j|j �rJtjj|j �s!tj"|j d��|j$r5t
|d	�5tj&||j$�ddd�t
|d
�5}|dk7r|j)d�|j)|j�ddd�yycc}w#1swY���xYw#1swY��~xYwcc}w#1swY�uxYw#1swYyxYw)z�Add the login credentials corresponding to this repo.

        By default, if self.netrcparts_content contains content,
        and self.netrcparts_file points to a file, the file will be
        created and content placed into it.
        Nr��r���z!Authentication data already in %sz Adding authentication data to %sr�r�r��a)r��netrcparts_file�netrcparts_contentr�r�r�r��	readlinesr�rrMrKrIrJrrL�netrcparts_pathr��netrcparts_moder��write)rr��content�newfile�	finalcharr�rRr�s        rrszShortcutHandler.add_login`s����D�(�(�$�*A�*A�B�C���#�#���)�)���g�g�n�n�T�*�*���	���d�C��
;�A�,-�K�K�M�:�q�����:��:�
;��(�#�
*�!�"�I�b�M�	�
*���0B�0B�0D�E�1�A�G�G�I��&�E�F��a�;�<�t�C�D��
�a�2�3�d�:�;��|�|���O�O�D�$8�$8�9��G�G�N�N�4�+?�+?�@��H�H�T�1�1��>��'�'��d�C��=�����t�';�';�<�=��d�C��
1�A���$��G�G�D�M�����/�/�0�	
1�
1���;�
;�
;��
*�
*��E�=�=��
1�
1�sH�+H&�>H!�H&�.	H3�I�0!I�%2I�!H&�&H0�3H=�I�Ic��t|j|jf�sy|j}t|jj	�D�cgc]}|j���c}�}tjj|�syt|d�5}t|j�D�cgc]}|j���c}�}ddd�|zsttd�|z�n[ttd�|z�|js8t|d�5}|jdj||z
��ddd�|jsMt|d�5}|j!�j�}ddd�rt
j"|�yyycc}wcc}w#1swY��xYw#1swY�yxYw#1swY�ExYw)a�Remove the login credentials corresponding to this repo.

        By default, if self.netrcparts_content contains content,
        and self.netrcparts_file points to a file, the content will
        be removed from the file.

        If the file is empty (other than whitespace) after removal, the file
        will be removed.

        This does not consider other files; this only modifies/removes
        self.netrcparts_file.
        Nr�z'Authentication data not contained in %sz$Removing authentication data from %sr�r�)r�r�r�r�rKr�r�r�r�r�r�rIrJrr�rWr�rx)rr�rRr�r��filecontentr�s       rrwzShortcutHandler.remove_login�s~���D�(�(�$�*A�*A�B�C���#�#���$�*A�*A�*L�*L�*N�O�Q�q�w�w�y�O�P���w�w�~�~�d�#��
�$��_�	B���!�+�+�-�@�Q�q�w�w�y�@�A�K�	B��W�$��!�=�>��E�F��!�:�;�d�B�C��<�<��$��_�>���G�G�D�I�I�k�G�&;�<�=�>��|�|��d�C��
-�A��F�F�H�N�N�,�,��
-���	�	�$�����P��A�	B�	B��>�>��
-�
-�s<�F*�F4�2F/
�	F4�$$G�( G�/F4�4F=�G	�Gc�@�tjjd�S)z@Return result of apt_pkg.config.find_dir("Dir::Etc::netrcparts")zDir::Etc::netrcpartsr�rYs rr�zShortcutHandler.netrcparts_path�s���~�~�&�&�'=�>�>r!c�$�|jd�S)z7Get the auth.conf.d filename, without the leading path.�confr�rYs r�netrcparts_filenamez#ShortcutHandler.netrcparts_filename�s���)�)�&�1�1r!c�N�|j|j|j�S)z+Get the auth.conf.d absolute-path filename.)r�r�r�rYs rr�zShortcutHandler.netrcparts_file�s#���%�%�d�&:�&:�D�<T�<T�U�Ur!c�<�t|j|jf�syt|j	�j
�j}t|j	�j
�j}d|�|�d|j�d|j��S)z�Content to put into auth.conf.d file

        By default, if both username and password are set, this will return a proper
        netrc-formatted line with the authentication information, including the
        hostname and path.
        Nzmachine z login z
 password )r�r4r5r	rr'�hostnamer�)rr�r�s   rr�z"ShortcutHandler.netrcparts_content�s���D�M�M�4�=�=�1�2���D�,�,�.�2�2�3�<�<����(�(�*�.�.�/�4�4���(��D�6������z�$�-�-��Y�Yr!c��y)zMode of netrcparts filei�r�rYs rr�zShortcutHandler.netrcparts_mode�r�r!c��|jrt||j��}nt||j��}t	t|j�t|j�z�|_t|�|_	y)z�Set the SourceEntry.

        This should be called from subclasses to set the SourceEntry.
        The SourceEntry file will be set to the sourceparts_file value.

        The self.components, if any, will be added to the line's component(s).
        r}N)
rrr�rr�r�rXrrr)r�linerQs   r�_set_source_entryz!ShortcutHandler._set_source_entry�s^���;�;�!�$�T�-B�-B�C�A��D�t�'<�'<�=�A��s�1�7�7�|�c�$�/�/�&:�:�;���.�q�1��r!c�~�|j}|sy|r|d|zz
}tjdd|j��S)Nz-%sz[^a-z0-9_-]+rJ)r�re�sub�lower)rr��bases   r�_encode_filebasez ShortcutHandler._encode_filebase�s;���~�~������E�F�N�"�D��v�v�n�c�4�:�:�<�8�8r!c�:�|j|��}|sy|�d|��S)Nr�r�)r�)rr�r�r�s    rr�z%ShortcutHandler._filebase_to_filename�s&���$�$�F�$�3������$�$r!c�H�|sytjj||�Sr)r�r�rW)rr��names   rr�z!ShortcutHandler._filename_to_file�s�����w�w�|�|�D�$�'�'r!)NFNNFFr)0�__name__�
__module__�__qualname__�__doc__r �classmethodr)r1r6rS�propertyrZr]r\rVrbrerr4r5rtrxr�rqr�rvr�r�r�r�rrr�r�r�r�r�r�rsrwr�r�r�r�r�r�r�r�r�r�r!rrr+s���
�AF�CH��(�/��/�
�Q��Q��7��7�����6�9��9�
�!��!��&��&�����
�'��'��'��'�'$�R�	��	��	��	�	�	�9�vX�t�,/�b�@��@��	E��	E��	X��	X�����)+�V& �P�A��A��1��1��Z��Z���������&1�P$ �L�?��?��2��2��V��V��Z��Z�����2� 9�%�(r!rc��eZdZdZy)r�z-General Exception during shortcut processing.N�r�r�r�r�r�r!rr�r��s��7�r!r�c��eZdZdZy)�InvalidShortcutExceptionz�Invalid shortcut.

    This should only be thrown from the constructor of a ShortcutHandler
    subclass, and only to indicate that the provided shortcut is invalid
    for that ShortcutHandler class.
    Nrr�r!rrr�s���	r!r)r�r�r�rCr>�aptsources.distror�aptsources.sourceslistrrr�
contextlibrrrJ�urllib.parser	�softwareproperties.sourceutilsr
rr�initr��objectr�	Exceptionr�rr�r!r�<module>rsn��$�	�	���(�P�P�� �!�J�J�

�����Q��G(�f�G(�T	�	�	�
	�0�	r!

Zerion Mini Shell 1.0