Mini Shell

Direktori : /usr/lib/python3.6/site-packages/dasbus/client/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/dasbus/client/__pycache__/proxy.cpython-36.opt-1.pyc

3

��^'�@s�ddlmZmZddlmZddlmZddlmZddl	m
Z
dddd	d
gZdd�Zd
d	�Z
dd
�ZGdd�ded�ZGdd�de�ZGdd�de�ZdS)�)�ABCMeta�abstractmethod)�Lock)�ClientObjectHandler)�
PropertyProxy)�DBusSpecificationError�AbstractObjectProxy�ObjectProxy�InterfaceProxy�get_object_path�disconnect_proxycCs(t|t�stdjt|�j���t|d�S)zoGet an object handler of the DBus proxy.

    :param proxy: a DBus proxy
    :return: a DBus proxy handler
    zInvalid type '{}'.�_handler)�
isinstancer�	TypeError�format�type�__name__�getattr)�proxy�r�/usr/lib/python3.6/proxy.py�get_object_handler%s
rcCst|�}|jS)zkGet an object path of the remote DBus object.

    :param proxy: a DBus proxy
    :return: a DBus path
    )r�object_path)r�handlerrrrr1scCst|�}|j�dS)zVDisconnect the DBus proxy from the remote object.

    :param proxy: a DBus proxy
    N)rZdisconnect_members)rrrrrr;scsbeZdZdZddddgZe�Zefdd�Zedd	��Z	d
d�Z
dd
�Zdd�Z�fdd�Z
�ZS)rz'Abstract proxy of a remote DBus object.r
�_members�_lock�__weakref__cKs&||||f|�|_t�|_t�|_dS)aKCreate a new proxy.

        :param message_bus: a message bus
        :param service_name: a DBus name of the service
        :param object_path: a DBus path the object
        :param handler_factory: a factory of a DBus client object handler
        :param handler_arguments: additional arguments for the handler factory
        N)r
�dictrrr)�self�message_bus�service_namerZhandler_factoryZhandler_argumentsrrr�__init__Qs
zAbstractObjectProxy.__init__cCsdS)z|Get the DBus interface of the member.

        :param member_name: a member name
        :return: an interface name
        Nr)r�member_namerrr�_get_interfacedsz"AbstractObjectProxy._get_interfacecGs*y
|j|Stk
rYnX|j|�S)aFind a member of the DBus object.

        If the member doesn't exist, we will acquire
        a lock and ask a handler to create it.

        This method is thread-safe.

        :param key: a member key
        :return: a member
        :raise: AttributeError if invalid
        )r�KeyError�_create_member)r�keyrrr�_get_memberms

zAbstractObjectProxy._get_memberc Gs�|j�ry
|j|Stk
r&YnXy|jj|�}Wn0tk
rh}ztt|��d�WYdd}~XnX||j|<|SQRXdS)a	Create a member of the DBus object.

        If the member doesn't exist, ask a handler
        to create it.

        This method is thread-safe.

        :param key: a member key
        :return: a member
        :raise: DBusSpecificationError if invalid
        N)rrr$r
Z
create_memberr�AttributeError�str)rr&�member�errrr%�s
 
z"AbstractObjectProxy._create_membercCs(|j|j|�|�}t|t�r$|j�S|S)z�Get the attribute.

        Called when an attribute lookup has not found
        the attribute in the usual places. Always call
        the DBus handler in this case.
        )r'r#rr�get)r�namer*rrr�__getattr__�s
zAbstractObjectProxy.__getattr__csP||jkrt�j||�S|j|j|�|�}t|t�r>|j|�Stdj	|���dS)z�Set the attribute.

        Called when an attribute assignment is attempted.
        Call the DBus handler if the name is not a
        name of an instance attribute defined in _locals.
        zCan't set DBus attribute '{}'.N)
�_locals�super�__setattr__r'r#rr�setr(r)rr-�valuer*)�	__class__rrr1�s


zAbstractObjectProxy.__setattr__)r�
__module__�__qualname__�__doc__�	__slots__r/rr!rr#r'r%r.r1�
__classcell__rr)r4rrDs	)�	metaclasscs8eZdZdZdgZeje�Z�fdd�Zdd�Z�Z	S)r	zProxy of a remote DBus object.�_interface_namescst�j||�d|_dS)zRCreate a new proxy.

        :param handler: a DBus client object handler
        N)r0r!r;)r�args�kwargs)r4rrr!�szObjectProxy.__init__cCsZ|jdkr(t|jjj�}dd�|D�|_y
|j|Stk
rFYnXtdj|���dS)zkGet the DBus interface of the member.

        The members of standard interfaces have a priority.
        NcSsi|]}|j|j�qSr)�interface_namer-)�.0�mrrr�
<dictcomp>�sz.ObjectProxy._get_interface.<locals>.<dictcomp>z"DBus object has no attribute '{}'.)r;�reversedr
Z
specification�membersr$r(r)rr"rCrrrr#�s


zObjectProxy._get_interface)
rr5r6r7r8rr/r!r#r9rr)r4rr	�s

cs8eZdZdZdgZeje�Z�fdd�Zdd�Z�Z	S)r
z!Proxy of a remote DBus interface.�_interface_namecs"t�j|||f|�|�||_dS)z�Create a new proxy.

        :param message_bus: a message bus
        :param service_name: a DBus name of the service
        :param object_path: a DBus path the object
        :param handler: a DBus client object handler
        N)r0r!rD)rrr rr>r<r=)r4rrr!�s	
zInterfaceProxy.__init__cCs|jS)z%Get the DBus interface of the member.)rD)rr"rrrr#�szInterfaceProxy._get_interface)
rr5r6r7r8rr/r!r#r9rr)r4rr
�s


N)�abcrrZ	threadingrZdasbus.client.handlerrZdasbus.client.propertyrZdasbus.specificationr�__all__rrrrr	r
rrrr�<module>s
	x(