%PDF- %PDF-
Mini Shell

Mini Shell

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

�

;�ff��"�ddlZddlmZddlZddlmZddlZejdd�ejdd�ddlm	Z	m
Z
mZmZddl
Z
ddlZddlZddlZej"e�ZddlZd	Zd
�Zd�Zd�Zd
�Zd�Zd�Zdd�Zdd�Zd�Zy)�N)�datetime��wraps�Gtkz3.0�Handy�1)�Gior�GLibrz%/var/lib/ubuntu-advantage/status.jsonc���tj�|_|jj|�|jj	|�|jj|�|jj
�D]j}tt|�tj�r-tjj|�}t|||��Stjd|z��ly)Nz can not get name for object '%s')r�Builder�builder�set_translation_domain�
add_from_file�connect_signals�get_objects�
issubclass�type�	Buildable�get_name�setattr�logging�debug)�self�path�domain�o�names     �>/usr/lib/python3/dist-packages/softwareproperties/gtk/utils.py�setup_uir&s����;�;�=�D�L��L�L�'�'��/��L�L���t�$��L�L� � ��&�
�\�\�
%�
%�
'�B���d�1�g�s�}�}�-��=�=�)�)�!�,�D��D�$��"��M�M�<�q�@�A�B�c�j�	tjjd�}|dk7S#t$rYywxYw)Nz#gnome-online-accounts-panel.desktopF)r	�DesktopAppInfo�new�	Exception)�ds r�has_gnome_online_accountsr&3s:������"�"�#H�I���D�y�������s�#&�	2�2c��tjj�}tj�}|j|j�S�N)�
aptsources�distro�
get_distro�distro_info�UbuntuDistroInfo�is_lts�codename�r*�dis  r�is_current_distro_ltsr2:s7��
�
�
�
)�
)�
+�F�	�	%�	%�	'�B�
�9�9�V�_�_�%�%r c���tjj�}tj�}|j
|j
tj�j��vSr()
r)r*r+r,r-r/�	supportedr�now�dater0s  r�is_current_distro_supportedr7?sK��
�
�
�
)�
)�
+�F�	�	%�	%�	'�B��?�?�b�l�l�8�<�<�>�+>�+>�+@�A�A�Ar c���tjj�}tj�}|jd��}|D]}|j|jk(s�|cSy)N�object)�result)r)r*r+r,r-�get_all�seriesr/)r*r1�releases�releases    r�current_distror?DsX��
�
�
�
)�
)�
+�F�	�	%�	%�	'�B��z�z��z�*�H�����>�>�V�_�_�,��N�r c��d}tjjt�r)t	t�5}|j�}ddd�n]	t
jgd�tj��}|jdk7rtd|jz�iS|j}|s
td�iS	tj|�}|j!d
d�dk7rtd|d
z�|S#1swY�VxYw#t$r}td|z�icYd}~Sd}~wwxYw#tj$r}td	|z�icYd}~Sd}~wwxYw)
zBReturn a dict of all UA status information or empty dict on error.�N)�pro�statusz
--format=json)�stdoutzFailed to run `pro status`:
%srz"Ubuntu Pro client returned code %dzKWarning: no Ubuntu Pro Client status found. Is ubuntu-pro-client installed?z0Failed to parse ubuntu advantage client JSON:
%s�_schema_versionz0.1z$Pro status schema version change: %s)�osr�exists�UA_STATUS_JSON�open�read�
subprocess�run�PIPEr$�print�
returncoderD�json�loads�JSONDecodeError�get)�status_json�streamr:�erCs     r�
get_ua_statusrWMsF���K�	�w�w�~�~�n�%�
�.�
!�	(�V� �+�+�-�K�	(�	(�	��^�^�2�:�?�?��F�����!��4�v�7H�7H�H�
��I��m�m���
�
/�	
��	�����K�(���z�z�#�U�+�u�4�
�2�V�<M�5N�N�	
��M�A	(�	(���	��3�a�7�8��I��	��"����
�A�A�E�F��	���sG�C9�'D�<D+�9D�	D(�D#�D(�#D(�+E�>E�
E�Ec��|s
t�}d}d}|jdg�D]6}|jd�|k7r�d|vrtd|dk(�}d|vs�2|d}�8||fS)akGet service availability and status for a specific UA service.

    Return a tuple (available, service_status).
      :boolean available: set True when either:
        - attached contract is entitled to the service
        - unattached machine reports service "availability" as "yes"
      :str service_status: will be one of the following:
        - "disabled" when the service is available and applicable but not
          active
        - "enabled" when the service is available and active
        - "n/a" when the service is not applicable to the environment or not
          entitled for the attached contract
    Fzn/a�servicesr�	available�yesrC)rWrS�bool)�service_namerCrZ�service_status�services     r�get_ua_service_statusr`zs��������I��N��:�:�j�"�-�/���;�;�v��,�.���'�!��U�g�k�&:�:�;�I��w��$�X�.�N�
/�
�~�&�&r c����������fd�}|S)a�
    Retry calling the decorated function using an exponential backoff.

    Args:
        exceptions: The exception to check. may be a tuple of
            exceptions to check.
        tries: Number of times to try (not retry) before giving up.
        delay: Initial delay between retries in seconds.
        backoff: Backoff multiplier (e.g. value of 2 will double the delay
            each retry).
    c�8���t�������fd��}|S)Nc����
�}}|dkDr		�	|i|��S�	|i|��S#�$rP}dj||�}tj|�tj|�|dz}|�z}Yd}~nd}~wwxYw|dkDr�o�g)N�z{}, Retrying in {} seconds...)�formatr�warning�time�sleep)�args�kwargs�mtries�mdelayrV�msg�backoff�delay�
exceptions�f�triess      �����r�f_retryz*retry.<locals>.deco_retry.<locals>.f_retry�s����"�E�F�F��1�*�&��d�-�f�-�-��d�%�f�%�%��
"�&�9�@�@��F�K�C��O�O�C�(��J�J�v�&��a�K�F��g�%�F��&���1�*�s��A1�AA,�,A1r)rqrsrnrorprrs` ����r�
deco_retryzretry.<locals>.deco_retry�s ���	�q��	&�
�	&��r �)rprrrornrts```` r�retryrv�s����$�r c��tjd�}|dk7rtj|d�Stjj�j
�S)N�	GTK_THEME�dark)r
�getenv�str_has_suffixr�StyleManager�get_default�get_dark)�widget�
env_gtk_themes  r�
is_dark_themer��sI���K�K��,�M�����"�"�=�&�9�9����)�)�+�4�4�6�6r )z	esm-infraN)�
g�������?�)�aptsources.distror)rr,�	functoolsr�gi�require_version�
gi.repositoryr	rr
rrPrFrKr�	getLogger�__name__�LOGrgrHrr&r2r7r?rWr`rvr�rur r�<module>r�s���&����	�����5�%� �����7�C� �/�/��	����G���h����8��B��&�
B�
�*�Z'�:�@7r 

Zerion Mini Shell 1.0