%PDF- %PDF-
Mini Shell

Mini Shell

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

�

@iasD���dZdZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZddlmZddlmZddl m!Z!ddl"m#Z#d	e�d
e�de�d�Z$	d
Z%ejLd�Z'Gd�de(�Z)Gd�de�Z*y))�
BusConnection�reStructuredText�N)�BUS_DAEMON_IFACE�BUS_DAEMON_NAME�BUS_DAEMON_PATH�BUS_SESSION�BUS_STARTER�
BUS_SYSTEM� DBUS_START_REPLY_ALREADY_RUNNING�DBUS_START_REPLY_SUCCESS�NAME_FLAG_ALLOW_REPLACEMENT�NAME_FLAG_DO_NOT_QUEUE�NAME_FLAG_REPLACE_EXISTING�RELEASE_NAME_REPLY_NON_EXISTENT�RELEASE_NAME_REPLY_NOT_OWNER�RELEASE_NAME_REPLY_RELEASED� REQUEST_NAME_REPLY_ALREADY_OWNER�REQUEST_NAME_REPLY_EXISTS�REQUEST_NAME_REPLY_IN_QUEUE� REQUEST_NAME_REPLY_PRIMARY_OWNER�validate_bus_name�validate_error_name�validate_interface_name�validate_member_name�validate_object_path)�
Connection)�
DBusException)�HANDLER_RESULT_NOT_YET_HANDLED)�is_py2ztype='signal',sender='z
',interface='z"',member='NameOwnerChanged',path='z',arg0='%s'z)org.freedesktop.DBus.Error.NameHasNoOwnerzdbus.busc��eZdZdZd�Zd�Zy)�NameOwnerWatch)�_match�
_pending_callc
�����t���fd�}��fd�}|j|dttt���|_|j
tttdd�f�|�|_y)Nc����|�y�N�)�owned�	old_owner�	new_owner�callbacks   ��*/usr/lib/python3/dist-packages/dbus/bus.py�	signal_cbz*NameOwnerWatch.__init__.<locals>.signal_cbBs����Y��c���|j�tk(r	�d�ytj�tjd�|j|df��y)N�zGetNameOwner(%s) failed:)�exc_info)�
get_dbus_name�_NAME_HAS_NO_OWNER�logging�basicConfig�_logger�debug�	__class__)�e�bus_namer+s ��r,�error_cbz)NameOwnerWatch.__init__.<locals>.error_cbEsJ������ �$6�6�����#�#�%��
�
�8�(�()���Q��'=��?r.�NameOwnerChanged)�arg0�GetNameOwner�s)r�add_signal_receiverrrrr"�
call_asyncr#)�self�bus_connr:r+r-r;s  ``  r,�__init__zNameOwnerWatch.__init__?sm����(�#�	 �	?��2�2�9�3E�3C�3B�3B�8@�3�B���&�0�0��1@�1A�1?�14�x�k�19�8�E��r.c��|j�|jj�|j�|jj�d|_d|_yr&)r"�remover#�cancel�rBs r,rGzNameOwnerWatch.cancelZsI���;�;�"��K�K��� ����)����%�%�'����!��r.N)�__name__�
__module__�__qualname__�	__slots__rDrGr'r.r,r!r!<s��+�I�E�6"r.r!c���eZdZdZeZ	eZ	eZ		e
ZeZ
edfd�Z			d�fd�	Zd�Zd�Z		dd�Zd�Zdd	�Zdd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z�xZ S)rzxA connection to a D-Bus daemon that implements the
    ``org.freedesktop.DBus`` pseudo-service.

    :Since: 0.81.0
    Nc�n�|j||��}tj�|_i|_	|S)N)�mainloop)�_new_for_bus�weakref�WeakValueDictionary�
_bus_names�_signal_sender_matches)�cls�address_or_typerO�buss    r,�__new__zBusConnection.__new__ws9��������B��!�4�4�6���%'��"�5��
r.c�j���|jdd�}|�$|�td��|}ddlm}|dtd��tt|�|||||fi|���|�D|tk7r;|ddd	k(r�fd
�}	n�j}	|j||	�}
|
|j�<|jt����S)N�
named_service�3bus_name and named_service cannot both be specifiedr��warnzrPassing the named_service parameter to add_signal_receiver by name is deprecated: please use positional parameters���
stacklevel��:c�2��|dk(r�j�yy)Nr0)rF)r*�matchs �r,r+z3BusConnection.add_signal_receiver.<locals>.callback�s��� �B������'r.)�pop�	TypeError�warningsr]�DeprecationWarning�superrr@r�set_sender_name_owner�watch_name_ownerrT�add_match_string�str)
rB�handler_function�signal_name�dbus_interfacer:�path�keywordsrZr]r+�watchrdr8s
           @�r,r@z!BusConnection.add_signal_receiver�s����!���_�d�;�
��$��#��!,�-�-�$�H�%��K�#��
3��m�T�>� �+�~�x��"� �"��
� �X��%@����|�s�"�'�!�6�6���)�)�(�H�=�E�16�D�'�'��.����c�%�j�)��r.c��|jt|��|jj|d�}|�|j	�yyr&)� remove_match_string_non_blockingrmrTrerG)rBrdrss   r,�_clean_up_signal_matchz$BusConnection._clean_up_signal_match�s@���-�-�c�%�j�9��+�+�/�/��t�<�����L�L�N�r.c���|�#|dddk7r|tk7r	|j|�S|S#t$rD}|j�tk7r�|j|�|j|�cYd}~Sd}~wwxYw)Nrarb)r�get_name_ownerrr2r3�start_service_by_name)rBr:r9s   r,�activate_name_ownerz!BusConnection.activate_name_owner�s~��� �X�b�q�\�S�%8��O�+�
5��*�*�8�4�4��O��!�
5��?�?�$�(:�:���*�*�8�4��*�*�8�4�4��
5�s�(�	A5�9A0�*A5�0A5c��|r|j�|jdd�}|�$|�td��ddlm}|dt
d��|}|r+td	d
j
|j��z��|j|||||��S)aJReturn a local proxy for the given remote object.

        Method calls on the proxy are translated into method calls on the
        remote object.

        :Parameters:
            `bus_name` : str
                A bus name (either the unique name or a well-known name)
                of the application owning the object. The keyword argument
                named_service is a deprecated alias for this.
            `object_path` : str
                The object path of the desired object
            `introspect` : bool
                If true (default), attempt to introspect the remote
                object to find out supported methods and their signatures
            `follow_name_owner_changes` : bool
                If the object path is a well-known name and this parameter
                is false (default), resolve the well-known name to the unique
                name of its current owner and bind to that instead; if the
                ownership of the well-known name changes in future,
                keep communicating with the original owner.
                This is necessary if the D-Bus API used is stateful.

                If the object path is a well-known name and this parameter
                is true, whenever the well-known name changes ownership in
                future, bind to the new owner, if any.

                If the given object path is a unique name, this parameter
                has no effect.

        :Returns: a `dbus.proxies.ProxyObject`
        :Raises `DBusException`: if resolving the well-known name to a
            unique name fails
        rZNr[rr\ziPassing the named_service parameter to get_object by name is deprecated: please use positional parametersr^r_z4get_object does not take these keyword arguments: %sz, )�
introspect�follow_name_owner_changes)	�_require_main_looprerfrgr]rh�join�keys�ProxyObjectClass)rBr:�object_pathr|r}�kwargsrZr]s        r,�
get_objectzBusConnection.get_object�s���H%��#�#�%��
�
�?�D�9�
��$��#��!/�0�0�%��C�#��
3�%�H���,�.2�i�i����
�.F�G�H�
H��$�$�T�8�[�0:�?X�%�Z�	Zr.c�^�t|�|jtttdd|f�S)z�Get the numeric uid of the process owning the given bus name.

        :Parameters:
            `bus_name` : str
                A bus name, either unique or well-known
        :Returns: a `dbus.UInt32`
        :Since: 0.80.0
        �GetConnectionUnixUserr?�r�
call_blockingrrr�rBr:s  r,�
get_unix_userzBusConnection.get_unix_user�s0��	�(�#��!�!�/�?�"2�4K�"%��{�4�	4r.c
�d�t|�d|jtttdd||f�fS)a?Start a service which will implement the given bus name on this Bus.

        :Parameters:
            `bus_name` : str
                The well-known bus name to be activated.
            `flags` : dbus.UInt32
                Flags to pass to StartServiceByName (currently none are
                defined)

        :Returns: A tuple of 2 elements. The first is always True, the
            second is either START_REPLY_SUCCESS or
            START_REPLY_ALREADY_RUNNING.

        :Raises `DBusException`: if the service could not be started.
        :Since: 0.80.0
        T�StartServiceByName�sur�)rBr:�flagss   r,ryz#BusConnection.start_service_by_name�s=��"	�(�#��d�(�(��/�)9�)=�)-��%�/@�B�C�	Cr.c	�d�t|d��|jtttdd||f�S)a�Request a bus name.

        :Parameters:
            `name` : str
                The well-known name to be requested
            `flags` : dbus.UInt32
                A bitwise-OR of 0 or more of the flags
                `NAME_FLAG_ALLOW_REPLACEMENT`,
                `NAME_FLAG_REPLACE_EXISTING`
                and `NAME_FLAG_DO_NOT_QUEUE`
        :Returns: `REQUEST_NAME_REPLY_PRIMARY_OWNER`,
            `REQUEST_NAME_REPLY_IN_QUEUE`,
            `REQUEST_NAME_REPLY_EXISTS` or
            `REQUEST_NAME_REPLY_ALREADY_OWNER`
        :Raises `DBusException`: if the bus daemon cannot be contacted or
            returns an error.
        F��allow_unique�RequestNamer�r�)rB�namer�s   r,�request_namezBusConnection.request_names3��$	�$�U�3��!�!�/�?�"2�M�"&��u�
�7�	7r.c�b�t|d��|jtttdd|f�S)asRelease a bus name.

        :Parameters:
            `name` : str
                The well-known name to be released
        :Returns: `RELEASE_NAME_REPLY_RELEASED`,
            `RELEASE_NAME_REPLY_NON_EXISTENT`
            or `RELEASE_NAME_REPLY_NOT_OWNER`
        :Raises `DBusException`: if the bus daemon cannot be contacted or
            returns an error.
        Fr��ReleaseNamer?r�)rBr�s  r,�release_namezBusConnection.release_name/s1��	�$�U�3��!�!�/�?�"2�M�"%��w�0�	0r.c�F�|jtttddd�S)z�Return a list of all currently-owned names on the bus.

        :Returns: a dbus.Array of dbus.UTF8String
        :Since: 0.81.0
        �	ListNamesr0r'�r�rrrrHs r,�
list_nameszBusConnection.list_names@s%���!�!�/�?�"2�K�"$�b�*�	*r.c�F�|jtttddd�S)z�Return a list of all names that can be activated on the bus.

        :Returns: a dbus.Array of dbus.UTF8String
        :Since: 0.81.0
        �ListActivatableNamesr0r'r�rHs r,�list_activatable_namesz$BusConnection.list_activatable_namesJs&���!�!�/�?�"2�4J�"$�b�*�	*r.c�b�t|d��|jtttdd|f�S)z�Return the unique connection name of the primary owner of the
        given name.

        :Raises `DBusException`: if the `bus_name` has no owner
        :Since: 0.81.0
        Fr�r>r?r�r�s  r,rxzBusConnection.get_name_ownerTs1��	�(��7��!�!�/�?�"2�N�"%��{�4�	4r.c��t|||�S)aWatch the unique connection name of the primary owner of the
        given name.

        `callback` will be called with one argument, which is either the
        unique connection name, or the empty string (meaning the name is
        not owned).

        :Since: 0.81.0
        )r!)rBr:r+s   r,rkzBusConnection.watch_name_owner`s���d�H�h�7�7r.c
�Z�t|jtttdd|f��S)z�Return True iff the given bus name has an owner on this bus.

        :Parameters:
            `bus_name` : str
                The bus name to look up
        :Returns: a `bool`
        �NameHasOwnerr?)�boolr�rrrr�s  r,�name_has_ownerzBusConnection.name_has_ownerls.���D�&�&���'7��'*�X�K�9�:�	:r.c�J�|jtttdd|f�y)�Arrange for this application to receive messages on the bus that
        match the given rule. This version will block.

        :Parameters:
            `rule` : str
                The match rule
        :Raises `DBusException`: on error.
        :Since: 0.80.0
        �AddMatchr?Nr��rB�rules  r,rlzBusConnection.add_match_stringxs"��	
���?�O�+�Z��t�g�	Gr.c
�N�|jtttdd|fdd�y)�=Arrange for this application to receive messages on the bus that
        match the given rule. This version will not block, but any errors
        will be ignored.


        :Parameters:
            `rule` : str
                The match rule
        :Raises `DBusException`: on error.
        :Since: 0.80.0
        r�r?N�rArrrr�s  r,�add_match_string_non_blockingz+BusConnection.add_match_string_non_blocking�s$��	
�����(�*�c�D�7��d�	$r.c�J�|jtttdd|f�y)r��RemoveMatchr?Nr�r�s  r,�remove_match_stringz!BusConnection.remove_match_string�s"��	
���?�O�+�]�C�$��	Jr.c
�N�|jtttdd|fdd�y)r�r�r?Nr�r�s  r,ruz.BusConnection.remove_match_string_non_blocking�s$��	
�����(�-��t�g��d�	$r.)NNNN)TF)r)!rIrJrK�__doc__r�TYPE_SESSIONr
�TYPE_SYSTEMr	�TYPE_STARTERr�START_REPLY_SUCCESSr�START_REPLY_ALREADY_RUNNINGrXr@rvrzr�r�ryr�r�r�r�rxrkr�rlr�r�ru�
__classcell__)r8s@r,rrcs�����"�L�H� �K�H��L�$�3��"B��%1�D�	�AE�:>�!%��@�
�<@�-2�7Z�r4�C�27�.0�"*�*�
4�
8�
:�G�$� J�$r.r)+�__all__�
__docformat__r4rQ�_dbus_bindingsrrrrr	r
rrr
rrrrrrrrrrrrrr�dbus.connectionr�dbus.exceptionsr�
dbus.lowlevelr�dbus._compatr�_NAME_OWNER_CHANGE_MATCHr3�	getLoggerr6�objectr!rr'r.r,�<module>r�s���2��"�
���	I�	I�	I�	I�	I�	I�	I�'�)�8�� /�0@�.�	0��
�A��
�'�
�
�J�
'��$"�V�$"�NO$�J�O$r.

Zerion Mini Shell 1.0