HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.52.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 15 06:39:08 EDT 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/lib/python3.9/site-packages/dasbus/__pycache__/specification.cpython-39.opt-1.pyc
a

װ_�#�@sTddlmZddlmZgd�ZGdd�de�ZGdd�de�ZGdd	�d	e�Z	d
S)�)�
namedtuple)�	XMLParser)�DBusSpecificationError�DBusSpecification�DBusSpecificationParserc@seZdZdZdS)rz,Exception for the DBus specification errors.N)�__name__�
__module__�__qualname__�__doc__�rr�8/usr/lib/python3.9/site-packages/dasbus/specification.pyr#src@s�eZdZdZdZdZdZdZdZdZ	dZ
ed	gd
��Zedgd��Z
ed
gd��ZdgZedd��Zdd�Zedd��Zedd��Zdd�Zdd�ZdS)rzDBus 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�rrZin_typeZout_type�Property�rr�readable�writabler�_memberscCst�||�S)z.Return a DBus specification for the given XML.)r�parse_specification)�cls�xmlrrr�from_xmlpszDBusSpecification.from_xmlcCs
i|_dS)z Create a new DBus specification.N)r��selfrrr�__init__uszDBusSpecification.__init__cCstt|j������S)z%Interfaces of the DBus specification.)�list�dictr�keysr"rrr�
interfacesyszDBusSpecification.interfacescCst|j���S)z"Members of the DBus specification.)r%r�valuesr"rrr�members~szDBusSpecification.memberscCs||j|j|jf<dS)z!Add a member of a DBus interface.N)rrr)r#�memberrrr�
add_member�szDBusSpecification.add_membercCs8z|j||fWSty"Yn0td�||���dS)z!Get a member of a DBus interface.z)DBus specification has no member '{}.{}'.N)r�KeyErrorr�format)r#r�member_namerrr�
get_member�s��zDBusSpecification.get_memberN)rrr	r
�DIRECTION_IN�
DIRECTION_OUT�ACCESS_READ�ACCESS_WRITE�ACCESS_READWRITEZRETURN_PARAMETER�STANDARD_INTERFACESrrrr�	__slots__�classmethodr!r$�propertyr(r*r,r0rrrrr(s*&	


rc@sleZdZdZeZeefdd��Zedd��Z	edd��Z
edd	��Zed
d��Zedd
��Z
edd��ZdS)rz)Class for parsing DBus XML specification.cCs$|�}|�|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_xmlrr6)rr �factory�
specificationrrrr�sz+DBusSpecificationParser.parse_specificationcCs4|j�|�}|D]}|j�|�s"q|�||�qdS)zParse the given XML.N)�
xml_parserZxml_to_elementZis_interface�_parse_interface)rr<r Znode�interface_elementrrrr:�s
z"DBusSpecificationParser._parse_xmlcCst|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,)rr<r?rZmember_elementr+rrrr>�sz(DBusSpecificationParser._parse_interfacecCsX|j�|�}|j�|�}|j�|�}|tjtjfv}|tjtjfv}tj|||||d�S)z7Parse the property element from the DBus specification.r)	r=r@�get_typeZ
get_accessrr3r5r4r)rrZproperty_elementZ
property_nameZ
property_typeZproperty_accessrrrrrrA�s$���z'DBusSpecificationParser._parse_propertycCsT|j�|�}g}|D](}|j�|�s&q|j�|�}|�|�qtj|||�|�d�S)z5Parse the signal element from the DBus specification.r)r=r@�is_parameterrD�appendrr�	_get_type)rrZsignal_elementZsignal_nameZsignal_type�element�element_typerrrrB�s�z%DBusSpecificationParser._parse_signalc	Cs�|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@rEZ
get_directionrDrr1rFr2rrG)	rrZmethod_elementZmethod_nameZin_typesZ	out_typesrH�	directionrIrrrrC�s$

�z%DBusSpecificationParser._parse_methodcCs|sdSd�d�|��S)zJoin types into one value.Nz({})�)r.�join)r�typesrrrrGsz!DBusSpecificationParser._get_typeN)rrr	r
rr=r8rrr:r>rArBrCrGrrrrr�s 




rN)
�collectionsrZ
dasbus.xmlr�__all__�	Exceptionr�objectrrrrrr�<module>s
m