@iaidZdZddlZddlZddlZddlmZmZm Z m Z m Z m Z m Z ddlmZddlmZmZmZmZmZddlmZddlmZmZdd lmZejd Zd ZGd d eZ GddeZdS)) Connection SignalMatchreStructuredTextN)r LOCAL_IFACE LOCAL_PATHvalidate_bus_namevalidate_interface_namevalidate_member_namevalidate_object_path) DBusException) ErrorMessageHANDLER_RESULT_NOT_YET_HANDLEDMethodCallMessageMethodReturnMessage SignalMessage) ProxyObject)is_py2is_py3)Stringzdbus.connectioncdSN)argskwargss 1/usr/lib/python3/dist-packages/dbus/connection.py_noopr0sDceZdZgdZeeZ ddZdZdZdZ e dZ d Z d Z d Zd Zd ZdZdS)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_matchFNc |t||t||t||t|d|_t j||_||_||_ ||_ ||_ ||_ ||_ d|vrtd||_||_| |_| |_| |_| |_| |_||_|s d|_dSi|_|D]}|dstd|z t3|dd}n #t4$rtd|zwxYw|dks|dkrtd|z|||j|<dS) N utf8_strings*unexpected keyword argument 'utf8_strings'argz(SignalMatch: unknown keyword argument %sr?z9SignalMatch: arg match index must be in range(64), not %d)r r rr r&weakrefrefr(r"r!r r#r$r TypeErrorr'r-r.r,r*r+r)r%r/ startswithint ValueError)selfconnsender object_pathdbus_interfacememberhandler byte_arrayssender_keyword path_keywordinterface_keywordmember_keywordmessage_keyworddestination_keywordrkwargindexs r__init__zSignalMatch.__init__>s    ( ( (  % #N 3 3 3   f % % %  "  - - - $[.. (    #) V # #HII I'-)-"3 /$7!! <#'D #%D  < <''..-#$N&+%,----abb NNEE!---#$N&+%,----199 #%8:?%@AAA.4Um$U++ < zSignalMatch.s4<rc|jdg}|j|d|jz|j|d|jz|j|d|jz|j|d|jz|j9|jD]\}}|d||fz d||_|jS)Nz type='signal'z sender='%s'z path='%s'zinterface='%s'z member='%s'z arg%d='%s',) r&r"appendr#r!r r/itemsjoin)r<rulerKvalues r__str__zSignalMatch.__str__s : #$D|' MDL8999z% K$*4555* ,t>???|' MDL8999#/$($8$>$>$@$@??LE5KK u~ =>>>>$DJzrcfd|jt||j|fzS)Nz<%s at %x "%s" on conn %r>) __class__rPr&r(rQs r__repr__zSignalMatch.__repr__s3,>2d88TZ9K9K9M9MNO Prc||_dSr)r)r<new_names rset_sender_name_ownerz!SignalMatch.set_sender_name_owners"*rc |d|jfvrdS||jkrdS||jkrdS||jkrdS||jkrdS||jkrdSdS)NFT)r$r"r#r!r r%)r<r>r?r@rArBrs rmatches_removal_specz SignalMatch.matches_removal_specsy 4/ / /5 T\ ! !5 $* $ $5 T_ , ,5 T\ ! !5 T% % %5trcXd}|jd|fvrdS|jytd}|jdi|}|jD]B\}}|t |ks't||tr |||krdSC|j d| fvrdS|j d| fvrdS|j d|fvrdS ||js||j}i}|j|||j<|j|||j<|j|||j<|j| ||j<|j| ||j<|j |||j<|j|i|n6#t1jt4ddYnxYwdS)NFTrCz&Exception in handler for D-Bus signal:exc_infor)r get_senderr/dict get_args_listr^len isinstancerr get_memberr! get_interfacer#get_pathr'r-r)get_destinationr.r,r*r+r$logging basicConfig_loggererror)r<messagerrrKras rmaybe_handle_messagez SignalMatch.maybe_handle_messagest  "41C1C1E1E*F F F5   +d+++F(7(22622D $ 4 : : < < ! ! uSYY&&%d5k6::'E{e++ 55, <g&8&8&:&:; ; ;5 ?4)>)>)@)@"A A A5 :dG$4$4$6$67 7 75 P|4#4|,,9J,KKF#//6/A/A/C/Ct+,(44;4K4K4M4Mt01!--4-=-=-?-?t)*#//6/A/A/C/Ct+,&2292G2G2I2It./$007t,- DM4 *6 * * * * P   ! ! ! MMBQM O O O O Ots C3G441H'c|}|-|j||j|j|j|jfi|jdSdSr)r(remove_signal_receiverr r!r"r#r%)r<r=s rremovezSignalMatch.removesh!!##   'D 'dl(,(,  < <+/*: < < < < <  r)FNNNNNN)__name__ __module__ __qualname___slotstuple __slots__rLrRrVrXpropertyr>rbrerhrjr~rrrrrr4sEEEFf I/4378<;? 7<7<7<7"+!1!1D  =  # #DN$? @ @ @ @ @ A Arc|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)r<bus_names ractivate_name_ownerzConnection.activate_name_owners rNTc .|dd}|,|tdddlm}|dtd|}|r7td d |z||||| S) aReturn 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_serviceN3bus_name and named_service cannot both be specifiedrwarnziPassing 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)popr8warningsrDeprecationWarningr_keysProxyObjectClass)r<rr?rrrrs r get_objectzConnection.get_objects( ?D99  $#!/000 % % % % % % DC# 3 3 3 3%H  H,.2ii .F.FGHH H$$T8[0:%<< >I 4   & & ( ( ( ( (3 mmK66G.   & & ( ( ( ( (+! & &$--1u1(262@2=2B >> 5= >>.$$U++++JJu%%%% I), +&&k* I$^4'I B4H   & & ( ( ( (D  & & ( ( ( ( / /E  ' ' . . . . / /s#E>E>E>A E>>FcdSrr)r<rs rrz!Connection._clean_up_signal_matchs rct|tstS|}|}|}||||D]}|||tkrf|tkr[|dkrU|j D]M} ||#t$r2tj tddYJwxYwtS)zvD-Bus filter function. Handle signals by dispatching to Python callbacks kept in the match-rule tree. Disconnectedz-Exception in handler for Disconnected signal:rmrn)rtrrrvrwrurr~rrr Exceptionryrzr{r|)r<r}r@rrrcbs rrzConnection._signal_funcs2 '=11 21 1 ..00!!((** ,,T>-8:: 0 0E  & &w / / / / k ) ) J   > ) )2 / //BtHHHH ///')))MM#",-"////// .-s. B::9C65C6Fc  F|tkrtdtz|tkrtdtzt| d| vrt dt ||||} | j|d|inI#t$r<}tj t d|||j |d }~wwxYw| | d Sttfd }|| || | 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 %s6Methods may not be called on the reserved interface %srlr1r2 destinationr interfacemethod signature.msg_reply_handlerLs'#677 B 4w4EE}EEFFFFG\22 B m-4-B-B-D-DF1G1G1I1IFFGGGGG i)68?)@AABBBBBr)require_main_loop)rr rrqr8rr]rryrzr{r|rd send_messagersend_message_with_reply)r<rr?r@rrrrrtimeoutrCrrr}errs `` @r call_asynczConnection.call_asyncs * $ $!*,6!788 8 [ ( (!/1<!=>> >555 V # #HII I#)4.<+1333   GN 6Y 6 6 6 6      ! ! ! MM1 1; ; ; ;     ]%:   g & & & F  !M  !M B B B B B B B++G5F(/:K,MM Ms? B C7CCc  j|tkrtdtz|tkrtdtzt|} d| vrt dt ||||} | j|d|inI#t$r<} tj t d||| j | d } ~ wwxYw| | |} | jd i| }t|d krd St|d kr|d St!|S) zECall the given method, synchronously. :Since: 0.81.0 rrrlr1r2rrrNrrmr)rr rrqr8rr]rryrzr{r|rd!send_message_with_reply_and_blockrrrsr)r<rr?r@rrrrrCrrr}r reply_message args_lists r call_blockingzConnection.call_blockingYs * $ $!*,6!788 8 [ ( (!/1<!=>> >555 V # #HII I#)4.<+1333   GN 6Y 6 6 6 6      ! ! ! MM1 1; ; ; ;   >> W /M/@@-@@ y>>Q  4 ^^q Q< ## #s< B C7C  Cc:|j|dS)zArrange for `callable` to be called with one argument (this Connection object) when the Connection becomes disconnected. :Since: 0.83.0 N)rr])r<callables rcall_on_disconnectionz Connection.call_on_disconnections! $++H55555r)NNT)NNNN)rFT)rF)rrr__doc__rrrLrrrrrrrrrr __classcell__)rds@rrrs8 #AAAAA& #<#<#<#rs2 (" IIIIIIIIIIIIIIIIII*)))))((((((((((((((%$$$$$''''''''!!!!!! ' - . .   u<u<u<u<u<&u<u<u