MOON
Server: Apache
System: Linux s5.yayogua.com.py 6.12.0-124.55.3.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:54:02 EDT 2026 x86_64
User: sanbercountryclu (1012)
PHP: 8.2.33
Disabled: NONE
Upload Files
File: //lib/python3.12/site-packages/tuned/exports/__pycache__/dbus_exporter.cpython-312.opt-1.pyc
�

�]�i���>�ddlmZddlZddlZddlZddlZddlZddlZ	ddl
mZddlZddl
Z
ddlmZddlmZddlmZddlmZddlmZdd	lmZ	dd
lmZd�Ze	j8j;�Zd
�ZGd�dej@�Z!y#e$r	ddlmZY�@wxYw)�)�
interfaces�N)�ismethod)�polkit)�GLib)�FunctionType)�
DBusException)�ErrorMessage��getfullargspecc��t|�S�Nr)�funcs �@/usr/lib/python3.12/site-packages/tuned/exports/dbus_exporter.py�
getargspecrs
��	��	��)rc��t|dd�}|�nOt|dd�dvrd|jjz}n&d|j�d|jj��}t	|t
�r|j
�}n/djtj|j|��}t|||�}|j�s|j|�yy)N�_dbus_error_name�
__module__�)r�__main__zorg.freedesktop.DBus.Python.%szorg.freedesktop.DBus.Python.�.)
�getattr�	__class__�__name__r�
isinstancer	�get_dbus_message�join�	traceback�format_exception_onlyr
�get_no_reply�send_message)�
connection�message�	exception�name�contents�replys      r�_method_reply_errorr)$s����9�0�$�7�D����	��L�"�	-�1A�	A�/�)�2E�2E�2N�2N�N��
B�7@�6J�6J�I�L_�L_�Lh�Lh�i���)�]�+��-�-�/���7�7�9�:�:�9�;N�;N�������$��1�E����!�����&�"rc��eZdZdZd�Zed��Zed��Zed��Zd�Z	d�Z
d�Zdd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zy	)�DBusExportera+
	Export method calls through DBus Interface.

	We take a method to be exported and create a simple wrapper function
	to call it. This is required as we need the original function to be
	bound to the original object instance. While the wrapper will be bound
	to an object we dynamically construct.
	c�N�tj�tjk7rtt
j_t
jjjd��d|_
d|_i|_t�|_||_||_||_||_d|_d|_t+�|_t/j0t.j2�}t5j6�|_t/j.t.j2|�y)NT)�set_as_default)�log�getEffectiveLevel�logging�DEBUGr)�dbus�service�mainloop�glib�
DBusGMainLoop�_dbus_object_cls�_dbus_object�
_dbus_methods�set�_signals�	_bus_name�_interface_name�_object_name�
_namespace�_thread�_bus_objectr�_polkit�signal�	getsignal�SIGINTr�MainLoop�
_main_loop)�self�bus_name�interface_name�object_name�	namespace�signal_handlers      r�__init__zDBusExporter.__init__Bs���	�����
�
�-�&9�4�<�<�#��-�-���"�"�$�"�7��$���$���$���%�$�-��$�.�'�$��!�$���$�/��$�,��$����$�,��#�#�F�M�M�2�.��M�M�O�$�/��-�-��
�
�~�.rc��|jSr)r<�rHs rrIzDBusExporter.bus_name`s��	
���rc��|jSr)r=rPs rrJzDBusExporter.interface_nameds��	
�	�	�rc��|jSr)r>rPs rrKzDBusExporter.object_namehs��	
�	�	�rc��|jduSr)r@rPs r�runningzDBusExporter.runningls��	
���T�	!�!rc�6�dj|jdjt|j�j
���}t
|dt|j�zd�}t|jdt�|j�}|S)Nz2def {name}({args}):
					return wrapper({args})
		z, )r&�argsz<decorator-gen-%d>�execr)�formatrrr�__func__rV�compile�lenr9r�	co_consts�locals)rH�method�wrapper�source�coders      r�_prepare_for_dbuszDBusExporter._prepare_for_dbusos{����f�&�/�/��	�	�*�V�_�_�2M�2R�2R�(S�f�T�	�
��-��D�4F�4F�0G�G��	P�$�
�d�n�n�Q�'���6�?�?�	C�$�	
�+rc�d�|jdz|z}|d}tjd|�d|�d��|jj	||�}|}|dk(rtjd|�d|�d��|S|d	k(rtjd
|�d|�d��|S|dk(r0tj
d|�d|�d
��t|dd�dgz}|S|dk(r0tjd|�d|�d��t|dd�dgz}|Stjd|�d|�d��t|dd�dgz}|S)Nr���z#checking authorization for action 'z' requested by caller '�'rzaction 'z'' was successfully authorized by polkit�zpolkit error, but action 'z0' was successfully authorized by fallback methodrz)' wasn't authorized, ignoring the requestrzpolkit error and action 'z<' wasn't authorized by fallback method, ignoring the requestzDpolkit error and unable to use fallback method to authorize action 'z', ignoring the request)	r?r.�debugrB�check_authorization�warning�info�list�error)rH�action_namerV�	action_id�caller�ret�	args_copys       r�_polkit_authzDBusExporter._polkit_auth}sa���o�o��#�k�1�)���8�&��)�)�QZ�\b�c�d����(�(���;�#��)��A�X��9�9�]f�hn�
o�p�
���a�x��;�;�{D�FL�M�N�
���a�x��8�8�^g�io�p�q��D��"�I��"��%�9�
��
�b�y��;�;�FO�QW�X�Y��D��"�I��"��%�9�
���9�9�JS�U[�\�]��D��"�I��"��%�9�	�rNc�@����t��std���j}|�jvrtd���xs|����fd�}�j	�|�}tjj�j||d��|�}|�j|<y)N�#Only bound methods can be exported.�*Method with this name is already exported.c�6����j�g|���i|��Sr)rr)�ownerrV�kwargsrmr^rHs   ���r�auth_wrapperz)DBusExporter.export.<locals>.auth_wrapper�s&���
�#�$�#�#�K�7�$�7�
B�6�
B�Brro)�sender_keyword)	r�	Exceptionrr9rbr2r3r^r=)rHr^�in_signature�
out_signaturerm�method_nameryr_s``  `   r�exportzDBusExporter.export�s����	�&�	�	�8�	9�9����+��D�&�&�&�	�?�	@�@��*�{�+�C�
�"�"�6�<�8�'��L�L���� 4� 4�l�M�dl��m�nu�v�'�$+�$���[�!rc�\��t��std���j}||jvrtd���fd�}|j	�|�}tjj|j|�|�}||j|<|jj|�y)Nrtruc����|i|��Sr�)rwrVrxr^s   �rr_z$DBusExporter.signal.<locals>.wrapper�s���
�$�
!�&�
!�!r)rr{rr9rbr2r3rCr=r;�add)rHr^r}r~r_s `   rrCzDBusExporter.signal�s����	�&�	�	�8�	9�9����+��D�&�&�&�	�?�	@�@�"�
�"�"�6�7�3�'��L�L���� 4� 4�m�D�W�M�'�$+�$���[�!��-�-���K� rc��d}||jvs|j�d}	t|j|�}|rt	d|z��|i|��y#t$rd}Y�&wxYw)NFTzSignal '%s' doesn't exist.)r;rAr�AttributeErrorr{)rHrCrVrx�errr^s      r�send_signalzDBusExporter.send_signal�ss��
�#�	�4�=�=�	 �D�$4�$4�$<�	
�3���D�$�$�f�-�6�	�	�/�&�8�	9�9�	�4��6���
��	
�3��s�A�A�Ac��|j�td��dt|�z}t|tj
jf|j�}||_y)Nz%The exporter class was already build.zDBusExporter_%d)r7r{�id�typer2r3�Objectr9)rH�unique_name�clss   r�_construct_dbus_object_classz)DBusExporter._construct_dbus_object_class�sQ��	���&�	�:�	;�;�!�B�t�H�,�+��[�4�<�<�.�.�0�$�2D�2D�E�#��$�rc��|j�ry|j�|j�|j�t	j
�}tjj|j|�}|j||j|�|_
tj|j��|_|jj�y)N)�target)rTr7r��stopr2�	SystemBusr3�BusNamer<r>rA�	threading�Thread�_thread_coder@�start)rH�busrIs   rr�zDBusExporter.start�s���	�\�\�^�	�	���"��$�$�&��)�)�+�����#�
�\�\�
!�
!�$�.�.�#�
6�(��*�*�3��0A�0A�8�L�$���!�!��):�):�;�$�,��,�,���rc���|j�W|jj�r<|jj�|jj	�d|_yyyr)r@�is_aliverG�quitrrPs rr�zDBusExporter.stop�sJ��	�\�\��$�,�,�"7�"7�"9��?�?�����<�<�����4�<�#:�rc�J�|jj�|`d|_yr)rG�runrArPs rr�zDBusExporter._thread_code�s ���/�/����
���$�rr)rr�__qualname__�__doc__rN�propertyrIrJrKrTrbrrrrCr�r�r�r�r�r�rrr+r+8sz���/�<������������"���*,�"!�"����rr+)"rr�dbus.servicer2�dbus.mainloop.glib�dbus.exceptionsr�rC�
tuned.logs�tuned�tuned.consts�constsrr0�inspectr�tuned.utils.polkitr�
gi.repositoryr�typesrr	�
dbus.lowlevelr
rr�ImportError�logs�getr.r)�ExporterInterfacer+r�rr�<module>r�s��������
������%���)�&�
 �$���j�j�n�n���
'�(h�:�/�/�h��=� �� �s�	B�B�B