o
    bL                     @   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)selfnid r   ^/var/www/secure340b-portal/env/lib/python3.10/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   s0   z| j ddW S  ty   | jj  Y S w )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
        -_)ZTYPEreplace	Exception	__class____name__lowerr   r   r   r	   _get_visit_name#   s
   zVNode._get_visit_namec                 O   (   t |d|   }|| g|R i |S )Nzvisit_%sgetattrr   r   visitorargskwargsfuncr   r   r	   accept0      zVNode.acceptc                 O   r   )Nzleave_%sr   r   r   r   r	   leave4   r$   zVNode.leaver   )
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                    sD   t t| jdi | |D ]}t|tr| | q| | qd S Nr   )superr(   r
   
isinstancer   r   add_text)r   r   r!   r   r   r   r	   r
   @   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   H   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.   M   s   
zBaseLayout.parentsc                 C   s   | j t| dS )zshortcut to add text dataN)r   r   Text)r   textr   r   r	   r,   T   s   zBaseLayout.add_text)r   )	r   r&   r'   __doc__r
   r   r.   r,   __classcell__r   r   r-   r	   r(   9   s    r(   c                       "   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                    s:   t t| jdi | t|tsJ |j|| _|| _d S r)   )r*   r/   r
   r+   strr   escapeddata)r   r6   r5   r!   r-   r   r	   r
   c   s   
zText.__init__)Tr   r&   r'   r1   r
   r2   r   r   r-   r	   r/   \   s    r/   c                   @      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'   r1   r   r   r   r	   r9   l       r9   c                       r3   )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                    sP   t t| jdi | |r| dtt|g |r&| dt|fd d S d S )N    )r   r   )r*   r<   r
   r   	Paragraphr/   Title)r   titledescriptionr!   r-   r   r	   r
      s   zSection.__init__)NNr7   r   r   r-   r	   r<   w   s    r<   c                       s   e Zd Z fddZ  ZS )EvaluationSectionc                    s^   t t| jdi | t }|tdt|  | | t }|t| | | d S )Nr   r   )r*   rB   r
   r>   r   r/   len)r   messager!   r@   message_bodyr-   r   r	   r
      s   
zEvaluationSection.__init__)r   r&   r'   r
   r2   r   r   r-   r	   rB      s    rB   c                   @   r8   )r?   zta title

    attributes :
    * BaseLayout attributes

    A title must not contains a section nor a paragraph!
    Nr:   r   r   r   r	   r?      r;   r?   c                   @   r8   )r>   zya simple text paragraph

    attributes :
    * BaseLayout attributes

    A paragraph must not contains a section !
    Nr:   r   r   r   r	   r>      r;   r>   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
    Nr=   c                    s@   t t| jdi | t|tsJ || _|| _|| _|| _d S r)   )	r*   rF   r
   r+   intcolsr@   rheaderscheaders)r   rH   r@   rI   rJ   r!   r-   r   r	   r
      s   
zTable.__init__)Nr=   r=   r7   r   r   r-   r	   rF      s    
rF   N)
r1   r   r(   r/   r9   r<   rB   r?   r>   rF   r   r   r   r	   <module>   s   *#

