Mini Shell
3
��^62 � @ s� d dl Z d dlmZ d dlmZ d dlmZmZmZm Z m
Z
mZ ddddgZd Z
G d
d� de�ZG dd� de�ZG d
d� de�ZG dd� de�ZG dd� ded�Zdd� ZG dd� de�Zddd�Zdd� ZdS )� N)�ABCMeta)�get_type_hints)�get_variant�get_type_arguments�unwrap_variant�is_base_type� Structure�List�DBusStructureError�DBusData�generate_string_from_data�compare_dataZ__dbus_fields__c @ s e Zd ZdZdS )r
z,General exception for DBus structure errors.N)�__name__�
__module__�__qualname__�__doc__� r r �/usr/lib/python3.6/structure.pyr
( s c @ sj e Zd ZdZddd�Zedd� �Zedd� �Zed d
� �Zedd� �Z d
d� Z
dd� Zdd� Zdd� Z
dS )� DBusFieldz+Description of a field in a DBus structure.� c C s || _ || _|| _dS )z�Create a description of the field.
:param name: a name of the field
:param type_hint: a type hint
:param description: a description
N)�_name�
_type_hint�_description)�self�name� type_hint�descriptionr r r �__init__0 s zDBusField.__init__c C s | j S )z4Name of the field.
:return: a name
)r )r r r r r ; s zDBusField.namec C s | j S )z>Type hint of the field.
:return: a type hint
)r )r r r r r C s zDBusField.type_hintc C s | j S )zBDescription of the field.
:return: a description
)r )r r r r r K s zDBusField.descriptionc C s | j jdd�S )zQReturn name of a data attribute.
:return: a data attribute name
�-�_)r �replace)r r r r � data_nameS s zDBusField.data_namec C s t || j|� dS )zaSet the data attribute.
:param obj: a data object
:param value: a value
N)�setattrr! )r �obj�valuer r r �set_data[ s zDBusField.set_datac C s | j |t|�� dS )ztSet the data attribute from a variant.
:param obj: a data object
:param variant: a variant
N)r% r )r r# �variantr r r �set_data_variantc s zDBusField.set_data_variantc C s t || j�S )z\Get the data attribute.
:param obj: a data object
:return: a value
)�getattrr! )r r# r r r �get_datak s zDBusField.get_datac C s t | j| j|��S )zkGet a variant of the data attribute.
:param obj: a data object
:return: a variant
)r r r) )r r# r r r �get_data_variants s zDBusField.get_data_variantN)r )r r r r r �propertyr r r r! r% r'