§
    ÷yIfÈ   ã                  ó&  — d Z ddlmZ ddlZddlZddlZddlZddlZddlm	Z	m
Z
mZmZmZmZ ddlZddlmZ ddlmZ e	rEddlmZmZ eej        geee         eeef         df         f         Zeee         ee         f         ZdZd,d„Zd-d„Z ej        d¦  «        Z ej        d¦  «        Z ej        d¦  «        Zd.d„Z d/d„Z!dZ"dZ#dZ$de"e#z   e$z   e"e#e$z   dœZ%e"e#e$ddœZ& G d„ d¦  «        Z' G d„ d ¦  «        Z(d0d#„Z)d1d&„Z*d2d(„Z+d-d)„Z,d3d+„Z-dS )4z8Generic classes/functions for pyreverse core/extensions.é    )ÚannotationsN)ÚTYPE_CHECKINGÚAnyÚCallableÚOptionalÚTupleÚUnion)Únodes)ÚInferenceResult)ÚClassDiagramÚPackageDiagramz.pyreversercÚreturnú	list[str]c                 óZ  — g } t           j                             dd¦  «        }|r†t           j                             |t
          ¦  «        }	 t          |d¬¦  «        5 }|                     ¦   «                              ¦   «         } ddd¦  «         n# 1 swxY w Y   n# t          $ r Y nw xY w| S )z,Read config file and return list of options.ÚHOMEÚ úutf-8)ÚencodingN)
ÚosÚenvironÚgetÚpathÚjoinÚRCFILEÚopenÚreadÚsplitÚOSError)ÚoptionsÚhomeÚrcfileÚfile_handles       úJ/var/www/piapp/venv/lib/python3.11/site-packages/pylint/pyreverse/utils.pyÚget_default_optionsr$   !   sæ   € à€GÝŒ:�>Š>˜& "Ñ%Ô%€DØð Ý”—’˜d¥FÑ+Ô+ˆð	Ý�f wÐ/Ñ/Ô/ð 5°;Ø%×*Ò*Ñ,Ô,×2Ò2Ñ4Ô4�ð5ð 5ð 5ñ 5ô 5ð 5ð 5ð 5ð 5ð 5ð 5øøøð 5ð 5ð 5ð 5øøåð 	ð 	ð 	ØˆDð	øøøà€Ns6   ÁB Á'BÂB ÂBÂB ÂBÂB Â
B(Â'B(ÚNonec                 ó”   — t          ¦   «         } |                      ¦   «          | D ]"}t          j                             d|¦  «         Œ#dS )z#Insert default options to sys.argv.é   N)r$   ÚreverseÚsysÚargvÚinsert)r   Úargs     r#   Úinsert_default_optionsr-   /   sO   € å!Ñ#Ô#€GØ‡O‚OÑÔÐØð  ð  ˆÝŒ�Š˜˜3ÑÔÐÐð ð  ó    z^__([^\W_]_*)+__$z^__(_*[^\W_])+_?$z^_\w*$ÚnameÚstrc                ó¸   — t                                | ¦  «        rd}n<t                               | ¦  «        rd}nt                               | ¦  «        rd}nd}|S )zIReturn the visibility from a name: public, protected, private or special.ÚspecialÚprivateÚ	protectedÚpublic)ÚSPECIALÚmatchÚPRIVATEÚ	PROTECTED)r/   Ú
visibilitys     r#   Úget_visibilityr;   =   s`   € å‡}‚}�TÑÔð Øˆ
ˆ
Ý	�Š�tÑ	Ô	ð Øˆ
ˆ
Ý	�Š˜Ñ	Ô	ð Ø ˆ
ˆ
ð ˆ
ØÐr.   Únodeúnodes.ClassDefÚboolc                ó   — | j         dk    S )NÚ	exception)Útype)r<   s    r#   Úis_exceptionrB   K   s   € àŒ9˜Ò#Ð#r.   é   é   é   )ÚALLÚPUB_ONLYr6   ÚOTHER)r2   r4   r3   r5   c                  ó"   — e Zd ZdZdd„Zdd
„ZdS )ÚFilterMixInz7Filter nodes according to a mode and nodes' visibility.Úmoder0   r   r%   c                óÔ   — d}|                      d¦  «        D ]H}	 |t          |         z  }Œ# t          $ r(}t          d|› �t          j        ¬¦  «         Y d}~ŒAd}~ww xY w|| _        dS )zInit filter modes.r   ú+zUnknown filter mode )ÚfileN)r   ÚMODESÚKeyErrorÚprintr)   ÚstderrÚ_FilterMixIn__mode)ÚselfrK   rS   ÚnummodÚexs        r#   Ú__init__zFilterMixIn.__init__f   s“   € àˆØ—j’j ‘o”oð 	Dð 	DˆFðDØ�% œ-Ñ'��øÝð Dð Dð DÝÐ1¨RÐ1Ð1½¼
ÐCÑCÔCÐCÐCÐCÐCÐCÐCøøøøðDøøøàˆŒˆˆs   ›,¬
A¶AÁAr<   únodes.NodeNG | strr>   c                ój   — t          t          |d|¦  «        ¦  «        }| j        t          |         z   S )z*Return true if the node should be treated.r/   )r;   ÚgetattrrS   ÚVIS_MOD)rT   r<   r:   s      r#   Ú	show_attrzFilterMixIn.show_attrp   s0   € å#¥G¨D°&¸$Ñ$?Ô$?Ñ@Ô@ˆ
Ø”;¥¨Ô!4Ñ4Ð4Ð4r.   N)rK   r0   r   r%   )r<   rX   r   r>   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__rW   r\   © r.   r#   rJ   rJ   c   sB   € € € € € ØAÐAðð ð ð ð5ð 5ð 5ð 5ð 5ð 5r.   rJ   c                  ó*   — e Zd ZdZdd„Zdd„Zdd
„ZdS )ÚLocalsVisitora  Visit a project by traversing the locals dictionary.

    * visit_<class name> on entering a node, where class name is the class of
    the node in lower case

    * leave_<class name> on leaving a node, where class name is the class of
    the node in lower case
    r   r%   c                ó:   — i | _         t          ¦   «         | _        d S ©N)Ú_cacheÚsetÚ_visited)rT   s    r#   rW   zLocalsVisitor.__init__€   s   € ØACˆŒÝ+.©5¬5ˆŒˆˆr.   r<   únodes.NodeNGÚ_CallbackTupleTc           	     ó2  — |j         }| j                             |¦  «        }|€l|j                             ¦   «         }t          | d|› �t          | dd¦  «        ¦  «        }t          | d|› �t          | dd¦  «        ¦  «        }||f| j        |<   n|\  }}||fS )z0Get callbacks from handler for the visited node.NÚvisit_Úvisit_defaultÚleave_Úleave_default)Ú	__class__rf   r   r]   ÚlowerrZ   )rT   r<   ÚklassÚmethodsÚkidÚe_methodÚl_methods          r#   Úget_callbackszLocalsVisitor.get_callbacks„   s±   € à”ˆØ”+—/’/ %Ñ(Ô(ˆØˆ?Ø”.×&Ò&Ñ(Ô(ˆCÝØ�n˜s�n�n¥g¨d°OÀTÑ&JÔ&Jñô ˆHõ Ø�n˜s�n�n¥g¨d°OÀTÑ&JÔ&Jñô ˆHð #+¨HÐ!5ˆDŒK˜ÑÐà!(ÑˆH�hØ˜Ð!Ð!r.   r   c                óV  — || j         v rdS | j                              |¦  «         |                      |¦  «        }|d         � |d         |¦  «         t          |d¦  «        r,|                     ¦   «         D ]}|                      |¦  «         Œ|d         � |d         |¦  «        S dS )z.Launch the visit starting from the given node.Nr   Úlocalsr'   )rh   Úaddrw   ÚhasattrÚvaluesÚvisit)rT   r<   rs   Ú
local_nodes       r#   r}   zLocalsVisitor.visit•   s¼   € à�4”=Ð Ð Ø�4àŒ×Ò˜$ÑÔÐØ×$Ò$ TÑ*Ô*ˆØ�1Œ:Ð!ØˆG�AŒJ�tÑÔÐÝ�4˜Ñ"Ô"ð 	'Ø"Ÿkšk™mœmð 'ð '�
Ø—
’
˜:Ñ&Ô&Ð&Ð&Ø�1Œ:Ð!Ø�7˜1”:˜dÑ#Ô#Ð#Øˆtr.   N©r   r%   )r<   ri   r   rj   )r<   ri   r   r   )r]   r^   r_   r`   rW   rw   r}   ra   r.   r#   rc   rc   v   sZ   € € € € € ðð ð1ð 1ð 1ð 1ð"ð "ð "ð "ð"ð ð ð ð ð r.   rc   Úannúnodes.Name | nodes.NodeNGc                ó²   — t          | t          j        ¦  «        r| j        �| j        S t          | t          j        ¦  «        r|                      ¦   «         S dS )Nr   )Ú
isinstancer
   ÚNamer/   ÚNodeNGÚ	as_string)r€   s    r#   Úget_annotation_labelr‡   ¦   sK   € Ý�#•u”zÑ"Ô"ð  s¤xÐ';ØŒxˆÝ�#•u”|Ñ$Ô$ð Ø�}Š}‰ŒÐØˆ2r.   ú#nodes.AssignAttr | nodes.AssignNameú#nodes.Name | nodes.Subscript | Nonec                óä  — d}t          | j        t          j        ¦  «        r| j        j        }n…t          | t          j        ¦  «        ri| j        j        }	 t          t          |j        |j	        j
        ¦  «        ¦  «        } |j        | j        j        j        ¦  «        }n# t          $ r Y nw xY w|S 	 |                      ¦   «         ^}}n# t           j        $ r d}Y nw xY wt%          |¦  «        }|rqt'          |dd¦  «        €`|                     d¦  «        sKt          |t          j        ¦  «        r+t-          d„ |                     ¦   «         D ¦   «         ¦  «        sd|› d�}|r	|r||_        |S )z!Return the annotation for `node`.Nr   Úvaluer   c              3  ó\   K  — | ]'}t          |t          j        ¦  «        o|j        d u V — Œ(d S re   )rƒ   r
   ÚConstr‹   )Ú.0Úchilds     r#   ú	<genexpr>z!get_annotation.<locals>.<genexpr>Ì   sN   è è € ð ð àõ ˜5¥%¤+Ñ.Ô.ÐF°5´;À$Ð3Fðð ð ð ð ð r.   z	Optional[ú])rƒ   Úparentr
   Ú	AnnAssignÚ
annotationÚ
AssignAttrÚdictÚzipry   Úargsr   r   r‹   r/   ÚAttributeErrorÚinferÚastroidÚInferenceErrorr‡   rZ   Ú
startswithÚBinOpÚanyÚget_children)r<   r€   Úinit_methodr   ÚdefaultÚ_Úlabels          r#   Úget_annotationr¥   ®   s°  € ð €CÝ�$”+�uœÑ/Ô/ð 
ØŒkÔ$ˆˆÝ	�D�%Ô*Ñ	+Ô	+ð Ø”kÔ(ˆð	Ý�s ;Ô#5°{Ô7GÔ7SÑTÔTÑUÔUˆKØ!�+”/ $¤+Ô"3Ô"8Ñ9Ô9ˆCˆCøÝð 	ð 	ð 	ØˆDð	øøøð ˆ
ðØ—j’j‘l”lˆˆ�!�!øÝÔ!ð ð ð Øˆˆˆðøøøõ ! Ñ%Ô%€Eð 	ð&å�G˜W gÑ.Ô.Ð6Ø× Ò  Ñ,Ô,ð 7õ ˜3¥¤Ñ,Ô,ð 7õ ð ð à ×-Ò-Ñ/Ô/ðñ ô ñ ô ð	 7ð &˜UÐ%Ð%Ð%ˆàð �ð ØˆŒØ€Js%   ÁAB" Â"
B/Â.B/Â5C ÃC ÃC úset[InferenceResult]c                ó~  — t          | ¦  «        }	 |rct          |t          j        ¦  «        s%t          |t          j        ¦  «        r|j        dk    r|hS t          |                     ¦   «         ¦  «        S t          |                      ¦   «         ¦  «        S # t          j	        $ r |r|hnt          ¦   «         cY S w xY w)z�Return a set containing the node annotation if it exists
    otherwise return a set of the inferred types using the NodeNG.infer method.
    ú|)
r¥   rƒ   r
   Ú	Subscriptrž   Úoprg   rš   r›   rœ   )r<   r€   s     r#   Ú
infer_noder«   Ù   s½   € õ
 ˜Ñ
Ô
€Cð	'Øð 	$Ý˜#�uœÑ/Ô/ð Ý˜3¥¤Ñ,Ô,ðØ14´¸3²°à�u�Ý�s—y’y‘{”{Ñ#Ô#Ð#Ý�4—:’:‘<”<Ñ Ô Ð øÝÔ!ð 'ð 'ð 'ØÐ&�ˆuˆu¥¡¤Ð&Ð&Ð&ð'øøøs   ‘AB Á B Á6 B Â"B<Â;B<c                 óx   — t          j        d¦  «        €%t          d¦  «         t          j        d¦  «         dS dS )zÁCheck if the ``dot`` command is available on the machine.

    This is needed if image output is desired and ``dot`` is used to convert
    from *.dot or *.gv into the final output format.
    ÚdotNz?'Graphviz' needs to be installed for your chosen output format.é    )ÚshutilÚwhichrQ   r)   Úexitra   r.   r#   Úcheck_graphviz_availabilityr²   ë   s<   € õ „|�EÑÔÐ"ÝÐOÑPÔPÐPÝŒ�‰Œˆˆˆð #Ð"r.   Úoutput_formatc                óf  — t          j        ddgddd¬¦  «        }t          j        d|j                             ¦   «         ¬¦  «        }|st          d	¦  «         d
S |                     d¦  «        }| |                     ¦   «         vr+t          d| › d|› �¦  «         t          j
        d¦  «         d
S d
S )zÁCheck if the ``dot`` command supports the requested output format.

    This is needed if image output is desired and ``dot`` is used to convert
    from *.gv into the final output format.
    r­   z-T?TFr   )Úcapture_outputÚcheckr   z$.*Use one of: (?P<formats>(\S*\s?)+))ÚpatternÚstringzªUnable to determine Graphviz supported output formats. Pyreverse will continue, but subsequent error messages regarding the output format may come from Graphviz directly.NÚformatszFormat z, is not supported by Graphviz. It supports: r®   )Ú
subprocessÚrunÚrer7   rR   ÚstriprQ   Úgroupr   r)   r±   )r³   Ú
dot_outputr7   Úsupported_formatss       r#   Ú!check_if_graphviz_supports_formatrÁ   ö   sè   € õ ”Ø	�ˆ t°5À7ðñ ô €Jõ ŒHØ7ØÔ ×&Ò&Ñ(Ô(ðñ ô €Eð ð ÝðKñ	
ô 	
ð 	
ð
 	ˆØŸš IÑ.Ô.ÐØÐ-×3Ò3Ñ5Ô5Ð5Ð5ÝØd�mÐdÐdÐQbÐdÐdñ	
ô 	
ð 	
õ 	Œ�‰Œˆˆˆð	 6Ð5r.   )r   r   r   )r/   r0   r   r0   )r<   r=   r   r>   )r€   r�   r   r0   )r<   rˆ   r   r‰   )r<   rˆ   r   r¦   )r³   r0   r   r%   ).r`   Ú
__future__r   r   r¼   r¯   rº   r)   Útypingr   r   r   r   r   r	   r›   r
   Úastroid.typingr   Úpylint.pyreverse.diagramsr   r   r…   Ú
_CallbackTrj   r   r$   r-   Úcompiler6   r8   r9   r;   rB   Ú_SPECIALÚ
_PROTECTEDÚ_PRIVATErO   r[   rJ   rc   r‡   r¥   r«   r²   rÁ   ra   r.   r#   ú<module>rË      s½  ðð
 ?Ð >à "Ð "Ð "Ð "Ð "Ð "à 	€	€	€	Ø 	€	€	€	Ø €€€Ø Ð Ð Ð Ø 
€
€
€
Ø GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ Gà €€€Ø Ð Ð Ð Ð Ð Ø *Ð *Ð *Ð *Ð *Ð *àð HØFÐFÐFÐFÐFÐFÐFÐFàØ	ŒˆØˆe�LÔ! 5¨¸Ð)EÔ#FÈÐLÔMð	Oô€Jð ˜H ZÔ0°(¸:Ô2FÐFÔG€Oð 
€ðð ð ð ð ð  ð  ð  ð ˆ"Œ*Ð)Ñ
*Ô
*€Ø
ˆ"Œ*Ð)Ñ
*Ô
*€ØˆBŒJ�yÑ!Ô!€	ðð ð ð ð$ð $ð $ð $ð €Ø€
Ø€àØ˜:Ñ%¨Ñ0ØØ˜(Ñ"ð		ð 	€ð ØØØð	ð €ð5ð 5ð 5ð 5ð 5ñ 5ô 5ð 5ð&-ð -ð -ð -ð -ñ -ô -ð -ð`ð ð ð ð(ð (ð (ð (ðV'ð 'ð 'ð 'ð$ð ð ð ðð ð ð ð ð r.   