§
    @iasD  ã                   ó(  — d Z dZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ ddl m!Z! ddl"m#Z# d	e›d
e›de›d�Z$	 dZ% ej&        d¦  «        Z' G d„ de(¦  «        Z) G d„ de¦  «        Z*dS ))Ú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_py2ztype='signal',sender='z',interface='z"',member='NameOwnerChanged',path='z',arg0='%s'z)org.freedesktop.DBus.Error.NameHasNoOwnerzdbus.busc                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚNameOwnerWatch)Ú_matchÚ_pending_callc           
      óþ   ‡‡— t          ‰¦  «         ˆfd„}ˆˆfd„}|                     |dt          t          t          ‰¬¦  «        | _        |                     t          t          t          dd‰f‰|¦  «        | _        d S )Nc                 ó   •—  ‰|¦  «         d S ©N© )ÚownedÚ	old_ownerÚ	new_ownerÚcallbacks      €ú*/usr/lib/python3/dist-packages/dbus/bus.pyÚ	signal_cbz*NameOwnerWatch.__init__.<locals>.signal_cbB   s   ø€ ØˆH�YÑÔÐÐÐó    c                 óÌ   •— |                       ¦   «         t          k    r ‰d¦  «         d S t          j        ¦   «          t                               d‰| j        | d f¬¦  «         d S )NÚ zGetNameOwner(%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_cbE   so   ø€ Ø�ŠÑ Ô Õ$6Ò6Ð6Ø�˜‘”���åÔ#Ñ%Ô%Ð%Ý—’Ð8¸(Ø()¬°Q¸Ð'=ð ñ ?ô ?ð ?ð ?ð ?r.   ÚNameOwnerChanged)Úarg0ÚGetNameOwnerÚs)r   Úadd_signal_receiverr   r   r   r"   Ú
call_asyncr#   )ÚselfÚbus_connr:   r+   r-   r;   s     ``  r,   Ú__init__zNameOwnerWatch.__init__?   s³   øø€ Ý˜(Ñ#Ô#Ð#ð	 ð 	 ð 	 ð 	 ð 	 ð	?ð 	?ð 	?ð 	?ð 	?ð 	?ð ×2Ò2°9Ø3EÝ3CÝ3BÝ3BØ8@ð 3ñ Bô BˆŒð &×0Ò0µÝ1@Ý1AØ1?Ø14°x°kØ19¸8ñEô EˆÔÐÐr.   c                 ó¢   — | j         �| j                              ¦   «          | j        �| j                             ¦   «          d | _         d | _        d S r&   )r"   Úremover#   Úcancel©rB   s    r,   rG   zNameOwnerWatch.cancelZ   sQ   € ØŒ;Ð"ØŒK×ÒÑ Ô Ð ØÔÐ)ØÔ×%Ò%Ñ'Ô'Ð'ØˆŒØ!ˆÔÐÐr.   N)Ú__name__Ú
__module__Ú__qualname__Ú	__slots__rD   rG   r'   r.   r,   r!   r!   <   s:   € € € € € Ø+€IðEð Eð Eð6"ð "ð "ð "ð "r.   r!   c                   óº   ‡ — e Zd ZdZeZ	 eZ	 eZ		 e
ZeZedfd„Z	 	 	 dˆ fd„	Zd„ Zd„ Z	 	 dd	„Zd
„ Zdd„Zdd„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zˆ xZ S )r   zxA connection to a D-Bus daemon that implements the
    ``org.freedesktop.DBus`` pseudo-service.

    :Since: 0.81.0
    Nc                 ót   — |                       ||¬¦  «        }t          j        ¦   «         |_        i |_        	 |S )N)Úmainloop)Ú_new_for_busÚweakrefÚWeakValueDictionaryÚ
_bus_namesÚ_signal_sender_matches)ÚclsÚaddress_or_typerO   Úbuss       r,   Ú__new__zBusConnection.__new__w   s<   € Ø×Ò˜¸ÐÑBÔBˆõ !Ô4Ñ6Ô6ˆŒà%'ˆÔ"Ø5àˆ
r.   c                 ó°  •‡— |                      dd ¦  «        }|�,|�t          d¦  «        ‚|}ddlm}  |dt          d¬¦  «          t          t          | ¦  «        j        |||||fi |¤ŽŠ|�F|t          k    r;|d d…         d	k    rˆfd
„}	n‰j	        }	|  
                    ||	¦  «        }
|
| j        ‰<   |                      t          ‰¦  «        ¦  «         ‰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                 ó@   •— | dk    r‰                      ¦   «          d S d S )Nr0   )rF   )r*   Úmatchs    €r,   r+   z3BusConnection.add_signal_receiver.<locals>.callback–   s$   ø€ Ø  B’�ØŸš™œ˜˜˜ð '�r.   )ÚpopÚ	TypeErrorÚwarningsr]   ÚDeprecationWarningÚsuperr   r@   r   Úset_sender_name_ownerÚwatch_name_ownerrT   Úadd_match_stringÚstr)rB   Úhandler_functionÚsignal_nameÚdbus_interfacer:   ÚpathÚkeywordsrZ   r]   r+   Úwatchrd   r8   s              @€r,   r@   z!BusConnection.add_signal_receiver‚   s>  øø€ ð !Ÿš _°dÑ;Ô;ˆØÐ$ØÐ#Ýð !,ñ -ô -ð -à$ˆHØ%Ð%Ð%Ð%Ð%Ð%ØˆDð Kå#°ð3ñ 3ô 3ð 3ð ?••m TÑ*Ô*Ô>Ø  +¨~¸xØð"ð "à ð"ð "ˆð Ð  XµÒ%@Ð%@Ø˜˜˜Œ|˜sÒ"Ð"ð'ð 'ð 'ð 'ð 'ð 'ð !Ô6�Ø×)Ò)¨(°HÑ=Ô=ˆEØ16ˆDÔ'¨Ñ.à×Ò�c %™jœjÑ)Ô)Ð)àˆr.   c                 ó°   — |                       t          |¦  «        ¦  «         | j                             |d ¦  «        }|�|                     ¦   «          d S d S r&   )Ú remove_match_string_non_blockingrm   rT   re   rG   )rB   rd   rs   s      r,   Ú_clean_up_signal_matchz$BusConnection._clean_up_signal_match¢   sS   € à×-Ò-­c°%©j¬jÑ9Ô9Ð9ØÔ+×/Ò/°°tÑ<Ô<ˆØÐØ�LŠL‰NŒNˆNˆNˆNð Ðr.   c                 ó&  — |�Ž|d d…         dk    r€|t           k    ru	 |                      |¦  «        S # t          $ rR}|                     ¦   «         t          k    r‚ |                      |¦  «         |                      |¦  «        cY d }~S d }~ww xY w|S )Nra   rb   )r   Úget_name_ownerr   r2   r3   Ústart_service_by_name)rB   r:   r9   s      r,   Úactivate_name_ownerz!BusConnection.activate_name_owner©   s´   € ØÐ  X¨b¨q¨b¤\°SÒ%8Ð%8Ø�OÒ+Ð+ð5Ø×*Ò*¨8Ñ4Ô4Ð4øÝ ð 5ð 5ð 5Ø—?’?Ñ$Ô$Õ(:Ò:Ð:Øà×*Ò*¨8Ñ4Ô4Ð4Ø×*Ò*¨8Ñ4Ô4Ð4Ð4Ð4Ð4Ð4Ð4øøøøð5øøøð ˆOs   �2 ²
B¼AB	ÂBÂ	BTFc                 ó\  — |r|                       ¦   «          |                     dd¦  «        }|�,|�t          d¦  «        ‚ddlm}  |dt
          d¬¦  «         |}|r7t          d	d
                     |                     ¦   «         ¦  «        z  ¦  «        ‚|                      | ||||¬¦  «        S )aJ  Return 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
        rZ   Nr[   r   r\   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_loopre   rf   rg   r]   rh   ÚjoinÚkeysÚProxyObjectClass)rB   r:   Úobject_pathr|   r}   ÚkwargsrZ   r]   s           r,   Ú
get_objectzBusConnection.get_object¸   s   € ðH %ð 	&Ø×#Ò#Ñ%Ô%Ð%àŸ
š
 ?°DÑ9Ô9ˆØÐ$ØÐ#Ýð !/ñ 0ô 0ð 0à%Ð%Ð%Ð%Ð%Ð%ØˆDð Cå#°ð3ñ 3ô 3ð 3ð %ˆHØð 	HÝð ,Ø.2¯iªi¸¿º¹¼Ñ.FÔ.FñGñ Hô Hð Hð ×$Ò$ T¨8°[Ø0:Ø?Xð %ñ Zô Zð 	Zr.   c                 ót   — t          |¦  «         |                      t          t          t          dd|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_blockingr   r   r   ©rB   r:   s     r,   Úget_unix_userzBusConnection.get_unix_userñ   s;   € õ 	˜(Ñ#Ô#Ð#Ø×!Ò!¥/µ?Ý"2Ð4KØ"%¨ {ñ4ô 4ð 	4r.   r   c           
      óz   — t          |¦  «         d|                      t          t          t          dd||f¦  «        fS )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‡   )rB   r:   Úflagss      r,   ry   z#BusConnection.start_service_by_nameÿ   sI   € õ" 	˜(Ñ#Ô#Ð#Ø�d×(Ò(­½/Ý)9Ø)=Ø)-°¸%Ð/@ñBô Bð Cð 	Cr.   c           	      óz   — t          |d¬¦  «         |                      t          t          t          dd||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_namezBusConnection.request_name  sA   € õ$ 	˜$¨UÐ3Ñ3Ô3Ð3Ø×!Ò!¥/µ?Ý"2°MØ"&¨¨u¨ñ7ô 7ð 	7r.   c                 óx   — t          |d¬¦  «         |                      t          t          t          dd|f¦  «        S )as  Release 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‡   )rB   r“   s     r,   Úrelease_namezBusConnection.release_name/  s?   € õ 	˜$¨UÐ3Ñ3Ô3Ð3Ø×!Ò!¥/µ?Ý"2°MØ"%¨ wñ0ô 0ð 	0r.   c                 óT   — |                       t          t          t          ddd¦  «        S )z‰Return a list of all currently-owned names on the bus.

        :Returns: a dbus.Array of dbus.UTF8String
        :Since: 0.81.0
        Ú	ListNamesr0   r'   ©rˆ   r   r   r   rH   s    r,   Ú
list_nameszBusConnection.list_names@  s*   € ð ×!Ò!¥/µ?Ý"2°KØ"$ bñ*ô *ð 	*r.   c                 óT   — |                       t          t          t          ddd¦  «        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
        ÚListActivatableNamesr0   r'   rš   rH   s    r,   Úlist_activatable_namesz$BusConnection.list_activatable_namesJ  s+   € ð ×!Ò!¥/µ?Ý"2Ð4JØ"$ bñ*ô *ð 	*r.   c                 óx   — t          |d¬¦  «         |                      t          t          t          dd|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,   rx   zBusConnection.get_name_ownerT  s?   € õ 	˜(°Ð7Ñ7Ô7Ð7Ø×!Ò!¥/µ?Ý"2°NØ"%¨ {ñ4ô 4ð 	4r.   c                 ó$   — t          | ||¦  «        S )a  Watch 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!   )rB   r:   r+   s      r,   rk   zBusConnection.watch_name_owner`  s   € õ ˜d H¨hÑ7Ô7Ð7r.   c           
      óp   — t          |                      t          t          t          dd|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ˆ   r   r   r   r‰   s     r,   Úname_has_ownerzBusConnection.name_has_ownerl  s8   € õ �D×&Ò&¥½Ý'7¸Ø'*¨X¨Kñ9ô 9ñ :ô :ð 	:r.   c                 óZ   — |                       t          t          t          dd|f¦  «         dS )á  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,   rl   zBusConnection.add_match_stringx  s:   € ð 	×Ò�?­OÝ+¨Z¸¸t¸gñ	Gô 	Gð 	Gð 	Gð 	Gr.   c           
      ó^   — |                       t          t          t          dd|fdd¦  «         dS )á=  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©rA   r   r   r   r¨   s     r,   Úadd_match_string_non_blockingz+BusConnection.add_match_string_non_blocking‡  s8   € ð 	�Š�­Ý(¨*°c¸D¸7Ø˜dñ	$ô 	$ð 	$ð 	$ð 	$r.   c                 óZ   — |                       t          t          t          dd|f¦  «         dS )r¦   ÚRemoveMatchr?   Nrš   r¨   s     r,   Úremove_match_stringz!BusConnection.remove_match_string—  s:   € ð 	×Ò�?­OÝ+¨]¸CÀ$Àñ	Jô 	Jð 	Jð 	Jð 	Jr.   c           
      ó^   — |                       t          t          t          dd|fdd¦  «         dS )r«   r¯   r?   Nr¬   r¨   s     r,   ru   z.BusConnection.remove_match_string_non_blocking¤  s8   € ð 	�Š�­Ý(¨-¸¸t¸gØ˜dñ	$ô 	$ð 	$ð 	$ð 	$r.   )NNNN)TF)r   )!rI   rJ   rK   Ú__doc__r   ÚTYPE_SESSIONr
   ÚTYPE_SYSTEMr	   ÚTYPE_STARTERr   ÚSTART_REPLY_SUCCESSr   ÚSTART_REPLY_ALREADY_RUNNINGrX   r@   rv   rz   r„   rŠ   ry   r”   r—   r›   rž   rx   rk   r¤   rl   r­   r°   ru   Ú__classcell__)r8   s   @r,   r   r   c   s¯  ø€ € € € € ðð ð "€LØHà €KØHà€Lð$ð 3ÐØ"BÐà%1¸Dð 	ð 	ð 	ð 	ð AEØ:>Ø!%ðð ð ð ð ð ð@ð ð ðð ð ð <@Ø-2ð7Zð 7Zð 7Zð 7Zðr4ð 4ð 4ðCð Cð Cð Cð27ð 7ð 7ð 7ð.0ð 0ð 0ð"*ð *ð *ð*ð *ð *ð
4ð 
4ð 
4ð
8ð 
8ð 
8ð
:ð 
:ð 
:ðGð Gð Gð$ð $ð $ð Jð Jð Jð$ð $ð $ð $ð $ð $ð $r.   r   )+Ú__all__Ú__docformat__r4   rQ   Ú_dbus_bindingsr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Údbus.connectionr   Údbus.exceptionsr   Údbus.lowlevelr   Údbus._compatr   Ú_NAME_OWNER_CHANGE_MATCHr3   Ú	getLoggerr6   Úobjectr!   r   r'   r.   r,   ú<module>rÃ      sF  ðð2 €Ø"€à €€€Ø €€€ð	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 	Ið 'Ð &Ð &Ð &Ð &Ð &Ø )Ð )Ð )Ð )Ð )Ð )Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø Ð Ð Ð Ð Ð Ð ð  /˜˜Ð0@Ð0@Ð0@Ø.˜˜ð	0Ð ð
ð AÐ à
ˆ'Ô
˜JÑ
'Ô
'€ð$"ð $"ð $"ð $"ð $"�Vñ $"ô $"ð $"ðNO$ð O$ð O$ð O$ð O$�Jñ O$ô O$ð O$ð O$ð O$r.   