@ia`$ddlZ ddlmZn#e$r ddlmZYnwxYwddlZddlmZddlm Z m Z m Z m Z dZ ejdZddlmZmZmZmZmZddlmZGd d ZGd d ZGd deZGddeZdS)N)RLock)process_introspection_data) DBusExceptionIntrospectionParserExceptionMissingErrorHandlerExceptionMissingReplyHandlerExceptionrestructuredtextz dbus.proxies)BUS_DAEMON_IFACEBUS_DAEMON_NAMEBUS_DAEMON_PATHINTROSPECTABLE_IFACE LOCAL_PATH)is_py2c$eZdZdZdZdZdZdS)_DeferredMethodzXA proxy method which will only get called once we have its introspection reply. cH||_|j|_||_||_dSN) _proxy_method _method_name_append_block)self proxy_methodappendblocks ./usr/lib/python3/dist-packages/dbus/proxies.py__init__z_DeferredMethod.__init__8s')(5  cd|vs|ddr||j||dS||j|i|S)N reply_handler ignore_replyF)getrrrrargskeywordss r__call__z_DeferredMethod.__call__?sj x ' ' LL / / ( LL+T8 < < <4 KKMMM%4%t8x88 8rc>||j||dSr)rrr#s r call_asyncz_DeferredMethod.call_asyncJs! T'x88888rN__name__ __module__ __qualname____doc__rr&r(rrrr4sK 9 9 999999rrc$eZdZdZdZdZdZdS) _ProxyMethodzA 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. c|tkrtdtz||_||_||_||_t j|||_|t j |||_ dS)Nz1Methods may not be called on the reserved path %s) rr_proxy _connection_named_service _object_path_dbus_bindingsvalidate_member_namervalidate_interface_name_dbus_interface)rproxy connectionbus_name object_path method_nameifaces rrz_ProxyMethod.__init__Us * $ $!*,6!788 8 % )'*+K888*    25 9 9 9$rc p|dd}|dd}|dd}|dd}||1|t|t|rtd|d|j}|7||j}n |dz|jz}|jj|d}|s|+|j j |j |j ||j||||fi|dS|j j |j |j ||j||fi|S) Nr error_handlerr!F signaturez6ignore_reply and reply_handler cannot be used togetherdbus_interface.)poprr TypeErrorr9rr2_introspect_method_mapr"r3r(r4r5 call_blocking) rr$r%r rAr!rBrCkeys rr&z_ProxyMethod.__call__is _d;;  _d;; ||NE:: LLd33  $ (A$2444&2444 1!0111"&68LMM  %'$s*T->> :>>sDIII  >=4 'D  '(;(,(9(6(,(9(1(,(5(5 4 4+3 4 4 4 4 424#1$2E262C2@262C2;26 >> 5= >> >rc |dd}|dd}|dd}|d|j}|7|r|dz|jz}n|j}|jj|d}|jj|j|j ||j||||fi|dS)Nr rArBrCrD) rEr9rr2rGr"r3r(r4r5)rr$r%r rArBrCrIs rr(z_ProxyMethod.call_asyncs _d;;  _d;; LLd33 !&68LMM   ($s*T->>' :>>sDIII##D$7$($5$2$($5$-$($1$1 0 0'/ 0 0 0 0 0rNr)r.rrr0r0NsL %%%(*>*>*>X00000rr0ceZdZdZeZeZdZdZ dZ ddZ e d ddd Z e d ddd Ze d dddZddZdZdZdZdZdZdZdZddZdZeZdS) ProxyObjectzA proxy to the remote Object. A ProxyObject is provided by the Bus. ProxyObjects have member functions, and can be called like normal Python objects. rNTFc R|dd}|,|td|}ddlm}|dtd|d d} | ,|td | }ddlm}|d td|r7td d |z|r|||_|tj ||x|_ |_ tj |||_|s|||_ d|_g|_i|_t'|_|r|jt*kr|j|_dS|j|_||_dS)aInitialize 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 busNz%conn and bus cannot both be specifiedr)warnz`Passing the bus parameter to ProxyObject by name is deprecated: please use positional parametersrN) stacklevel named_servicez3bus_name and named_service cannot both be specifiedzjPassing the named_service parameter to ProxyObject by name is deprecated: please use positional parametersz>ProxyObject.__init__ does not take these keyword arguments: %sz, )rErFwarningsrQDeprecationWarningjoinkeys_require_main_loop_busr6validate_bus_namer4_requested_bus_namevalidate_object_path__dbus_object_path__activate_name_owner_pending_introspect_pending_introspect_queuerGr_introspect_lockr INTROSPECT_STATE_DONT_INTROSPECT_introspect_state'INTROSPECT_STATE_INTROSPECT_IN_PROGRESS _Introspect) rconnr<r= introspectfollow_name_owner_changeskwargsrPrQrSs rrzProxyObject.__init__s,jj%% ? GHHHD % % % % % % D@# 3 3 3 3 ?D99  $#!,---$H % % % % % % DC# 3 3 3 3  84"ii 66788 8 % &  # # % % %    ,X 6 6 6:BAd6+K888$/!( E"&":":8"D"DD $( )+&&(#!& :T6*DD%)%JD " " "%)%QD "'+'7'7'9'9D $ $ $rc|jSr)r4rs rzProxyObject.s T%8raThe 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. c|jSr)r[rks rrlzProxyObject. s t/Grz[The bus name which was requested when this proxy was instantiated. c|jSr)r]rks rrlzProxyObject.&s (ArzThe object-path of this proxy.c F|jj|f|||j|jd|S)ax 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). ) signal_namerCr<path)rYadd_signal_receiverr4r]rrphandler_functionrCr%s rconnect_to_signalzProxyObject.connect_to_signal2sGx & %&6 22=5C/3/B+/+D  2 2 )1  2 2 2rc pi}|jj|j|jtddd|j|jfddi|S)N Introspectr.require_main_loopF)rYr(r4r]r _introspect_reply_handler_introspect_error_handler)rris rrezProxyObject._Introspectusa#ty#D$7$($=$8,B$($B$($B GG 7< G @F GG Grc@|jD]\}}}||i|g|_dSr)r`)rrr$r%s r_introspect_execute_queuez%ProxyObject._introspect_execute_queue~sC/3.L , , *\4 L$ +( + + + +)+&&&rc|j t||_nF#t$r9}||Yd}~|jdSd}~wwxYw|j|_d|_ | |jdS#|jwxYwr) raacquirerrGrr{release INTROSPECT_STATE_INTROSPECT_DONErcr_r})rdataes rrzz%ProxyObject._introspect_reply_handlers %%''' , .H.N.N++/   ..q111  ! ) ) + + + + + &*%JD "'+D $  * * , , ,  ! ) ) + + + + +D ! ) ) + + + +s+1B9 A4A/B9/A44*B99Cctjtd|j|j|jj|jj||j  t d|j |_ d|_||j dS#|j wxYw)Nz$Introspect error on %s:%s: %s.%s: %sz'Executing introspect queue due to error)logging basicConfig_loggererrorr4r] __class__r+r*rardebugrbrcr_r}r)rrs rr{z%ProxyObject._introspect_error_handlers <)4+Do0%/2J    %%''' , MMC D D D%)%JD "'+D $  * * , , ,  ! ) ) + + + + +D ! ) ) + + + +s +ACC"c|j |j|j|jdS#|jwxYwr)rarr_rrrks r_introspect_blockzProxyObject._introspect_blocksr %%''' ,'3(..000  ! ) ) + + + + +D ! ) ) + + + +s AA1c|j |j|jkr|j|||fn||i||jdS#|jwxYwr)rarrcrdr`rr)rcallbackr$ris r_introspect_add_to_queuez$ProxyObject._introspect_add_to_queues %%''' ,%)UUU.55xv6NOOOO$)&)))  ! ) ) + + + + +D ! ) ) + + + +s 6A,,Bc|dr$|drt|||SN__) startswithendswithAttributeErrorget_dbus_methodrmembers r __getattr__zProxyObject.__getattr__sM   T " " 0vt'<'< 0 (( (''// /rc|||j|j|j||}|j|jkr!|||j|j}|S)a,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. ) ProxyMethodClassrYr4r]rcrdDeferredMethodClassrr)rrrCrets rrzProxyObject.get_dbus_methodsn.##D$)$($7$($=v$244  !T%Q Q Q**30M+/+ACCC rcLd|j|j|jt|fzS)Nz&)rYr4r]idrks r__repr__zProxyObject.__repr__s.7 It*D,Er$xx9QQ Qr)NNNTFr)r*r+r,r-r0rrrrbrdrrpropertyr<requested_bus_namer=rurer}rzr{rrrrr__str__r.rrrLrLsq $)'($./+'($=As )>rNz.The D-Bus object path of the underlying objectc|jjSr)rr<rks rrlzInterface.s di&8rz:The bus name to which the underlying proxy object is boundc|jjSr)rrrks rrlzInterface. s  0LrzGThe bus name which was requested when the underlying object was createdc|jSr)rrks rrlzInterface. s$)rzThe underlying proxy objectc|jSr)r9rks rrlzInterface.s D,@rzThe D-Bus interface representedc >|s|j}|jj|||fi|S)aaArrange 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. )r9rrurss rruzInterface.connect_to_signalsG 2!1N*ty*;8H+9GG=EGG Grc|dr$|drt||j||jSr)rrrrrr9rs rrzInterface.__getattr__"sV   T " " Kvt'<'< K (( (9,,VT5IJJ JrcJ||j}|j||S)a&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. )r9rr)rrrCs rrzInterface.get_dbus_method(s*  !!1Ny((@@@rc@d|j|jt|fzS)Nz%)rr9rrks rrzInterface.__repr__4s&6 4'D833 3rr)r*r+r,r-rrr=r]r<rrrCrurrrrr.rrrrs5 . . .(>>dLNNK&x88$$%%H"#L#L#'$CDD833T4>@@LX@@$DFFN*.GGGG KKK A A A A333GGGrr)r threadingr ImportErrordummy_threadingr6dbus._expat_introspect_parserrdbus.exceptionsrrrr __docformat__ getLoggerrr r r r r dbus._compatrrr0rrLrr.rrrs8&&&&%%%%%%%%&DDDDDD""""""""""""#  ' N + + 999999994]0]0]0]0]0]0]0]0@{{{{{&{{{| KKKKKKKKKKs