
    @iaO"                         d Z ddlmZ dZdZddlmZ ddlmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ dd	lmZ  G d
 de          Z G d de          Z G d de          Z G d de          ZdS )z9Implementation for dbus.Bus. Not to be imported directly.    )
generators)Bus	SystemBus
SessionBus
StarterBusreStructuredText)DBusException)BUS_DAEMON_IFACEBUS_DAEMON_NAMEBUS_DAEMON_PATHBUS_SESSIONBUS_STARTER
BUS_SYSTEM DBUS_START_REPLY_ALREADY_RUNNINGDBUS_START_REPLY_SUCCESSvalidate_bus_namevalidate_interface_namevalidate_member_namevalidate_object_path)BusConnection)SignalMessage)is_py2c                        e Zd ZdZi Zej        ddfdZ fdZd Z	 e
e	ddd          ZddZ ee          Zdd	Z ee          Zdd
Z ee          Zd ZeZ xZS )r   a   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.
    FNc                     |s|| j         v r| j         |         S |t          k    rt          }n8|t          k    rt          }n%|t
          k    rt          }nt          d|z            t          j	        |||          }||_
        |s
|| j         |<   |S )a  Constructor, 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.
        zinvalid bus_type %s)mainloop)_shared_instancesr   r   r   r   r   r   
ValueErrorr   __new__	_bus_type)clsbus_typeprivater   subclassbuss         ,/usr/lib/python3/dist-packages/dbus/_dbus.pyr   zBus.__new__9   s    2  	3H(===(22 {""!HH## HH$$!HH2X=>>>#HhJJJ  	2.1C!(+
    c                     | j         }| j        j                            |          | u r| j        j        |= t	          t
          |                                            d S )N)r   	__class__r   getsuperr   close)selftr(   s     r%   r+   z	Bus.closel   sW    N>+//22d::03c4     r&   c                     | 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,   s    r%   get_connectionzBus.get_connectionr   s	     r&   zself._connection == self, for backwards
                           compatibility with earlier dbus-python versions
                           where Bus was not a subclass of Connection.c                 "    t          |           S )zStatic method that returns a connection to the session bus.

        :Parameters:
            `private` : bool
                If true, do not return a shared connection.
        r"   )r   r2   s    r%   get_sessionzBus.get_session~        '****r&   c                 "    t          |           S )zStatic method that returns a connection to the system bus.

        :Parameters:
            `private` : bool
                If true, do not return a shared connection.
        r2   )r   r2   s    r%   
get_systemzBus.get_system   s     ))))r&   c                 "    t          |           S )zStatic method that returns a connection to the starter bus.

        :Parameters:
            `private` : bool
                If true, do not return a shared connection.
        r2   )r   r2   s    r%   get_starterzBus.get_starter   r4   r&   c                     | j         t          k    rd}n(| j         t          k    rd}n| j         t          k    rd}nd}d| j        j        | j        j        |t          |           fz  S )Nsessionsystemstarterzunknown bus typez<%s.%s (%s) at %#x>)r   r   r   r   r(   
__module____name__id)r,   names     r%   __repr__zBus.__repr__   so    >[((DD^z))DD^{**DD%D$(A(,(?(,bhh(8 8 	8r&   )F)r>   r=   __qualname____doc__r   r   TYPE_SESSIONr   r+   r0   property_connectionr3   staticmethodr6   r8   rA   __str____classcell__)r(   s   @r%   r   r   .   s         +8%1 1 1 1f! ! ! ! !   (>4JK KK
+ + + + ,{++K* * * * j))J+ + + + ,{++K8 8 8 GGGGGr&   r   c                       e Zd ZdZddZdS )r   zThe system-wide message bus.FNc                 R    t                               | t           j        ||          S )a  Return 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.
        )r   r"   )r   r   TYPE_SYSTEMr    r"   r   s      r%   r   zSystemBus.__new__   s*     {{3(#*  , , 	,r&   FNr>   r=   rB   rC   r   r/   r&   r%   r   r      s.        &&, , , , , ,r&   r   c                       e Zd ZdZddZdS )r   z(The session (current login) message bus.FNc                 R    t                               | t           j        ||          S )a  Return 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.
        r"   r   )r   r   rD   rM   s      r%   r   zSessionBus.__new__   +     {{3 0'$,  . . 	.r&   rN   rO   r/   r&   r%   r   r      s.        22. . . . . .r&   r   c                       e Zd ZdZddZdS )r   zjThe bus that activated this process (only valid if
    this process was launched by DBus activation).
    FNc                 R    t                               | t           j        ||          S )a  Return 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   )r   r   TYPE_STARTERrM   s      r%   r   zStarterBus.__new__   rS   r&   rN   rO   r/   r&   r%   r   r      s2         . . . . . .r&   r   N)rC   
__future__r   __all____docformat__dbus.exceptionsr	   _dbus_bindingsr
   r   r   r   r   r   r   r   r   r   r   r   dbus.busr   dbus.lowlevelr   dbus._compatr   r   r   r   r   r/   r&   r%   <module>r_      s   ? ?: " ! ! ! ! !
:" ) ) ) ) ) )I I I I I I I I I I I I I I I I I I I I I I I I I I I I
 # " " " " " ' ' ' ' ' '          -   H, , , , , , , ,". . . . . . . .". . . . . . . . . .r&   