
    yIf                        d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ  G d d	e          Z G d
 de          Z G d de          Z G d de	          Z G d de          ZdS )0Base class defining the interface for a printer.    )annotations)ABCabstractmethod)Enum)
NamedTuple)nodes)get_annotation_labelc                      e Zd ZdZdZdS )NodeTypeclasspackageN)__name__
__module____qualname__CLASSPACKAGE     L/var/www/piapp/venv/lib/python3.11/site-packages/pylint/pyreverse/printer.pyr   r      s        EGGGr   r   c                  "    e Zd ZdZdZdZdZdZdS )EdgeTypeinheritsassociationaggregationusestype_dependencyN)r   r   r   INHERITSASSOCIATIONAGGREGATIONUSESTYPE_DEPENDENCYr   r   r   r   r      s'        HKKD'OOOr   r   c                      e Zd ZdZdZdZdZdS )LayoutLRRLTBBTN)r   r   r   LEFT_TO_RIGHTRIGHT_TO_LEFTTOP_TO_BOTTOMBOTTOM_TO_TOPr   r   r   r$   r$      s"        MMMMMMr   r$   c                  R    e Zd ZU ded<   dZded<   dZded<   dZded	<   dZded
<   dS )NodePropertiesstrlabelNzlist[str] | Noneattrszlist[nodes.FunctionDef] | Nonemethods
str | Nonecolor	fontcolor)r   r   r   __annotations__r1   r2   r4   r5   r   r   r   r.   r.   &   s_         JJJ"E"""".2G2222E I      r   r.   c                      e Zd ZdZ	 	 d&d'dZd(dZd(dZed(d            Zd)d*dZ	e	 d+d,d            Z
e	 d+d-d            Zed.d"            Zd/d$Zed(d%            ZdS )0Printerr   Ntitler/   layoutLayout | Noneuse_automatic_namespacebool | NonereturnNonec                t    || _         || _        || _        g | _        d| _        |                                  d S )N )r9   r:   r<   lines_indent_open_graph)selfr9   r:   r<   s       r   __init__zPrinter.__init__1   s@      
'>$ "
r   c                &    | xj         dz  c_         dS )zIncrement indentation.z  NrC   rE   s    r   _inc_indentzPrinter._inc_indent>   s    r   c                .    | j         dd         | _         dS )zDecrement indentation.NrH   rI   s    r   _dec_indentzPrinter._dec_indentB   s    |CRC(r   c                    dS )zfEmit the header lines, i.e. all boilerplate code that defines things like
        layout etc.
        Nr   rI   s    r   rD   zPrinter._open_graphF         r   Tlineforce_newlinec                    |r|                     d          s|dz  }| j                            | j        |z              d S )N
)endswithrB   appendrC   )rE   rP   rQ   s      r   emitzPrinter.emitL   sI     	t!4!4 	DLD
$,-.....r   nametype_r   
propertiesNodeProperties | Nonec                    dS )zVCreate a new node.

        Nodes can be classes, packages, participants etc.
        Nr   )rE   rW   rX   rY   s       r   	emit_nodezPrinter.emit_nodeQ   rO   r   	from_nodeto_noder   r0   r3   c                    dS )zACreate an edge from one node to another to display relationships.Nr   )rE   r]   r^   rX   r0   s        r   	emit_edgezPrinter.emit_edge]   rO   r   methodnodes.FunctionDef	list[str]c                J   | j         j         g S | j        dv rdnd}| j         j         |d          }t          t          || j         j        |d                              }|D ]*}d} |j        |          }|rt          |          }|||<   +d  |j                    D             S )N>   functionstaticmethodr      rA   c                @    g | ]\  }}|r|j          d | n|j          S )z: )rW   ).0arganns      r   
<listcomp>z1Printer._get_method_arguments.<locals>.<listcomp>w   sJ     
 
 
S %(:sx  3   ]
 
 
r   )argstypedictzipr   getr
   items)ra   	first_arg	argumentsr   rj   annotation_labelrk   s          r   _get_method_argumentszPrinter._get_method_argumentsg   s    ;#I(DDDAA!	,2K,<YZZ,H	3y&+*A)***MNNOO 	0 	0C!!+/#&&C =#7#<#< /K
 
-K-//
 
 
 	
r   
outputfilec                    |                                   t          |dd          5 }|                    | j                   ddd           dS # 1 swxY w Y   dS )z'Generate and save the final outputfile.wzutf-8)encodingN)_close_graphopen
writelinesrB   )rE   rw   outfiles      r   generatezPrinter.generate|   s    *cG444 	+tz***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+s   AAAc                    dS )z2Emit the lines needed to properly close the graph.Nr   rI   s    r   r{   zPrinter._close_graph   rO   r   )NN)r9   r/   r:   r;   r<   r=   r>   r?   )r>   r?   )T)rP   r/   rQ   r=   r>   r?   )N)rW   r/   rX   r   rY   rZ   r>   r?   )
r]   r/   r^   r/   rX   r   r0   r3   r>   r?   )ra   rb   r>   rc   )rw   r/   r>   r?   )r   r   r   __doc__rF   rJ   rM   r   rD   rV   r\   r`   rf   rv   r   r{   r   r   r   r8   r8   .   sO       ::
 !%/3	       ) ) ) )    ^
/ / / / /
 
 -1		 	 	 	 ^	  !P P P P ^P 
 
 
 \
(+ + + + A A A ^A A Ar   r8   N)r   
__future__r   abcr   r   enumr   typingr   astroidr	   pylint.pyreverse.utilsr
   r   r   r$   r.   r8   r   r   r   <module>r      so  
 7 6 " " " " " " # # # # # # # #                   7 7 7 7 7 7    t   
( ( ( ( (t ( ( (    T   ! ! ! ! !Z ! ! !VA VA VA VA VAc VA VA VA VA VAr   