Şuanki Dizin: /usr/lib64/python3.9/site-packages/dbus/__pycache__/ |
Şuanki Dosya : //usr/lib64/python3.9/site-packages/dbus/__pycache__/connection.cpython-39.pyc |
a � z]�l�@s�dZdZddlZddlZddlZddlmZmZm Z m Z mZmZm Z ddlmZddlmZmZmZmZmZddlmZddlmZmZer�dd lmZndd lmZe�d�Zdd �ZGdd�de �Z!Gdd�de�ZdS))� Connection�SignalMatchZreStructuredText�N)r�LOCAL_IFACE� LOCAL_PATH�validate_bus_name�validate_interface_name�validate_member_name�validate_object_path)� DBusException)�ErrorMessage�HANDLER_RESULT_NOT_YET_HANDLED�MethodCallMessage�MethodReturnMessage� SignalMessage)�ProxyObject)�is_py2�is_py3)�String)� UTF8Stringzdbus.connectioncOsdS�N�)�args�kwargsrr�5/usr/lib64/python3.9/site-packages/dbus/connection.py�_noop3src@s�eZdZgd�Zere�d�ee�Zddd�Zdd�Z d d �Z dd�Zed d��Z dd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdS)r)�_sender_name_owner�_member� _interface�_sender�_path�_handler�_args_match�_rule�_byte_arrays� _conn_weakref�_destination_keyword�_interface_keyword�_message_keyword�_member_keyword�_sender_keyword� _path_keyword�_int_args_match� _utf8_stringsFNc Ksd|durt|�|dur t|�|dur0t|�|dur@t|�d|_t�|�|_||_||_ ||_ ||_||_||_ tr�|�dd�|_nd|vr�td��||_||_| |_||_| |_||_| |_||_|s�d|_n�i|_|D]~}|�d�s�td|��zt|dd��}Wn t�y.td|��Yn0|dk�sD|dk�rPtd |��|||j|<q�dS) N�utf8_stringsF�*unexpected keyword argument 'utf8_strings'�argz(SignalMatch: unknown keyword argument %s�r�?z9SignalMatch: arg match index must be in range(64), not %d)rrrr r"�weakref�refr$rrrrr rr�popr,� TypeErrorr#r)r*r(r&r'r%r!r+� startswith�int� ValueError)�self�conn�sender�object_path�dbus_interface�member�handler�byte_arraysZsender_keywordZpath_keywordZinterface_keywordZmember_keywordZmessage_keywordZdestination_keywordr�kwarg�indexrrr�__init__Cs^ ���zSignalMatch.__init__cCstt|��S�z-SignalMatch objects are compared by identity.)�hash�id�r9rrr�__hash__~szSignalMatch.__hash__cCs||uSrDr�r9�otherrrr�__eq__�szSignalMatch.__eq__cCs||uSrDrrIrrr�__ne__�szSignalMatch.__ne__cCs|jSr)rrGrrr�<lambda>��zSignalMatch.<lambda>cCs�|jdur�dg}|jdur*|�d|j�|jdurD|�d|j�|jdur^|�d|j�|jdurx|�d|j�|jdur�|j��D]\}}|�d||f�q�d�|�|_|jS)Nz type='signal'zsender='%s'z path='%s'zinterface='%s'zmember='%s'z arg%d='%s'�,) r"r�appendrrrr+�items�join)r9ZrulerB�valuerrr�__str__�s zSignalMatch.__str__cCsd|jt|�|j|��fS)Nz<%s at %x "%s" on conn %r>)� __class__rFr"r$rGrrr�__repr__�s�zSignalMatch.__repr__cCs ||_dSr)r)r9�new_namerrr�set_sender_name_owner�sz!SignalMatch.set_sender_name_ownercKs\|d|jfvrdS||jkr dS||jkr.dS||jkr<dS||jkrJdS||jkrXdSdS)NFT)r rrrrr!)r9r;r<r=r>r?rrrr�matches_removal_spec�s z SignalMatch.matches_removal_speccCs�d}|jd|��fvrdS|jdur�tdd�}tr6tnt}trFd|d<|jfi|��}|j� �D]4\}}|t |�ks�t|||�r�|||kr`dSq`|jd|� �fvr�dS|jd|��fvr�dS|jd|��fvr�dSz�to�|j}|dus�|r�|j�s$t|jd�}t�r|j|d<|jfi|��}i}|jdu�rB|��||j<|jdu�r\|��||j<|jdu�rv|��||j<|jdu�r�|� �||j<|jdu�r�|��||j<|jdu�r�|||j<|j|i|��Wn"t��tjddd�Yn0dS)NFT�r@r-z&Exception in handler for D-Bus signal:���exc_info) rZ get_senderr+�dictrrrr� get_args_listrQ�len� isinstancer� get_memberr� get_interfacer�get_pathr,r#r)r%Zget_destinationr*r(r&r'r �logging�basicConfig�_logger�error)r9�messagerrZarg_typerBrSr-rrr�maybe_handle_message�s^ � � z SignalMatch.maybe_handle_messagecCs8|��}|dur4|j||j|j|j|jfi|j��dSr)r$�remove_signal_receiverrrrrr!)r9r:rrr�remove�s ��zSignalMatch.remove)FNNNNNN)�__name__� __module__�__qualname__Z_slotsrrP�tuple� __slots__rCrHrKrL�propertyr;rTrVrXrYrjrlrrrrr7s& � ;:rcs~eZdZdZeZ�fdd�Zdd�Zddd �Zdd d�Z dd �Z ddd�Zdd�Zdd�Z ddd�Zd dd�Zdd�Z�ZS)!rzzA connection to another application. In this base class there is assumed to be no bus daemon. :Since: 0.81.0 csNtt|�j|i|��t|d�sJd|_g|_i|_t��|_ |� |jj�dS)N�_dbus_Connection_initializedr[) �superrrC�hasattrrs�"_Connection__call_on_disconnection�!_signal_recipients_by_object_path� threading�Lock� _signals_lockZadd_message_filterrU�_signal_func)r9rr�rUrrrCs zConnection.__init__cCs|S)aReturn the unique name for the given bus name, activating it if necessary and possible. If the name is already unique or this connection is not to a bus daemon, just return it. :Returns: a bus name. If the given `bus_name` exists, the returned name identifies its current owner; otherwise the returned name does not exist. :Raises DBusException: if the implementation has failed to activate the given bus name. :Since: 0.81.0 r)r9�bus_namerrr�activate_name_ownerszConnection.activate_name_ownerNTcKsn|�dd�}|durB|dur$td��ddlm}|dtdd�|}|r\td d �|�����|j||||d�S)a�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 :Returns: a `dbus.proxies.ProxyObject` � named_serviceN�3bus_name and named_service cannot both be specifiedr��warnziPassing the named_service parameter to get_object by name is deprecated: please use positional parameters��� stacklevelz4get_object does not take these keyword arguments: %sz, )� introspect)r4r5�warningsr��DeprecationWarningrR�keys�ProxyObjectClass)r9r}r<r�rrr�rrr� get_object&s �� �zConnection.get_objectc Ks�|��|�dd�}|durJ|dur,td��|}ddlm}|dtdd�t||||||fi|��} |j��z>|j � |i�} | � |i�}|� |g�}|�| �W|j��n|j��0| S) aArrange for the given function to be called when a signal matching the parameters is received. :Parameters: `handler_function` : callable The function to be called. Its positional arguments will be the arguments of the signal. By default it will receive no keyword arguments, but see the description of the optional keyword arguments below. `signal_name` : str The signal name; None (the default) matches all names `dbus_interface` : str The D-Bus interface name with which to qualify the signal; None (the default) matches all interface names `bus_name` : str A bus name for the sender, which will be resolved to a unique name if it is not already; None (the default) matches any sender. `path` : str The object path of the object which must have emitted the signal; None (the default) matches any object path :Keywords: `utf8_strings` : bool If True, the handler function will receive any string arguments as dbus.UTF8String objects (a subclass of str guaranteed to be UTF-8). If False (default) it will receive any string arguments as dbus.String objects (a subclass of unicode). `byte_arrays` : bool If True, the handler function will receive any byte-array arguments as dbus.ByteArray objects (a subclass of str). If False (default) it will receive any byte-array arguments as a dbus.Array of dbus.Byte (subclasses of: a list of ints). `sender_keyword` : str If not None (the default), the handler function will receive the unique name of the sending endpoint as a keyword argument with this name. `destination_keyword` : str If not None (the default), the handler function will receive the bus name of the destination (or None if the signal is a broadcast, as is usual) as a keyword argument with this name. `interface_keyword` : str If not None (the default), the handler function will receive the signal interface as a keyword argument with this name. `member_keyword` : str If not None (the default), the handler function will receive the signal name as a keyword argument with this name. `path_keyword` : str If not None (the default), the handler function will receive the object-path of the sending object as a keyword argument with this name. `message_keyword` : str If not None (the default), the handler function will receive the `dbus.lowlevel.SignalMessage` as a keyword argument with this name. `arg...` : unicode or UTF-8 str If there are additional keyword parameters of the form ``arg``\ *n*, match only signals where the *n*\ th argument is the value given for that keyword parameter. As of this time only string arguments can be matched (in particular, object paths and signatures can't). `named_service` : str A deprecated alias for `bus_name`. rNr�rr�zrPassing the named_service parameter to add_signal_receiver by name is deprecated: please use positional parametersr�r�) Z_require_main_loopr4r5r�r�r�rrz�acquirerw� setdefaultrP�release) r9Zhandler_function�signal_namer=r}�path�keywordsrr��match�by_interface� by_member�matchesrrr�add_signal_receiverKs2G� �� �zConnection.add_signal_receiverccs�|durd|f}nd}|dur(d|f}nd}|dur>d|f}nd}|D]j}|j�|�}|dur`qF|D]J}|�|d�}|dur~qd|D]*}|�|d�} | dur�q�| D] } | Vq�q�qdqFdS)Nr)rw�get)r9r�r=r>Z path_keysZinterface_keysZmember_keysr�r�r��mrrr�_iter_easy_matches�s. zConnection._iter_easy_matchescKsj|�dd�}|durB|dur$td��|}ddlm}|dtdd�g} g} |j��z�|j�|d�}|dur|W|j� �dS|�|d�}|dur�W|j� �dS|�|d�} | dur�W|j� �dS| D]<}||us�|j |||||fi|��r�| �|�q�| �|�q�| �r| ||<n ||=|�s6||=|�s6|j|=W|j� �n|j� �0| D]}|�|��qTdS)Nrr�rr�zuPassing the named_service parameter to remove_signal_receiver by name is deprecated: please use positional parametersr�r�) r4r5r�r�r�rzr�rwr�r�rYrP�_clean_up_signal_match)r9Zhandler_or_matchr�r=r}r�r�rr��newZ deletionsr�r�r�r�rrrrk�sj� � � � ���� z!Connection.remove_signal_receivercCsdSrr)r9r�rrrr�sz!Connection._clean_up_signal_matchc Cs�t|t�stS|��}|��}|��}|�|||�D]}|�|�q4|tkr�|t kr�|dkr�|j D]:}z||�Wqbty�t� �tjddd�Yqb0qbtS)zvD-Bus filter function. Handle signals by dispatching to Python callbacks kept in the match-rule tree. ZDisconnectedz-Exception in handler for Disconnected signal:r[r\)rarrrcrdrbr�rjrrrv� Exceptionrerfrgrh)r9rir=r�r�r��cbrrrr{s. ��� �zConnection._signal_func��Fc s|tkrtdt��|tkr(tdt��t| d��trH|�dd��d<nd|vrXtd��t||||d�} z| j|d|i�WnBt y�}z*t ��t� d |||j|��WYd }~n d }~00�d urވd ur�|�| �d S�d ur�t��d ur�t����fdd�}|j| || |d �S)aSCall the given method, asynchronously. If the reply_handler is None, successful replies will be ignored. If the error_handler is None, failures will be ignored. If both are None, the implementation may request that no reply is sent. :Returns: The dbus.lowlevel.PendingCall. :Since: 0.81.0 �1Methods may not be called on the reserved path %s�6Methods may not be called on the reserved interface %srZr-Fr.�Zdestinationr�Z interface�method� signature�<Unable to set arguments %r according to signature %r: %s: %sNcsZt|t�r �|jfi����n6t|t�rF�t|��d|��i��n�td|��dS)N�namez%Unexpected type for reply message: %r)rarr_rr Zget_error_namer5)ri�� error_handler� get_args_opts� reply_handlerrr�msg_reply_handler\s ��z0Connection.call_async.<locals>.msg_reply_handler)�require_main_loop)rr rr^rr�r5r rPr�rerfrgrhrUZsend_messagerZsend_message_with_reply)r9r}r<r=r�r�rr�r��timeoutr@r�rri�er�rr�r� call_async)sL �� � � �zConnection.call_asyncc Ks|tkrtdt��|tkr(tdt��t|d�} trH| �dd�| d<nd| vrXtd��t||||d�}z|j|d|i�WnBt y�}z*t ��t� d |||j|��WYd }~n d }~00|�||�} | jfi| ��}t|�dkr�d St|�dk�r|dSt|�Sd S) zECall the given method, synchronously. :Since: 0.81.0 r�r�rZr-Fr.r�r�r�Nrr[)rr rr^rr�r5r rPr�rerfrgrhrUZ!send_message_with_reply_and_blockr_r`rp)r9r}r<r=r�r�rr�r@rr�rir�Z reply_messageZ args_listrrr� call_blockingisF�� � ��zConnection.call_blockingcCs|j�|�dS)z�Arrange for `callable` to be called with one argument (this Connection object) when the Connection becomes disconnected. :Since: 0.83.0 N)rvrP)r9�callablerrr�call_on_disconnection�sz Connection.call_on_disconnection)NNT)NNNN)NNNN)r�FT)r�F)rmrnro�__doc__rr�rCr~r�r�r�rkr�r{r�r�r�� __classcell__rrr|rr�s2 &� d� ; � A� -r)"�__all__Z __docformat__rerxr2Z_dbus_bindingsrZ_Connectionrrrrrr Zdbus.exceptionsr Z dbus.lowlevelrrr rrZdbus.proxiesrZdbus._compatrrrrZ getLoggerrgr�objectrrrrr�<module>s"$ D
Linux 65-254-81-4.cprapid.com 5.14.0-284.11.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 9 05:49:00 EDT 2023 x86_64
Apache
65.254.81.4