Hacked By AnonymousFox

Current Path : /lib/python3.6/site-packages/slip/dbus/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/slip/dbus/__pycache__/introspection.cpython-36.pyc

3

�uAc��@s�dZddlmZddlmZddlmZddlmZGdd�de	�Z
Gdd	�d	ee
e��ZGd
d�de�Z
Gdd
�d
e�ZGdd�dee�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�dee�Zdd�ZdS)z?Classes and functions to easily access DBus introspection data.�)�absolute_import)�ElementTree)�StringIO)�with_metaclassc@s(eZdZdZiZedd��Zdd�ZdS)�	IElemMetaz�Metaclass for introspection elements.

    Sets elemname class member automatically from class name if not set
    explicitly. Registers classes for their element names.cCs>d}x4|D],}|j�}||kr.t|�r.|d7}||7}q
W|S)N��_)�lower�len)�clsZclsname�elemname�cZc_lower�r�#/usr/lib/python3.6/introspection.py�clsname_to_elemname(s
zIElemMeta.clsname_to_elemnamecCs�|dkrtj||||�Sd|krL|jd�s6td|��tj|dd��|d<|d}|tjkrntd||f��tj||||�}|tj|<|S)N�IElemrz;Class '%s' needs to set elemname (or be called 'IElem...'))�z4Class '%s' tries to register duplicate elemname '%s')�type�__new__�
startswith�	TypeErrorrr�elemnames_to_classes)r�name�basesZdctr�klsrrrr3s 


zIElemMeta.__new__N)�__name__�
__module__�__qualname__�__doc__r�classmethodrrrrrrr srcs@eZdZdZd�fdd�	Zddd�Zdd�Zed	d
��Z�Z	S)
rz&Base class for introspection elements.Ncs*tjj|jtjd�}tt|�j|||�S)N)rr�get�tag�superrr)r�elem�parentr)�	__class__rrrOsz
IElem.__new__cs$|�_|�_�fdd�|D��_dS)Ncsg|]}t|�d��qS))r$)r)�.0r
)�selfrr�
<listcomp>Wsz"IElem.__init__.<locals>.<listcomp>)r#r$�child_elements)r'r#r$r)r'r�__init__TszIElem.__init__cCsZd|jr|jn
d|jj|jf}x2|jD](}x"t|�jd�D]}|d|7}q>Wq*W|S)Nz%s %rz
unknown:%s�
z
  %s)rr#r!�attribr)�str�split)r'�sr
Zccrrr�__str__Ysz
IElem.__str__cCs|jjS)N)r#r,)r'rrrr,aszIElem.attrib)N)N)
rrrrrr*r0�propertyr,�
__classcell__rr)r%rrLs

rc@seZdZdZdZdS)�IElemUnknownz-Catch-all for unknown introspection elements.N)rrrrrrrrrr3fsr3c@seZdZdZedd��ZdS)�IElemNameMixinz,Mixin for introspection elements with names.cCs
|jdS)Nr)r,)r'rrrroszIElemNameMixin.nameN)rrrrr1rrrrrr4lsr4cs"eZdZdZd�fdd�	Z�ZS)�	IElemNodezIntrospection node.Ncs(tt|�j||�dd�|jD�|_dS)NcSsg|]}t|t�r|�qSr)�
isinstancer5)r&r
rrrr({sz&IElemNode.__init__.<locals>.<listcomp>)r"r5r*r)Zchild_nodes)r'r#r$)r%rrr*wszIElemNode.__init__)N)rrrrr*r2rr)r%rr5tsr5c@seZdZdZdS)�IElemInterfacezIntrospection interface.N)rrrrrrrrr7~sr7c@seZdZdZdS)�IElemMethodzIntrospection interface method.N)rrrrrrrrr8�sr8c@seZdZdZdS)�IElemArgzIntrospection method argument.N)rrrrrrrrr9�sr9c@seZdZdZdS)�IElemSignalzIntrospection interface signal.N)rrrrrrrrr:�sr:cCs.t�}t|d�st|�}|j|�}t|�}|S)N�read)r�hasattrr�parser)Zstring_or_fileZtreeZxml_rootZ	elem_rootrrr�
introspect�s

r>N)rZ
__future__rZxml.etree.ElementTreer�iorZsixrrr�objectrr3r4r5r7r8r9r:r>rrrr�<module>s,


Hacked By AnonymousFox1.0, Coded By AnonymousFox