Your IP : 3.145.186.32


Current Path : /lib64/python2.7/site-packages/dbus/
Upload File :
Current File : //lib64/python2.7/site-packages/dbus/connection.pyo

�
oMTc@s3dZdZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZm
Z
ddlmZddlmZmZmZmZmZddlmZdd	lmZmZer�dd
lmZnddlmZejd�Zd
�Zde fd��YZ!defd��YZdS(t
ConnectiontSignalMatchtreStructuredTexti����N(RtLOCAL_IFACEt
LOCAL_PATHtvalidate_bus_nametvalidate_interface_nametvalidate_member_nametvalidate_object_path(t
DBusException(tErrorMessagetHANDLER_RESULT_NOT_YET_HANDLEDtMethodCallMessagetMethodReturnMessaget
SignalMessage(tProxyObject(tis_py2tis_py3(tString(t
UTF8Stringsdbus.connectioncOsdS(N((targstkwargs((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyt_noop1scBs�eZdddddddddd	d
ddd
dddgZerUejd�nee�Zeddddddd�Z	d�Z
d�Zd�Ze
d��Zd�Zd�Zd�Zd�Zd�Zd�ZRS(t_sender_name_ownert_membert
_interfacet_sendert_patht_handlert_args_matcht_rulet_byte_arrayst
_conn_weakreft_destination_keywordt_interface_keywordt_message_keywordt_member_keywordt_sender_keywordt
_path_keywordt_int_args_matcht
_utf8_stringscKs�|dk	rt|�n|dk	r2t|�n|dk	rKt|�n|dk	rdt|�nd|_tj|�|_||_	||_
||_||_||_
||_tr�|jdt�|_nd|kr�td��n||_||_|	|_||_|
|_||_|
|_||_|sHd|_n�i|_x�|D]�}|jd�s�td|��nyt|d�}Wn!tk
r�td|��nX|dks�|dkr�td|��n|||j|<qXWdS(	Ntutf8_stringss*unexpected keyword argument 'utf8_strings'targs(SignalMatch: unknown keyword argument %siii?s9SignalMatch: arg match index must be in range(64), not %d( tNoneRRRRRtweakreftrefR RRRRRRRtpoptFalseR(t	TypeErrorRR%R&R$R"R#R!RR't
startswithtintt
ValueError(tselftconntsendertobject_pathtdbus_interfacetmemberthandlertbyte_arraystsender_keywordtpath_keywordtinterface_keywordtmember_keywordtmessage_keywordtdestination_keywordRtkwargtindex((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyt__init__AsX



																



cCstt|��S(s-SignalMatch objects are compared by identity.(thashtid(R4((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyt__hash__|scCs
||kS(s-SignalMatch objects are compared by identity.((R4tother((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyt__eq__�scCs
||k	S(s-SignalMatch objects are compared by identity.((R4RH((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyt__ne__�scCs|jS(N(R(R4((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyt<lambda>�scCs|jdkrdg}|jdk	r>|jd|j�n|jdk	rd|jd|j�n|jdk	r�|jd|j�n|jdk	r�|jd|j�n|jdk	r�x7|jj�D]#\}}|jd||f�q�Wndj	|�|_n|jS(Ns
type='signal'ssender='%s's	path='%s'sinterface='%s'smember='%s's
arg%d='%s't,(
RR+RtappendRRRR'titemstjoin(R4truleRCtvalue((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyt__str__�s	cCs&d|jt|�|j|j�fS(Ns<%s at %x "%s" on conn %r>(t	__class__RFRR (R4((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyt__repr__�scCs
||_dS(N(R(R4tnew_name((s5/usr/lib64/python2.7/site-packages/dbus/connection.pytset_sender_name_owner�scKs||d|jfkrtS||jkr,tS||jkr?tS||jkrRtS||jkretS||jkrxtStS(N(	R+RR/RRRRRtTrue(R4R6R7R8R9R:R((s5/usr/lib64/python2.7/site-packages/dbus/connection.pytmatches_removal_spec�scCs�d}|jd|j�fkr%tS|jdk	r�tdt�}trOtnt	}t
rht|d<n|j|�}xZ|jj�D]F\}}|t
|�ks�t|||�s�|||kr�tSq�Wn|jd|j�fkr�tS|jd|j�fkrtS|jd|j�fkr1tSyXt
o@|j}|dks`|s`|jr�td|j�}t
r�|j|d<n|j|�}ni}|jdk	r�|j�||j<n|jdk	r�|j�||j<n|jdk	r|j�||j<n|jdk	r4|j�||j<n|jdk	rY|j�||j<n|jdk	rx|||j<n|j||�Wn$tj �t!j"ddd�nXtS(NR;R)s&Exception in handler for D-Bus signal:texc_infoi(#R+Rt
get_senderR/R'tdictRWRRRRt
get_args_listRNtlent
isinstanceRt
get_memberRt
get_interfaceRtget_pathR(RR%R!tget_destinationR&R$R"R#RtloggingtbasicConfigt_loggerterror(R4tmessageRRtarg_typeRCRQR)((s5/usr/lib64/python2.7/site-packages/dbus/connection.pytmaybe_handle_message�sZ

cCsJ|j�}|dk	rF|j||j|j|j|j|j�ndS(N(R R+tremove_signal_receiverRRRRR(R4R5((s5/usr/lib64/python2.7/site-packages/dbus/connection.pytremove�sN(t__name__t
__module__t_slotsRRMttuplet	__slots__R/R+RDRGRIRJtpropertyR6RRRTRVRXRiRk(((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyR5s.7								:cBs�eZdZeZd�Zd�Zd
d
ed�Z	d
d
d
d
d�Z
d�Zd
d
d
d
d�Zd�Z
d�Zd	eed
�Zd	ed�Zd�ZRS(szA connection to another application. In this base class there is
    assumed to be no bus daemon.

    :Since: 0.81.0
    cOsltt|�j||�t|d�shd|_g|_i|_tj�|_	|j
|jj�ndS(Nt_dbus_Connection_initializedi(
tsuperRRDthasattrRrt"_Connection__call_on_disconnectiont!_signal_recipients_by_object_patht	threadingtLockt
_signals_locktadd_message_filterRSt_signal_func(R4RR((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyRDs			cCs|S(sReturn 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
        ((R4tbus_name((s5/usr/lib64/python2.7/site-packages/dbus/connection.pytactivate_name_ownerscKs�|jdd�}|dk	re|dk	r9td��nddlm}|dtdd�|}n|r�tdd	j|j����n|j|||d
|�S(s�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`
        t
named_services3bus_name and named_service cannot both be specifiedi����(twarnsiPassing the named_service parameter to get_object by name is deprecated: please use positional parameterst
stacklevelis4get_object does not take these keyword arguments: %ss, t
introspectN(	R.R+R0twarningsRtDeprecationWarningROtkeystProxyObjectClass(R4R|R7R�RR~R((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyt
get_object$s
	c
Ks�|j�|jdd�}|dk	ro|dk	rCtd��n|}ddlm}|dtdd�nt|||||||�}	|jj	�zJ|j
j|i�}
|
j|i�}|j|g�}|j|	�Wd|jj
�X|	S(	sArrange 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`.
        R~s3bus_name and named_service cannot both be specifiedi����(RsrPassing the named_service parameter to add_signal_receiver by name is deprecated: please use positional parametersR�iN(t_require_main_loopR.R+R0R�RR�RRytacquireRvt
setdefaultRMtrelease(
R4thandler_functiontsignal_nameR8R|tpathtkeywordsR~Rtmatchtby_interfacet	by_membertmatches((s5/usr/lib64/python2.7/site-packages/dbus/connection.pytadd_signal_receiverIs(G

	ccs|dk	rd|f}nd}|dk	r<d|f}nd}|dk	r]d|f}nd}x�|D]�}|jj|�}|dkr�qjnx}|D]u}|j|d�}|dkr�q�nxH|D]@}|j|d�}	|	dkr�q�nx|	D]}
|
Vq�Wq�Wq�WqjWdS(N(N(N(N(R+Rvtget(R4R�R8R9t	path_keystinterface_keystmember_keysR�R�R�tm((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyt_iter_easy_matches�s.



c	Ks�|jdd�}|dk	re|dk	r9td��n|}ddlm}|dtdd�ng}	g}
|jj�z|jj	|d�}|dkr�dS|j	|d�}|dkr�dS|j	|d�}
|
dkr�dSxU|
D]M}||ks!|j
||||||�r1|
j|�q�|	j|�q�W|	rU|	||<n*||=|s||=|s|j|=qnWd|jj�Xx|
D]}|j
|�q�WdS(NR~s3bus_name and named_service cannot both be specifiedi����(RsuPassing the named_service parameter to remove_signal_receiver by name is deprecated: please use positional parametersR�i(R.R+R0R�RR�RyR�RvR�RXRMR�t_clean_up_signal_match(R4thandler_or_matchR�R8R|R�R�R~Rtnewt	deletionsR�R�R�R�((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyRj�sT
	
		

cCsdS(N((R4R�((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyR�scCs�t|t�stS|j�}|j�}|j�}x*|j|||�D]}|j|�qMW|tkr�|t	kr�|dkr�xS|j
D]E}y||�Wq�tk
r�tj
�tjddd�q�Xq�WntS(svD-Bus filter function. Handle signals by dispatching to Python
        callbacks kept in the match-rule tree.
        tDisconnecteds-Exception in handler for Disconnected signal:RYi(R^RRR`RaR_R�RiRRRut	ExceptionRcRdReRf(R4RgR8R�R�R�tcb((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyR{	s&


g�c	s|tkrtdt��n|tkr>tdt��ntd|
��trl|jdt��d<nd|kr�td��ntd|d|d|d	|�}
y|
j	d
||�Wn<t
k
r�}tj�t
jd|||j|��nX�dkr'�dkr'|j|
�dS�dkr<t�n�dkrQt�n���fd
�}|j|
||	d|�S(sSCall 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
        s1Methods may not be called on the reserved path %ss6Methods may not be called on the reserved interface %sR;R)s*unexpected keyword argument 'utf8_strings'tdestinationR�t	interfacetmethodt	signatures<Unable to set arguments %r according to signature %r: %s: %sNcsqt|t�r%�|j���nHt|t�rY�td|j�|j���n�td|��dS(Ntnames%Unexpected type for reply message: %r(R^R
R\R
R	tget_error_nameR0(Rg(t
error_handlert
get_args_optst
reply_handler(s5/usr/lib64/python2.7/site-packages/dbus/connection.pytmsg_reply_handlerZs	trequire_main_loop(RR	RR[RR�R/R0RRMR�RcRdReRfRSR+tsend_messageRtsend_message_with_reply(R4R|R7R8R�R�RR�R�ttimeoutR;R�RRgteR�((R�R�R�s5/usr/lib64/python2.7/site-packages/dbus/connection.pyt
call_async'sB


	
	
			c		Ks]|tkrtdt��n|tkr>tdt��ntd|�}
trl|	jdt�|
d<nd|	kr�td��ntd|d|d|d	|�}y|j	d
||�Wn<t
k
r�}tj�t
jd|||j|��nX|j||�}
|
j|
�}t|�dkr5dSt|�d
krO|dSt|�SdS(sECall the given method, synchronously.
        :Since: 0.81.0
        s1Methods may not be called on the reserved path %ss6Methods may not be called on the reserved interface %sR;R)s*unexpected keyword argument 'utf8_strings'R�R�R�R�R�s<Unable to set arguments %r according to signature %r: %s: %siiN(RR	RR[RR�R/R0RRMR�RcRdReRfRSt!send_message_with_reply_and_blockR\R]R+Ro(R4R|R7R8R�R�RR�R;RR�RgR�t
reply_messaget	args_list((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyt
call_blockinggs<

	
	cCs|jj|�dS(s�Arrange for `callable` to be called with one argument (this
        Connection object) when the Connection becomes
        disconnected.

        :Since: 0.83.0
        N(RuRM(R4tcallable((s5/usr/lib64/python2.7/site-packages/dbus/connection.pytcall_on_disconnection�sN(RlRmt__doc__RR�RDR}R+RWR�R�R�RjR�R{R/R�R�R�(((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyR�s*		&`	7		 >+(s
ConnectionsSignalMatch("t__all__t
__docformat__RcRwR,t_dbus_bindingsRt_ConnectionRRRRRRtdbus.exceptionsR	t
dbus.lowlevelR
RRR
Rtdbus.proxiesRtdbus._compatRRRRt	getLoggerReRtobjectR(((s5/usr/lib64/python2.7/site-packages/dbus/connection.pyt<module>s 4(	�