Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/dbus/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/dbus/proxies.pyc


-"Oc@s%ddlZyddlmZWn!ek
rCddlmZnXddlZddlmZddlm	Z	m
Z
mZmZdZ
ejdZddlmZmZmZmZmZddlmZd	fd
YZdfdYZd
efdYZdefdYZdS(iN(tRLock(tprocess_introspection_data(t
DBusExceptiontIntrospectionParserExceptiontMissingErrorHandlerExceptiontMissingReplyHandlerExceptiontrestructuredtextsdbus.proxies(tBUS_DAEMON_IFACEtBUS_DAEMON_NAMEtBUS_DAEMON_PATHtINTROSPECTABLE_IFACEt
LOCAL_PATH(tis_py2t_DeferredMethodcBs)eZdZdZdZdZRS(sXA proxy method which will only get called once we have its
    introspection reply.
    cCs+||_|j|_||_||_dS(N(t
_proxy_methodt_method_namet_appendt_block(tselftproxy_methodtappendtblock((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyt__init__6s		cOsVd|ks|jdtr8|j|j||dS|j|j||SdS(Nt
reply_handlertignore_reply(tgettFalseRRtNoneR(Rtargstkeywords((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyt__call__=s
cOs|j|j||dS(N(RR(RRR((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyt
call_asyncHs(t__name__t
__module__t__doc__RRR(((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyR
2s		t_ProxyMethodcBs)eZdZdZdZdZRS(sA proxy method.

    Typically a member of a ProxyObject. Calls to the
    method produce messages that travel over the Bus and are routed
    to a specific named Service.
    cCs|tkrtdtn||_||_||_||_tj|||_|dk	rutj
|n||_dS(Ns1Methods may not be called on the reserved path %s(RRt_proxyt_connectiont_named_servicet_object_patht_dbus_bindingstvalidate_member_nameRRtvalidate_interface_namet_dbus_interface(Rtproxyt
connectiontbus_nametobject_pathtmethod_nametiface((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRSs
				
	c	Os|jdd}|jdd}|jdt}|jdd}|dk	s`|dk	r|dkrxtq|dkrtq|rtdqn|jd|j}|dkr
|dkr|j}n|d|j}|jj	j
|d}n|s|dk	rS|jj|j
|j||j|||||n+|jj|j
|j||j|||SdS(NRt
error_handlerRt	signatures6ignore_reply and reply_handler cannot be used togethertdbus_interfacet.(tpopRRRRt	TypeErrorR+RR$t_introspect_method_mapRR%RR&R't
call_blocking(	RRRRR2RR3R4tkey((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRgsD
c
Os|jdd}|jdd}|jdd}|jd|j}|dkr|rq|d|j}n	|j}|jjj|d}n|jj|j	|j
||j|||||dS(NRR2R3R4R5(R6RR+RR$R8RR%RR&R'(RRRRR2R3R4R:((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRs$	(R R!R"RRR(((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyR#Ls		,tProxyObjectcBseZdZeZeZdZdZdZ	dddeedZ
eddddZeddddZed	ddd
ZddZdZd
ZdZdZdZdZdZddZdZeZRS(sA proxy to the remote Object.

    A ProxyObject is provided by the Bus. ProxyObjects
    have member functions, and can be called like normal Python objects.
    iiic
Ks|jdd
}|d
k	re|d
k	r9tdn|}ddlm}|dtddn|jdd
}	|	d
k	r|d
k	rtd	n|	}ddlm}|d
tddn|rtddj|jn|r|jn||_	|d
k	r*t
j|n||_|_
t
j|||_|sk|j||_nd
|_g|_i|_t|_|s|jtkr|j|_n|j|_|j|_d
S(sInitialize the proxy object.

        :Parameters:
            `conn` : `dbus.connection.Connection`
                The bus or connection on which to find this object.
                The keyword argument `bus` is a deprecated alias for this.
            `bus_name` : str
                A bus name for the application owning the object, to be used
                as the destination for method calls and the sender for
                signal matches. The keyword argument ``named_service`` is a
                deprecated alias for this.
            `object_path` : str
                The object path at which the application exports the 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 true (default is false) and the `bus_name` is a
                well-known name, follow ownership changes for that name
        tbuss%conn and bus cannot both be specifiedi(twarns`Passing the bus parameter to ProxyObject by name is deprecated: please use positional parameterst
stacklevelit
named_services3bus_name and named_service cannot both be specifiedsjPassing the named_service parameter to ProxyObject by name is deprecated: please use positional parameterss>ProxyObject.__init__ does not take these keyword arguments: %ss, N(R6RR7twarningsR=tDeprecationWarningtjointkeyst_require_main_loopt_busR(tvalidate_bus_nameR&t_requested_bus_nametvalidate_object_patht__dbus_object_path__tactivate_name_ownert_pending_introspectt_pending_introspect_queueR8Rt_introspect_lockRt INTROSPECT_STATE_DONT_INTROSPECTt_introspect_statet'INTROSPECT_STATE_INTROSPECT_IN_PROGRESSt_Introspect(
RtconnR.R/t
introspecttfollow_name_owner_changestkwargsR<R=R?((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRsJ
	
				cCs|jS(N(R&(R((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyt<lambda>ssThe bus name to which this proxy is bound. (Read-only,
            may change.)

            If the proxy was instantiated using a unique name, this property
            is that unique name.

            If the proxy was instantiated with a well-known name and with
            ``follow_name_owner_changes`` set false (the default), this
            property is the unique name of the connection that owned that
            well-known name when the proxy was instantiated, which might
            not actually own the requested well-known name any more.

            If the proxy was instantiated with a well-known name and with
            ``follow_name_owner_changes`` set true, this property is that
            well-known name.
            cCs|jS(N(RG(R((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRVss[The bus name which was requested when this proxy was
            instantiated.
            cCs|jS(N(RI(R((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRV$ssThe object-path of this proxy.cKs1|jj|d|d|d|jd|j|S(sxArrange for the given function to be called when the given signal
        is received.

        :Parameters:
            `signal_name` : str
                The name of the signal
            `handler_function` : callable
                A function to be called when the signal is emitted by
                the remote object. Its positional arguments will be the
                arguments of the signal; optionally, it may be given
                keyword arguments as described below.
            `dbus_interface` : str
                Optional interface with which to qualify the signal name.
                If None (the default) the handler will be called whenever a
                signal of the given member name is received, whatever
                its interface.
        :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).
        tsignal_nameR4R.tpath(REtadd_signal_receiverR&RI(RRWthandler_functionR4R((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pytconnect_to_signal0s<	cCsSi}trt|d<n|jj|j|jtddd|j|jdt	|S(Ntutf8_stringst
Introspectttrequire_main_loop((
RtTrueRERR&RIR
t_introspect_reply_handlert_introspect_error_handlerR(RRU((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRQss
	cCs7x'|jD]\}}}|||q
Wg|_dS(N(RL(RRRR((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyt_introspect_execute_queue~scCs||jjzZyt||_Wn!tk
rF}|j|dSX|j|_d|_	|j
Wd|jjXdS(N(RMtacquireRR8RRbt INTROSPECT_STATE_INTROSPECT_DONERORRKRctrelease(Rtdatate((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRas

	cCstjtjd|j|j|jj|jj||j	j
z0tjd|j|_
d|_|jWd|j	jXdS(Ns$Introspect error on %s:%s: %s.%s: %ss'Executing introspect queue due to error(tloggingtbasicConfigt_loggerterrorR&RIt	__class__R!R RMRdtdebugRNRORRKRcRf(RRl((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRbs
	

	cCsE|jjz#|jdk	r/|jjnWd|jjXdS(N(RMRdRKRRRf(R((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyt_introspect_blocks

cCsa|jjz?|j|jkr>|jj|||fn
|||Wd|jjXdS(N(RMRdRORPRLRRf(RtcallbackRRU((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyt_introspect_add_to_queues
cCs>|jdr-|jdr-t|n
|j|SdS(Nt__(t
startswithtendswithtAttributeErrortget_dbus_method(Rtmember((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyt__getattr__scCs[|j||j|j|j||}|j|jkrW|j||j|j}n|S(s,Return a proxy method representing the given D-Bus method. The
        returned proxy method can be called in the usual way. For instance, ::

            proxy.get_dbus_method("Foo", dbus_interface='com.example.Bar')(123)

        is equivalent to::

            proxy.Foo(123, dbus_interface='com.example.Bar')

        or even::

            getattr(proxy, "Foo")(123, dbus_interface='com.example.Bar')

        However, using `get_dbus_method` is the only way to call D-Bus
        methods with certain awkward names - if the author of a service
        implements a method called ``connect_to_signal`` or even
        ``__getattr__``, you'll need to use `get_dbus_method` to call them.

        For services which follow the D-Bus convention of CamelCaseMethodNames
        this won't be a problem.
        (	tProxyMethodClassRER&RIRORPtDeferredMethodClassRqRo(RRwR4tret((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRvs		cCs#d|j|j|jt|fS(Ns&<ProxyObject wrapping %s %s %s at %#x>(RER&RItid(R((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyt__repr__sN(R R!R"R#RyR
RzRNRPReRR`RRtpropertyR.trequested_bus_nameR/R[RQRcRaRbRoRqRxRvR}t__str__(((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyR;s6	R					
C					
		&	t	InterfacecBseZdZdZeddddZeZeddddZeddddZ	edddd	Z
ed
dddZddZd
Z
ddZdZeZRS(sAn interface into a remote object.

    An Interface can be used to wrap ProxyObjects
    so that calls can be routed to their correct
    D-Bus interface.
    cCs4t|tr|j|_n	||_||_dS(s:Construct a proxy for the given interface on the given object.

        :Parameters:
            `object` : `dbus.proxies.ProxyObject` or `dbus.Interface`
                The remote object or another of its interfaces
            `dbus_interface` : str
                An interface the `object` implements
        N(t
isinstanceRtproxy_objectt_objR+(RtobjectR4((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRs		cCs
|jjS(N(RR/(R((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRVss.The D-Bus object path of the underlying objectcCs
|jjS(N(RR.(R((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRVss:The bus name to which the underlying proxy object is boundcCs
|jjS(N(RR(R((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRV	ssGThe bus name which was requested when the underlying object was createdcCs|jS(N(R(R((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRV
ssThe underlying proxy objectcCs|jS(N(R+(R((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRVssThe D-Bus interface representedcKs+|s|j}n|jj||||S(saArrange for a function to be called when the given signal is
        emitted.

        The parameters and keyword arguments are the same as for
        `dbus.proxies.ProxyObject.connect_to_signal`, except that if
        `dbus_interface` is None (the default), the D-Bus interface that
        was passed to the `Interface` constructor is used.
        (R+RR[(RRWRZR4R((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyR[s
cCsG|jdr-|jdr-t|n|jj||jSdS(NRr(RsRtRuRRvR+(RRw((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRx"scCs+|dkr|j}n|jj||S(s&Return a proxy method representing the given D-Bus method.

        This is the same as `dbus.proxies.ProxyObject.get_dbus_method`
        except that if `dbus_interface` is None (the default),
        the D-Bus interface that was passed to the `Interface` constructor
        is used.
        N(RR+RRv(RRwR4((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRv(scCsd|j|jt|fS(Ns%<Interface %r implementing %r at %#x>(RR+R|(R((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyR}4sN(R R!R"RR~RR/RIR.RRR4R[RxRvR}R(((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyRs&									(Rit	threadingRtImportErrortdummy_threadingR(tdbus._expat_introspect_parserRtdbus.exceptionsRRRRt
__docformat__t	getLoggerRkRRR	R
Rtdbus._compatRR
R#RR;R(((s0/usr/lib/python2.7/dist-packages/dbus/proxies.pyt<module>s 
"(`A