@iasDdZdZddlZddlZddlmZmZmZmZm Z m Z m Z m Z m Z mZmZmZmZmZmZmZmZmZmZmZmZmZmZddlmZddlmZddl m!Z!ddl"m#Z#d ed ed ed Z$ d Z%ejLdZ'Gdde(Z)GddeZ*y)) BusConnectionreStructuredTextN)BUS_DAEMON_IFACEBUS_DAEMON_NAMEBUS_DAEMON_PATH BUS_SESSION BUS_STARTER BUS_SYSTEM DBUS_START_REPLY_ALREADY_RUNNINGDBUS_START_REPLY_SUCCESSNAME_FLAG_ALLOW_REPLACEMENTNAME_FLAG_DO_NOT_QUEUENAME_FLAG_REPLACE_EXISTINGRELEASE_NAME_REPLY_NON_EXISTENTRELEASE_NAME_REPLY_NOT_OWNERRELEASE_NAME_REPLY_RELEASED REQUEST_NAME_REPLY_ALREADY_OWNERREQUEST_NAME_REPLY_EXISTSREQUEST_NAME_REPLY_IN_QUEUE REQUEST_NAME_REPLY_PRIMARY_OWNERvalidate_bus_namevalidate_error_namevalidate_interface_namevalidate_member_namevalidate_object_path) Connection) DBusException)HANDLER_RESULT_NOT_YET_HANDLED)is_py2ztype='signal',sender='z ',interface='z"',member='NameOwnerChanged',path='z ',arg0='%s'z)org.freedesktop.DBus.Error.NameHasNoOwnerzdbus.busceZdZdZdZdZy)NameOwnerWatch)_match _pending_callc tfd}fd}|j|dttt|_|j tttddf||_y)Nc|yN)owned old_owner new_ownercallbacks */usr/lib/python3/dist-packages/dbus/bus.py signal_cbz*NameOwnerWatch.__init__..signal_cbBs Y c|jtk(r dytjtj d|j |dfy)NzGetNameOwner(%s) failed:)exc_info) get_dbus_name_NAME_HAS_NO_OWNERlogging basicConfig_loggerdebug __class__)ebus_namer+s r,error_cbz)NameOwnerWatch.__init__..error_cbEsJ $66 ##% 8(() Q'=?r.NameOwnerChanged)arg0 GetNameOwners)radd_signal_receiverrrrr" call_asyncr#)selfbus_connr:r+r-r;s `` r,__init__zNameOwnerWatch.__init__?sm(#  ?2293E3C3B3B8@ 3B &001@1A1?14xk198 Er.c|j|jj|j|jjd|_d|_yr&)r"remover#cancelrBs r,rGzNameOwnerWatch.cancelZsI ;; " KK      )    % % ' !r.N)__name__ __module__ __qualname__ __slots__rDrGr'r.r,r!r!<s+IE6"r.r!ceZdZdZeZ eZ eZ e Z e Z edfdZ dfd ZdZdZ ddZdZdd Zdd Zd Zd Zd ZdZdZdZdZdZdZdZxZ S)rzxA connection to a D-Bus daemon that implements the ``org.freedesktop.DBus`` pseudo-service. :Since: 0.81.0 Ncn|j||}tj|_i|_ |S)N)mainloop) _new_for_busweakrefWeakValueDictionary _bus_names_signal_sender_matches)clsaddress_or_typerObuss r,__new__zBusConnection.__new__ws9B!446%'"5 r.c j |jdd}|$| td|}ddlm}|dtdt t ||||||fi| |D|tk7r;|ddd k(r fd } n j} |j|| } | |j <|jt  S) N named_service3bus_name and named_service cannot both be specifiedrwarnzrPassing the named_service parameter to add_signal_receiver by name is deprecated: please use positional parameters stacklevel:c2|dk(rjyy)Nr0)rF)r*matchs r,r+z3BusConnection.add_signal_receiver..callbacks B 'r.)pop TypeErrorwarningsr]DeprecationWarningsuperrr@rset_sender_name_ownerwatch_name_ownerrTadd_match_stringstr) rBhandler_function signal_namedbus_interfacer:pathkeywordsrZr]r+watchrdr8s @r,r@z!BusConnection.add_signal_receivers! _d;  $#!,--$H % K# 3mT> +~x" "  X%@|s"'!66))(H=E16D ' ' . c%j) r.c|jt||jj|d}||j yyr&) remove_match_string_non_blockingrmrTrerG)rBrdrss r,_clean_up_signal_matchz$BusConnection._clean_up_signal_matchs@ --c%j9++//t<   LLN r.c|#|dddk7r|tk7r |j|S|S#t$rD}|jtk7r|j ||j|cYd}~Sd}~wwxYw)Nrarb)rget_name_ownerrr2r3start_service_by_name)rBr:r9s r,activate_name_ownerz!BusConnection.activate_name_owners~  Xbq\S%8O+ 5**844O! 5??$(::**84**844  5s( A59A0*A50A5c |r|j|jdd}|$| tdddlm}|dt d|}|r+td d j |jz|j||||| S) aJReturn 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 `follow_name_owner_changes` : bool If the object path is a well-known name and this parameter is false (default), resolve the well-known name to the unique name of its current owner and bind to that instead; if the ownership of the well-known name changes in future, keep communicating with the original owner. This is necessary if the D-Bus API used is stateful. If the object path is a well-known name and this parameter is true, whenever the well-known name changes ownership in future, bind to the new owner, if any. If the given object path is a unique name, this parameter has no effect. :Returns: a `dbus.proxies.ProxyObject` :Raises `DBusException`: if resolving the well-known name to a unique name fails rZNr[rr\ziPassing the named_service parameter to get_object by name is deprecated: please use positional parametersr^r_z4get_object does not take these keyword arguments: %sz, ) introspectfollow_name_owner_changes) _require_main_looprerfrgr]rhjoinkeysProxyObjectClass)rBr: object_pathr|r}kwargsrZr]s r, get_objectzBusConnection.get_objectsH %  # # % ?D9  $#!/00 % C# 3%H ,.2ii .FGH H$$T8[0:?X%Z Zr.c^t||jtttdd|fS)zGet the numeric uid of the process owning the given bus name. :Parameters: `bus_name` : str A bus name, either unique or well-known :Returns: a `dbus.UInt32` :Since: 0.80.0 GetConnectionUnixUserr?r call_blockingrrrrBr:s r, get_unix_userzBusConnection.get_unix_users0 (#!!/?"24K"%{4 4r.c dt|d|jtttdd||ffS)a?Start a service which will implement the given bus name on this Bus. :Parameters: `bus_name` : str The well-known bus name to be activated. `flags` : dbus.UInt32 Flags to pass to StartServiceByName (currently none are defined) :Returns: A tuple of 2 elements. The first is always True, the second is either START_REPLY_SUCCESS or START_REPLY_ALREADY_RUNNING. :Raises `DBusException`: if the service could not be started. :Since: 0.80.0 TStartServiceByNamesur)rBr:flagss r,ryz#BusConnection.start_service_by_names=" (#d((/)9)=)-%/@BC Cr.c dt|d|jtttdd||fS)aRequest a bus name. :Parameters: `name` : str The well-known name to be requested `flags` : dbus.UInt32 A bitwise-OR of 0 or more of the flags `NAME_FLAG_ALLOW_REPLACEMENT`, `NAME_FLAG_REPLACE_EXISTING` and `NAME_FLAG_DO_NOT_QUEUE` :Returns: `REQUEST_NAME_REPLY_PRIMARY_OWNER`, `REQUEST_NAME_REPLY_IN_QUEUE`, `REQUEST_NAME_REPLY_EXISTS` or `REQUEST_NAME_REPLY_ALREADY_OWNER` :Raises `DBusException`: if the bus daemon cannot be contacted or returns an error. F allow_unique RequestNamerr)rBnamers r, request_namezBusConnection.request_names3$ $U3!!/?"2M"&u 7 7r.cbt|d|jtttdd|fS)asRelease a bus name. :Parameters: `name` : str The well-known name to be released :Returns: `RELEASE_NAME_REPLY_RELEASED`, `RELEASE_NAME_REPLY_NON_EXISTENT` or `RELEASE_NAME_REPLY_NOT_OWNER` :Raises `DBusException`: if the bus daemon cannot be contacted or returns an error. Fr ReleaseNamer?r)rBrs r, release_namezBusConnection.release_name/s1 $U3!!/?"2M"%w0 0r.cF|jtttdddS)zReturn a list of all currently-owned names on the bus. :Returns: a dbus.Array of dbus.UTF8String :Since: 0.81.0 ListNamesr0r'rrrrrHs r, list_nameszBusConnection.list_names@s% !!/?"2K"$b* *r.cF|jtttdddS)zReturn a list of all names that can be activated on the bus. :Returns: a dbus.Array of dbus.UTF8String :Since: 0.81.0 ListActivatableNamesr0r'rrHs r,list_activatable_namesz$BusConnection.list_activatable_namesJs& !!/?"24J"$b* *r.cbt|d|jtttdd|fS)zReturn the unique connection name of the primary owner of the given name. :Raises `DBusException`: if the `bus_name` has no owner :Since: 0.81.0 Frr>r?rrs r,rxzBusConnection.get_name_ownerTs1 (7!!/?"2N"%{4 4r.ct|||S)aWatch the unique connection name of the primary owner of the given name. `callback` will be called with one argument, which is either the unique connection name, or the empty string (meaning the name is not owned). :Since: 0.81.0 )r!)rBr:r+s r,rkzBusConnection.watch_name_owner`sdHh77r.c Zt|jtttdd|fS)zReturn True iff the given bus name has an owner on this bus. :Parameters: `bus_name` : str The bus name to look up :Returns: a `bool` NameHasOwnerr?)boolrrrrrs r,name_has_ownerzBusConnection.name_has_ownerls.D&&'7'*XK9: :r.cJ|jtttdd|fy)Arrange for this application to receive messages on the bus that match the given rule. This version will block. :Parameters: `rule` : str The match rule :Raises `DBusException`: on error. :Since: 0.80.0 AddMatchr?NrrBrules r,rlzBusConnection.add_match_stringxs" ?O+Ztg Gr.c N|jtttdd|fddy)=Arrange for this application to receive messages on the bus that match the given rule. This version will not block, but any errors will be ignored. :Parameters: `rule` : str The match rule :Raises `DBusException`: on error. :Since: 0.80.0 rr?NrArrrrs r,add_match_string_non_blockingz+BusConnection.add_match_string_non_blockings$ (*cD7d $r.cJ|jtttdd|fy)r RemoveMatchr?Nrrs r,remove_match_stringz!BusConnection.remove_match_strings" ?O+]C$ Jr.c N|jtttdd|fddy)rrr?Nrrs r,ruz.BusConnection.remove_match_string_non_blockings$ (-tgd $r.)NNNN)TF)r)!rIrJrK__doc__r TYPE_SESSIONr TYPE_SYSTEMr TYPE_STARTERr START_REPLY_SUCCESSr START_REPLY_ALREADY_RUNNINGrXr@rvrzrrryrrrrrxrkrrlrrru __classcell__)r8s@r,rrcs "LH KHL$3"B%1D AE:>!%@ <@-27Zr 4C27.0"** 4 8 : G$ J$r.r)+__all__ __docformat__r4rQ_dbus_bindingsrrrrr r r r r rrrrrrrrrrrrrrdbus.connectionrdbus.exceptionsr dbus.lowlevelr dbus._compatr_NAME_OWNER_CHANGE_MATCHr3 getLoggerr6objectr!rr'r.r,rs2 "  I I I I I I I')8 /0@. 0  A '  J '$"V$"NO$JO$r.