3 iRVd"@sdZddlmZdZdZddlmZdd lmZm Z m Z m Z m Z m Z mZmZmZmZmZmZdd lmZdd lmZdd lmZerdd lmZGdddeZGdddeZGdddeZGdddeZdS)z9Implementation for dbus.Bus. Not to be imported directly.) generatorsBus SystemBus SessionBus StarterBusZreStructuredText) DBusException) BUS_DAEMON_IFACEBUS_DAEMON_NAMEBUS_DAEMON_PATH BUS_SESSION BUS_STARTER BUS_SYSTEM DBUS_START_REPLY_ALREADY_RUNNINGDBUS_START_REPLY_SUCCESSvalidate_bus_namevalidate_interface_namevalidate_member_namevalidate_object_path) BusConnection) SignalMessage)is_py2) UTF8StringcseZdZdZiZejddfddZfddZdd Z e e ddd Z dd d Z e e Z dd dZe eZdddZe eZddZeZZS)ra A connection to one of three possible standard buses, the SESSION, SYSTEM, or STARTER bus. This class manages shared connections to those buses. If you're trying to subclass `Bus`, you may be better off subclassing `BusConnection`, which doesn't have all this magic. FNcCsx| r||jkr|j|S|tkr(t}n(|tkr6t}n|tkrDt}n td|tj |||d}||_ |st||j|<|S)aConstructor, returning an existing instance where appropriate. The returned instance is actually always an instance of `SessionBus`, `SystemBus` or `StarterBus`. :Parameters: `bus_type` : cls.TYPE_SESSION, cls.TYPE_SYSTEM or cls.TYPE_STARTER Connect to the appropriate bus `private` : bool If true, never return an existing shared instance, but instead return a private connection. :Deprecated: since 0.82.3. Use dbus.bus.BusConnection for private connections. `mainloop` : dbus.mainloop.NativeMainLoop The main loop to use. The default is to use the default main loop if one has been set up, or raise an exception if none has been. :Changed: in dbus-python 0.80: converted from a wrapper around a Connection to a Connection subclass. zinvalid bus_type %s)mainloop) _shared_instancesr rr rr r ValueErrorr__new__ _bus_type)clsZbus_typeprivatersubclassZbusr /usr/lib64/python3.6/_dbus.pyr:s   z Bus.__new__cs4|j}|jjj||kr"|jj|=tt|jdS)N)r __class__rgetsuperrclose)selft)r"r r!r%ms z Bus.closecCs|S)zReturn self, for backwards compatibility with earlier dbus-python versions where Bus was not a subclass of Connection. :Deprecated: since 0.80.0 r )r&r r r!get_connectionsszBus.get_connectionzself._connection == self, for backwards compatibility with earlier dbus-python versions where Bus was not a subclass of Connection.cCs t|dS)zStatic method that returns a connection to the session bus. :Parameters: `private` : bool If true, do not return a shared connection. )r)r)rr r r! get_sessionszBus.get_sessioncCs t|dS)zStatic method that returns a connection to the system bus. :Parameters: `private` : bool If true, do not return a shared connection. )r)r)rr r r! get_systemszBus.get_systemcCs t|dS)zStatic method that returns a connection to the starter bus. :Parameters: `private` : bool If true, do not return a shared connection. )r)r)rr r r! get_starterszBus.get_startercCsP|jtkrd}n$|jtkr d}n|jtkr0d}nd}d|jj|jj|t|fS)NZsessionsystemZstarterzunknown bus typez<%s.%s (%s) at %#x>)rr r r r" __module____name__id)r&namer r r!__repr__s   z Bus.__repr__)F)F)F)r.r- __qualname____doc__rr TYPE_SESSIONrr%r(propertyZ _connectionr) staticmethodr*r+r1__str__ __classcell__r r )r"r!r/s  2     c@seZdZdZdddZdS)rzThe system-wide message bus.FNcCstj|tj||dS)aReturn a connection to the system bus. :Parameters: `private` : bool If true, never return an existing shared instance, but instead return a private connection. `mainloop` : dbus.mainloop.NativeMainLoop The main loop to use. The default is to use the default main loop if one has been set up, or raise an exception if none has been. )rr)rrZ TYPE_SYSTEM)rrrr r r!rs zSystemBus.__new__)FN)r.r-r2r3rr r r r!rsc@seZdZdZdddZdS)rz(The session (current login) message bus.FNcCstj|tj||dS)aReturn a connection to the session bus. :Parameters: `private` : bool If true, never return an existing shared instance, but instead return a private connection. `mainloop` : dbus.mainloop.NativeMainLoop The main loop to use. The default is to use the default main loop if one has been set up, or raise an exception if none has been. )rr)rrr4)rrrr r r!rs zSessionBus.__new__)FN)r.r-r2r3rr r r r!rsc@seZdZdZdddZdS)rzjThe bus that activated this process (only valid if this process was launched by DBus activation). FNcCstj|tj||dS)aReturn a connection to the bus that activated this process. :Parameters: `private` : bool If true, never return an existing shared instance, but instead return a private connection. `mainloop` : dbus.mainloop.NativeMainLoop The main loop to use. The default is to use the default main loop if one has been set up, or raise an exception if none has been. )rr)rrZ TYPE_STARTER)rrrr r r!rs zStarterBus.__new__)FN)r.r-r2r3rr r r r!rsN)rrrr)r3Z __future__r__all__Z __docformat__Zdbus.exceptionsrZ_dbus_bindingsrr r r r r rrrrrrZdbus.busrZ dbus.lowlevelrZ dbus._compatrrrrrrr r r r!s  8