← Back
Editing: structure.cpython-312.pyc
� �ic.2 � �� � d dl Z d dlmZ d dlmZ d dlmZmZmZm Z m Z mZ g d�ZdZ G d� de� Z G d � d e� Z G d� de� Z G d � de� Z G d� de�� Zd� Z G d� de� Zdd�Zd� Zy)� N)�ABCMeta)�get_type_hints)�get_variant�get_type_arguments�unwrap_variant�is_base_type� Structure�List)�DBusStructureError�DBusData�generate_string_from_data�compare_data�__dbus_fields__c � � e Zd ZdZy)r z,General exception for DBus structure errors.N)�__name__� __module__�__qualname__�__doc__� � �5/usr/lib/python3.12/site-packages/dasbus/structure.pyr r ( s � �6�r r c �p � e Zd ZdZdd�Zed� � Zed� � Zed� � Zed� � Z d� Z d� Zd � Zd � Z y) � DBusFieldz+Description of a field in a DBus structure.c �. � || _ || _ || _ y)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�descriptions r �__init__zDBusField.__init__0 s � � �� �#���'��r c � � | j S )z4Name of the field. :return: a name )r �r s r r zDBusField.name; s � � �z�z�r c � � | j S )z>Type hint of the field. :return: a type hint )r r$ s r r zDBusField.type_hintC � � � ���r c � � | j S )zBDescription of the field. :return: a description )r r$ s r r! zDBusField.descriptionK s � � � � � r c �: � | j j dd� S )zQReturn name of a data attribute. :return: a data attribute name �-�_)r �replacer$ s r � data_namezDBusField.data_nameS s � � �y�y� � ��c�*�*r c �2 � t || j |� y)zaSet the data attribute. :param obj: a data object :param value: a value N)�setattrr, �r �obj�values r �set_datazDBusField.set_data[ s � � ��T�^�^�U�+r c �: � | j |t |� � y)ztSet the data attribute from a variant. :param obj: a data object :param variant: a variant N)r2 r )r r0 �variants r �set_data_variantzDBusField.set_data_variantc s � � � � �c�>�'�2�3r c �. � t || j � S )z\Get the data attribute. :param obj: a data object :return: a value )�getattrr, �r r0 s r �get_datazDBusField.get_datak s � � �s�D�N�N�+�+r c �L � t | j | j |� � S )zkGet a variant of the data attribute. :param obj: a data object :return: a variant )r r r9 r8 s r �get_data_variantzDBusField.get_data_variants s � � �4�>�>�4�=�=��+=�>�>r N�� )r r r r r"