File: //usr/lib/python3.9/site-packages/dasbus/client/__pycache__/proxy.cpython-39.opt-1.pyc
a
װ_' � @ s� d dl mZmZ d dlmZ d dlmZ d dlmZ d dl m
Z
g d�Zdd� Zd d
� Z
dd� ZG d
d� ded�ZG dd� de�ZG dd� de�ZdS )� )�ABCMeta�abstractmethod)�Lock)�ClientObjectHandler)�
PropertyProxy)�DBusSpecificationError)�AbstractObjectProxy�ObjectProxy�InterfaceProxy�get_object_path�disconnect_proxyc C s( t | t�std�t| �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 �7/usr/lib/python3.9/site-packages/dasbus/client/proxy.py�get_object_handler% s
r c C s t | �}|jS )zkGet an object path of the remote DBus object.
:param proxy: a DBus proxy
:return: a DBus path
)r �object_path�r Zhandlerr r r r 1 s r c C s t | �}|�� dS )zVDisconnect the DBus proxy from the remote object.
:param proxy: a DBus proxy
N)r Zdisconnect_membersr r r r r ; s r c s` e Zd ZdZg d�Zh e�Zefdd�Zedd� �Z dd� Z
d d
� Zdd� Z� fd
d�Z
� ZS )r z'Abstract proxy of a remote DBus object.)r
�_members�_lock�__weakref__c K s* ||||fi |��| _ t� | _t� | _dS )aK 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_factory: a factory of a DBus client object handler
:param handler_arguments: additional arguments for the handler factory
N)r
�dictr r r )�self�message_bus�service_namer Zhandler_factoryZhandler_argumentsr r r �__init__Q s
��zAbstractObjectProxy.__init__c C s dS )z|Get the DBus interface of the member.
:param member_name: a member name
:return: an interface name
Nr �r �member_namer r r �_get_interfaced s z"AbstractObjectProxy._get_interfacec G s* z| j | W S ty Y n0 | j|� S )a Find 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 �keyr r r �_get_memberm s
zAbstractObjectProxy._get_memberc G s� | j �� z| j| W W d � S ty4 Y n0 z| jj|� }W n2 tyx } ztt|��d�W Y d}~n
d}~0 0 || j|<