Your IP : 18.226.214.1


Current Path : /usr/lib/python3.6/site-packages/slip/dbus/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/slip/dbus/__pycache__/service.cpython-36.pyc

3

�uAc��@s�dZddlmZddlZddlZddlmZddlmZ	ddl
mZd	d
dgZda
dd
�Zeadd�Zdd�Zdd�Zdadadd�ZGdd
�d
ejj�ZGdd	�d	eeejj��ZdS)zMThis module contains convenience functions for using dbus-activated services.�)�absolute_importN)�with_metaclass�)�_glib�)�polkit�Object�
InterfaceType�set_mainloopcCstj�dS)N)�__mainloop__�quit�r
r
�/usr/lib/python3.6/service.py�__glib_quit_cb__)srcCs|adS)N)r)Zmainloopr
r
rr
4scCs|adS)N)�__quit_cb__)�quit_cbr
r
r�set_quit_cb9srcCs
t�dS)N)rr
r
r
rr>srZ__slip_dbus_service_sender__�__slip_dbus_service_reply_cb__�__slip_dbus_service_error_cb__cs��jdk	r�j�d�nt�d��jdk	r4�j�d�nt�d���������fdd�}xLdd�t��D�D]6}|dkr��|_ql|dkr��|_qlt||t�|��qlW�j|_|S)	NFTcs��j��}|dk	rV��d���d��r4��=�rL��d=��d=�j|�t�	dt�dd���|dk	r��r�����	�
���fdd�}��fdd�}tj|�||d	�n�	�f����}�j�|SdS)
NrrZ_slip_polkit_auth_required�default_polkit_auth_requiredcs�|r��r��f����q�d}y��f����}Wn&tk
rX}z
|}WYdd}~XnX|rh�|�q�|dkrx��q��|�n�tj����j�dS)N)�	ExceptionrZNotAuthorizedException�timeout_restart)Zis_auth�error�result�e)�	action_id�error_cb�k�method�method_is_async�p�reply_cb�selfr
r�
reply_handlerqs

z:wrap_method.<locals>.wrapped_method.<locals>.reply_handlercs�|��j�dS)N)r)r)rr"r
r�
error_handler�sz:wrap_method.<locals>.wrapped_method.<locals>.error_handler)r#r$)�get�sender_seen�getattrrZIsSystemBusNameAuthorizedAsyncr)r"r r�senderr#r$Zretval)�async_callbacks�hide_async_callbacks�hide_sender_keywordrr�sender_keyword)rrrr r!r"r�wrapped_method[s,



"z#wrap_method.<locals>.wrapped_methodcss"|]}|dd�dkr|VqdS)N�Z_dbus_r
)�.0�xr
r
r�	<genexpr>�szwrap_method.<locals>.<genexpr>�_dbus_sender_keyword�_dbus_async_callbacks)r2�SENDER_KEYWORDr3�ASYNC_CALLBACKS�dir�setattrr'�__name__)rr-�attrr
)r)r*r+rrr,r�wrap_methodHs(

Er:cseZdZ�fdd�Z�ZS)r	csDx,|j�D] \}}t|dd�r
t|�||<q
Wtt|�j||||�S)NZ_dbus_is_methodF)�itemsr'r:�superr	�__new__)�cls�name�basesZdctZattrnamer9)�	__class__r
rr=�szInterfaceType.__new__)r8�
__module__�__qualname__r=�
__classcell__r
r
)rArr	�scsbeZdZdZdZeZdZe�ZiZ	iZ
dZd�fdd�	Zdd�Z
dd	�Zdd
d�Zdd
�Z�ZS)rF�Ncs2tt|�j|||�|dkr(|jj|_n||_dS)N)r<r�__init__rA�
persistent)r"�connZobject_pathZbus_namerG)rAr
rrF�szObject.__init__cCs2|jr ttj�dkr t�dSdt_|jt_dS)NrF)rG�lenr�sendersr�current_source�default_duration�duration)r"r
r
r�_timeout_cb�szObject._timeout_cbcCs�|j}|r�||ftjkr�tjj||f�tj|j|�ttj|�dkrjtj|j�tj|=tj|=|jr�ttj�dkr�tjdkr�t	�dS)Nr)
�
connectionrrJ�remove�connections_sendersrI�connections_smobjsrGrKr)r"r?Z	old_ownerZ	new_ownerrHr
r
r�_name_owner_changed�s
zObject._name_owner_changedcCsf|s|jj}tjs|tjkr$|t_|js:ttj�dkrbtjrLtj	tj�tj
tjd|j�t_dS)Nri�)rArLrrMrGrIrJrK�GLibZ
source_removeZtimeout_addrN)r"rMr
r
rr�szObject.timeout_restartcCsp||jftjkrltjj||jf�|jtjkrZt�tj|j<|jj|jdd|d�tj|j<tj|jj|�dS)NZNameOwnerChangedzorg.freedesktop.DBus)Zhandler_functionZsignal_nameZdbus_interfaceZarg1)	rOrrJ�addrQ�setZadd_signal_receiverrSrR)r"r(r
r
rr&�szObject.sender_seen)NNNN)N)r8rBrCrGrLrMrKrVrJrQrRrrFrNrSrr&rDr
r
)rArr�s

)rr)�__doc__Z
__future__rZdbusZdbus.serviceZsixrZ	_wrappersrrT�r�__all__rrrr
rrr4r5r:Zservicer	rr
r
r
r�<module>s&
g

?>