관리-도구
편집 파일: specification.cpython-39.pyc
a ����װ_�#����������������������@���sT���d�dl�mZ�d�dlmZ�g�d�ZG�dd��de�ZG�dd��de�ZG�dd ��d e�Z d S�)�����)� namedtuple)� XMLParser)�DBusSpecificationError�DBusSpecification�DBusSpecificationParserc�������������������@���s���e�Zd�ZdZdS�)r���z,Exception for the DBus specification errors.N)�__name__� __module__�__qualname__�__doc__��r���r����8/usr/lib/python3.9/site-packages/dasbus/specification.pyr���#���s���r���c�������������������@���s����e�Zd�ZdZdZdZdZdZdZdZ dZ ed g�d ��Zedg�d��Z ed g�d��ZdgZedd���Zdd��Zedd���Zedd���Zdd��Zdd��ZdS�)r���zDBus XML specification.�in�out�read�writeZ readwrite�returna��� <node> <interface name="org.freedesktop.DBus.Introspectable"> <method name="Introspect"> <arg type="s" name="xml_data" direction="out"/> </method> </interface> <interface name="org.freedesktop.DBus.Peer"> <method name="Ping"/> <method name="GetMachineId"> <arg type="s" name="machine_uuid" direction="out"/> </method> </interface> <interface name="org.freedesktop.DBus.Properties"> <method name="Get"> <arg type="s" name="interface_name" direction="in"/> <arg type="s" name="property_name" direction="in"/> <arg type="v" name="value" direction="out"/> </method> <method name="GetAll"> <arg type="s" name="interface_name" direction="in"/> <arg type="a{sv}" name="properties" direction="out"/> </method> <method name="Set"> <arg type="s" name="interface_name" direction="in"/> <arg type="s" name="property_name" direction="in"/> <arg type="v" name="value" direction="in"/> </method> <signal name="PropertiesChanged"> <arg type="s" name="interface_name"/> <arg type="a{sv}" name="changed_properties"/> <arg type="as" name="invalidated_properties"/> </signal> </interface> </node> �Signal��name�interface_name�type�Method�r���r���Zin_typeZout_type�Property�r���r����readable�writabler����_membersc�����������������C���s���t��||��S�)z.Return a DBus specification for the given XML.)r����parse_specification)�cls�xmlr���r���r����from_xmlp���s����zDBusSpecification.from_xmlc�����������������C���s ���i�|�_�dS�)z Create a new DBus specification.N)r�����selfr���r���r����__init__u���s����zDBusSpecification.__init__c�����������������C���s���t�t|�j��������S�)z%Interfaces of the DBus specification.)�list�dictr����keysr"���r���r���r���� interfacesy���s����zDBusSpecification.interfacesc�����������������C���s���t�|�j����S�)z"Members of the DBus specification.)r%���r����valuesr"���r���r���r����members~���s����zDBusSpecification.membersc�����������������C���s���||�j�|j|jf<�dS�)z!Add a member of a DBus interface.N)r���r���r���)r#����memberr���r���r���� add_member����s����zDBusSpecification.add_memberc�����������������C���s8���z|�j�||f�W�S��ty"���Y�n0�td�||���dS�)z!Get a member of a DBus interface.z)DBus specification has no member '{}.{}'.N)r����KeyErrorr����format)r#���r����member_namer���r���r���� get_member����s������zDBusSpecification.get_memberN)r���r���r ���r ����DIRECTION_IN� DIRECTION_OUT�ACCESS_READ�ACCESS_WRITE�ACCESS_READWRITEZRETURN_PARAMETER�STANDARD_INTERFACESr���r���r���r���� __slots__�classmethodr!���r$����propertyr(���r*���r,���r0���r���r���r���r���r���(���s*���& r���c�������������������@���sl���e�Zd�ZdZeZeefdd��Zedd���Z edd���Z edd ���Zed d���Zedd ���Z edd���ZdS�)r���z)Class for parsing DBus XML specification.c�����������������C���s$���|��}|���|tj��|���||��|S�)z�Generate a representation of a DBus XML specification. :param xml: the XML specification to parse :param factory: the DBus specification factory :return: a representation od the DBus specification )� _parse_xmlr���r6���)r���r ����factory� specificationr���r���r���r�������s����z+DBusSpecificationParser.parse_specificationc�����������������C���s4���|�j��|�}|D�]}|�j��|�s"q|��||��qdS�)zParse the given XML.N)� xml_parserZxml_to_elementZis_interface�_parse_interface)r���r<���r ���Znode�interface_elementr���r���r���r:�������s ����z"DBusSpecificationParser._parse_xmlc�����������������C���st���|�j��|�}|D�]^}|�j��|�r.|��||�}n6|�j��|�rH|��||�}n|�j��|�r|��||�}nq|�|��q|S�)z8Parse the interface element from the DBus specification.) r=����get_nameZis_property�_parse_propertyZ is_signal� _parse_signalZ is_method� _parse_methodr,���)r���r<���r?���r���Zmember_elementr+���r���r���r���r>�������s����z(DBusSpecificationParser._parse_interfacec�����������������C���sX���|�j��|�}|�j��|�}|�j��|�}|tjtjfv�}|tjtjfv�}tj|||||d�S�)z7Parse the property element from the DBus specification.r���) r=���r@����get_typeZ get_accessr���r3���r5���r4���r���)r���r���Zproperty_elementZ property_nameZ property_typeZproperty_accessr���r���r���r���r���rA�������s$�������z'DBusSpecificationParser._parse_propertyc�����������������C���sT���|�j��|�}g�}|D�](}|�j��|�s&q|�j��|�}|�|��qtj|||��|�d�S�)z5Parse the signal element from the DBus specification.r���)r=���r@����is_parameterrD����appendr���r���� _get_type)r���r���Zsignal_elementZsignal_nameZsignal_type�element�element_typer���r���r���rB�������s�����z%DBusSpecificationParser._parse_signalc����������� ������C���s����|�j��|�}g�}g�}|D�]T}|�j��|�s*q|�j��|�}|�j��|�}|tjkrX|�|��q|tjkr|�|��qtj |||�� |�|�� |�d�S�)z5Parse the method element from the DBus specification.r���)r=���r@���rE���Z get_directionrD���r���r1���rF���r2���r���rG���) r���r���Zmethod_elementZmethod_nameZin_typesZ out_typesrH���� directionrI���r���r���r���rC�������s$���� �z%DBusSpecificationParser._parse_methodc�����������������C���s���|sdS�d��d�|��S�)zJoin types into one value.Nz({})��)r.����join)r����typesr���r���r���rG�����s����z!DBusSpecificationParser._get_typeN)r���r���r ���r ���r���r=���r8���r���r���r:���r>���rA���rB���rC���rG���r���r���r���r���r�������s ��� r���N) �collectionsr���Z dasbus.xmlr����__all__� Exceptionr����objectr���r���r���r���r���r����<module>���s ���m