3 ָVXs � @ s4 d dl mZ G dd� ded��ZG dd� de�ZdS )� )�ExitableWithAliasesc @ s e Zd Zf Zdd� ZdS )� NameOwnerc sv d|r dndB |rdndB }� j j�|�}|dkrJ| j� �fdd�� d S |dkrZtd��|dkrjtd ��td ��d S )N� r � � c s � j j��S )N)�dbusZReleaseName� )�bus�namer �"/usr/lib/python3.6/request_name.py�<lambda> s z$NameOwner.__init__.<locals>.<lambda>� zname already exists on the busz%you're already the owner of this namez!cannot take ownership of the name)r ZRequestNameZ_at_exit�RuntimeError)�selfr r �allow_replacement�replace�flags�resr )r r r �__init__ s zNameOwner.__init__N)�__name__� __module__�__qualname__� __slots__r r r r r r s r Zunownc @ s e Zd Zf Zddd�ZdS )�RequestNameMixinTFc C s t | |||�S )z~Aquires a bus name. Returns ------- NameOwner An object you can use as a context manager to unown the name later. )r )r r r r r r r �request_name s zRequestNameMixin.request_nameN)TF)r r r r r r r r r r s r N)Zexitabler r �objectr r r r r �<module> s