grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a Êic^-ã@sðddlZddlZddlmZmZddlmZmZddlm Z m Z ddl m Z ddl mZddlZe dd¡dd lmZe e¡Zgd ¢ZGd d „d eƒZGd d„ded�ZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZdS)éN)ÚABCMetaÚabstractmethod)Ú DBUS_NAME_FLAG_ALLOW_REPLACEMENTÚ%DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)Ú ObjectProxyÚInterfaceProxy)Ú ErrorMapper)ÚServerObjectHandlerÚGioz2.0)r )ÚGLibConnectionÚ MessageBusÚSystemMessageBusÚSessionMessageBusÚAddressedMessageBusc@sPeZdZdZejjejjBZe d dd„ƒZ e d dd„ƒZ e eddfdd„ƒZ dS) r z4The low-level DBus connection library based on GLib.NcCst d¡t tjj|¡S)zGet a system bus connection.úConnecting to the system bus.)ÚlogÚinfor Ú bus_get_syncÚBusTypeZSYSTEM©Ú cancellable©rú5/usr/lib/python3.9/site-packages/dasbus/connection.pyÚget_system_bus_connection6s  þz(GLibConnection.get_system_bus_connectioncCst d¡t tjj|¡S)zGet a session bus connection.úConnecting to the session bus.)rrr rrZSESSIONrrrrÚget_session_bus_connection?s  þz)GLibConnection.get_session_bus_connectioncCstj ||||¡S)ú3Get a connection to a bus at the specified address.)r ZDBusConnectionZnew_for_address_sync)Z bus_addressÚflagsZobserverrrrrÚget_addressed_bus_connectionHs üz+GLibConnection.get_addressed_bus_connection)N)N) Ú__name__Ú __module__Ú __qualname__Ú__doc__r ZDBusConnectionFlagsZAUTHENTICATION_CLIENTZMESSAGE_BUS_CONNECTIONZ DEFAULT_FLAGSÚ staticmethodrrrrrrrr .sÿÿ  ÿr c@sZeZdZdZeedd„ƒƒZdd„Zeddd„ƒZed d „ƒZ ed d „ƒZ ed d„ƒZ dS)ÚAbstractMessageBusa Abstract representation of a message bus. The property connection represents a connection to the bus. You can register a service name with register_service, or publish an object with publish_object and get a proxy of a remote object with get_proxy. cCsdS)úThe DBus connection.Nr©ÚselfrrrÚ connection\szAbstractMessageBus.connectionc CsDz |jduWSty>}zt d|¡WYd}~dSd}~00dS)znCheck if the connection is set up. :return: True if the connection is set up otherwise False NzConnection can't be created: %sF)r(Ú ExceptionrZwarning)r'ÚerrrÚcheck_connectionbs   z#AbstractMessageBus.check_connectionNcKsdS)aReturns a proxy of a remote DBus object. :param service_name: a DBus name of a service :param object_path: a DBus path of an object :param interface_name: a DBus name of an interface or None :return: a proxy object Nr)r'Ú service_nameÚ object_pathÚinterface_nameÚkwargsrrrÚ get_proxyms zAbstractMessageBus.get_proxycKsdS)aRegister a service on DBus. A service can be registered by requesting its name on DBus. This method should be called only after all of the required objects of the service are published on DBus. :param service_name: a DBus name of a service Nr)r'r,r/rrrÚregister_serviceys z#AbstractMessageBus.register_servicecKsdS)z›Publish an object on DBus. :param object_path: a DBus path of an object :param obj: an instance of @dbus_interface or @dbus_class Nr)r'r-Úobjr/rrrÚpublish_object…sz!AbstractMessageBus.publish_objectcCsdS)úDisconnect from DBus.Nrr&rrrÚ disconnectŽszAbstractMessageBus.disconnect)N) rr r!r"Úpropertyrr(r+r0r1r3r5rrrrr$Ts     r$)Ú metaclasscs”eZdZdZdef‡fdd„ Zedd„ƒZedd„ƒZ ed d „ƒZ dd d „Z d d„Z e fdd„Zefdd„Zdd„Zdd„Zdd„Zdd„Z‡ZS)r z/Representation of a message bus based on D-Bus.Ncs:tƒ ¡||_|ptƒ|_d|_d|_i|_tƒ|_ dS)zŒCreate a new message bus. :param error_mapper: a DBus error mapper :param provider: a provider of DBus connections N) ÚsuperÚ__init__Ú _providerrÚ _error_mapperÚ _connectionÚ_proxyÚ_registrationsÚsetÚ_requested_names)r'Ú error_mapperZprovider©Ú __class__rrr9—s  zMessageBus.__init__cCs|js| ¡|_|jS)r%)r<Ú_get_connectionr&rrrr(¥s zMessageBus.connectioncCsdS)zReturn a DBus connection.Nrr&rrrrD­szMessageBus._get_connectioncCs|js| dd¡|_|jS)zThe proxy of DBus.zorg.freedesktop.DBusz/org/freedesktop/DBus)r=r0r&rrrÚproxy²s þzMessageBus.proxycKs@| |¡|s|rtnt}|r&||d<||||fd|ji|¤ŽS)aªReturns a proxy of a remote DBus object. If the proxy factory is not specified, we will use a default one. If the interface name is set, we will choose InterfaceProxy, otherwise ObjectProxy. If the interface name is set, we will add it to the additional arguments for the proxy factory. :param service_name: a DBus name of a service :param object_path: a DBus path of an object :param interface_name: a DBus name of an interface or None :param proxy_factory: a factory of a DBus object proxy :param proxy_arguments: additional arguments for the proxy factory :return: a proxy object r.rA)Ú_check_service_accessrrr;)r'r,r-r.Z proxy_factoryZproxy_argumentsrrrr0¾s  ýüûzMessageBus.get_proxycCs4||jvrdSt ¡t ¡ur"dStd |¡ƒ‚dS)aßCheck if we can access a DBus service. FIXME: This is a temporary check that should be later removed. This is useful during the transition of the Anaconda code from UI to DBus modules. This check prevents a deadlock in case that a DBus module tries to access a service, that it provides, from the main thread. :param service_name: a DBus name of a service :raises: RuntimeError if the service cannot be accessed Nz4Can't access DBus service '{}' from the main thread.)r@Ú threadingÚcurrent_threadÚ main_threadÚ RuntimeErrorÚformat©r'r,rrrrFàs ÿÿz MessageBus._check_service_accesscsTt dˆ¡ˆj ˆ|¡}|tkr0td |¡ƒ‚ˆj ˆ¡‡‡fdd„ˆj ˆ<dS)z£Register a service on DBus. :param service_name: a DBus name of a service :param flags: the flags argument of the RequestName DBus method zRegistering a service name %s.zName request has failed: {}cs ˆj ˆ¡S)N)rEZ ReleaseNamerrLrrÚ óz-MessageBus.register_service..N) rÚdebugrEZ RequestNamerÚConnectionErrorrKr@Úaddr>)r'r,rÚresultrrLrr1ûs ÿ ÿzMessageBus.register_servicecKs>t d|¡||||fd|ji|¤Ž}| ¡|j|j|<dS)a1Publish an object on DBus. :param object_path: a DBus path of an object :param obj: an instance of @dbus_interface or @dbus_class :param server_factory: a factory of a DBus server object handler :param server_arguments: additional arguments for the server factory zPublishing an object at %s.rAN)rrOr;Zconnect_objectZdisconnect_objectr>)r'r-r2Zserver_factoryZserver_argumentsZobject_handlerrrrr3s ýüûzMessageBus.publish_objectcCs ||jvr|j |¡}|ƒdS)zRemove Object from DBus.N)r>Úpop)r'r-ÚcallbackrrrÚ _unregister&s  zMessageBus._unregistercCst d|¡| |¡dS)Nz Removing object %s from the bus.©rrOrU©r'r-rrrÚunpublish_object-s zMessageBus.unpublish_objectcCst d|¡| |¡dS)Nz!Removing service %s from the bus.rVrWrrrÚunregister_service1s zMessageBus.unregister_servicecCs8t d¡|jr&|j ¡\}}|ƒq d|_tƒ|_dS)r4zDisconnecting from the bus.N)rrOr>Úpopitemr<r?r@)r'Ú_rTrrrr55s  zMessageBus.disconnect)NN)rr r!r"r r9r6r(rrDrEr0rFrr1r r3rUrXrYr5Ú __classcell__rrrBrr ”s(   ÿ "ÿ ÿ r c@seZdZdZdd„ZdS)r z*Representation of a system bus connection.cCst d¡|j ¡S)zGet a system DBus connection.r)rrr:rr&rrrrDDs z SystemMessageBus._get_connectionN©rr r!r"rDrrrrr Asr c@seZdZdZdd„ZdS)rz+Representation of a session bus connection.cCst d¡|j ¡S)zGet a session DBus connection.r)rrr:rr&rrrrDMs z!SessionMessageBus._get_connectionNr]rrrrrJsrcs4eZdZdZ‡fdd„Zedd„ƒZdd„Z‡ZS)rz9Representation of a connection for the specified address.cstƒj|i|¤Ž||_dS)z\Create a new representation of a connection. :param address: a bus address N)r8r9Ú_address)r'ÚaddressÚargsr/rBrrr9VszAddressedMessageBus.__init__cCs|jS)zThe bus address.)r^r&rrrr_^szAddressedMessageBus.addresscCst d|j¡|j |j¡S)rzConnecting to a bus at %s.)rrr^r:rr&rrrrDcsz#AddressedMessageBus._get_connection) rr r!r"r9r6r_rDr\rrrBrrSs   r)ZloggingrGÚabcrrZdasbus.constantsrrZdasbus.client.proxyrrZ dasbus.errorrZdasbus.server.handlerr ZgiZrequire_versionZ gi.repositoryr Z getLoggerrrÚ__all__Úobjectr r$r r rrrrrrÚs$      &@.