a
    =a                     @   s   d Z G dd dZG dd deZG dd deZG dd deZG d	d
 d
eZG dd deZG dd deZG dd deZG dd deZ	dS )zPMicro reports objects.

A micro report is a tree of layout and content objects.
c                   @   sF   e Zd ZdddZdd Zdd Zdd	 Zd
d Zdd Zdd Z	dS )VNodeNc                 C   s   || _ d | _g | _d S N)idparentchildren)selfZnid r   >lib/python3.9/site-packages/pylint/reporters/ureports/nodes.py__init__   s    zVNode.__init__c                 C   s
   t | jS r   )iterr   r   r   r   r   __iter__   s    zVNode.__iter__c                 C   s   | j | | |_dS )zadd a node to childrenN)r   appendr   r   childr   r   r   r      s    zVNode.appendc                 C   s   | j || | |_dS )zinsert a child nodeN)r   insertr   )r   indexr   r   r   r   r   "   s    zVNode.insertc                 C   s4   z| j ddW S  ty.   | jj  Y S 0 dS )z
        return the visit name for the mixed class. When calling 'accept', the
        method <'visit_' + name returned by this method> will be called on the
        visitor
        -_N)ZTYPEreplace	Exception	__class____name__lowerr   r   r   r   _get_visit_name'   s    zVNode._get_visit_namec                 O   s(   t |d|   }|| g|R i |S )Nzvisit_%sgetattrr   r   Zvisitorargskwargsfuncr   r   r   accept4   s    zVNode.acceptc                 O   s(   t |d|   }|| g|R i |S )Nzleave_%sr   r   r   r   r   leave8   s    zVNode.leave)N)
r   
__module____qualname__r	   r   r   r   r   r    r!   r   r   r   r   r      s   
r   c                       s:   e Zd ZdZd fdd	Zdd Zdd Zd	d
 Z  ZS )
BaseLayoutzkbase container node

    attributes
    * children : components in this table (i.e. the table's cells)
    r   c                    s@   t  jf i | |D ]$}t|tr0| | q| | qd S r   )superr	   
isinstancer   r   add_text)r   r   r   r   r   r   r   r	   D   s
    
zBaseLayout.__init__c                 C   s    ||   vsJ t| | dS )z$overridden to detect problems easilyN)parentsr   r   r   r   r   r   r   L   s    zBaseLayout.appendc                 C   s.   | j | usJ | j du rg S | j g| j   S )zreturn the ancestor nodesN)r   r)   r   r   r   r   r)   Q   s    
zBaseLayout.parentsc                 C   s   | j t| dS )zshortcut to add text dataN)r   r   Text)r   textr   r   r   r'   X   s    zBaseLayout.add_text)r   )	r   r"   r#   __doc__r	   r   r)   r'   __classcell__r   r   r(   r   r$   =   s
   r$   c                       s"   e Zd ZdZd fdd	Z  ZS )r*   zaa text portion

    attributes :
    * data : the text value as an encoded or unicode string
    Tc                    s6   t  jf i | t|ts&J |j|| _|| _d S r   )r%   r	   r&   strr   escapeddata)r   r0   r/   r   r(   r   r   r	   g   s    zText.__init__)Tr   r"   r#   r,   r	   r-   r   r   r(   r   r*   `   s   r*   c                   @   s   e Zd ZdZdS )VerbatimTextzxa verbatim text, display the raw data

    attributes :
    * data : the text value as an encoded or unicode string
    Nr   r"   r#   r,   r   r   r   r   r2   p   s   r2   c                       s"   e Zd ZdZd fdd	Z  ZS )Sectionza section

    attributes :
    * BaseLayout attributes

    a title may also be given to the constructor, it'll be added
    as a first element
    a description may also be given to the constructor, it'll be added
    as a first paragraph
    Nc                    sH   t  jf i | |r,| dtt|g |rD| dt|fd d S )N    )r   )r%   r	   r   	Paragraphr*   Title)r   titleZdescriptionr   r(   r   r   r	      s
    zSection.__init__)NNr1   r   r   r(   r   r4   {   s   r4   c                       s   e Zd Z fddZ  ZS )EvaluationSectionc                    sZ   t  jf i | t }|tdt|  | | t }|t| | | d S )Nr   )r%   r	   r6   r   r*   len)r   messager   r8   Zmessage_bodyr(   r   r   r	      s    
zEvaluationSection.__init__)r   r"   r#   r	   r-   r   r   r(   r   r9      s   r9   c                   @   s   e Zd ZdZdS )r7   zta title

    attributes :
    * BaseLayout attributes

    A title must not contains a section nor a paragraph!
    Nr3   r   r   r   r   r7      s   r7   c                   @   s   e Zd ZdZdS )r6   zya simple text paragraph

    attributes :
    * BaseLayout attributes

    A paragraph must not contains a section !
    Nr3   r   r   r   r   r6      s   r6   c                       s"   e Zd ZdZd fdd	Z  ZS )Tablea"  some tabular data

    attributes :
    * BaseLayout attributes
    * cols : the number of columns of the table (REQUIRED)
    * rheaders : the first row's elements are table's header
    * cheaders : the first col's elements are table's header
    * title : the table's optional title
    Nr5   c                    s<   t  jf i | t|ts J || _|| _|| _|| _d S r   )r%   r	   r&   intcolsr8   rheaderscheaders)r   r>   r8   r?   r@   r   r(   r   r   r	      s    zTable.__init__)Nr5   r5   r1   r   r   r(   r   r<      s   
r<   N)
r,   r   r$   r*   r2   r4   r9   r7   r6   r<   r   r   r   r   <module>   s   *#

