
    yIf&                    ~    d dl mZ d dlZd dlZd dlmZ d dlmZ d dlm	Z	 d dl
mZmZ ddZddZddZd dZd!dZdS )"    )annotationsN)Sequence)Pattern)modutils)ErrorDescriptionDictModuleDescriptionDictfilenamestris_namespaceboolpath	list[str]returnc                >    d	fd}t          j        | ||          S )
N
inner_pathr
   partsr   r   r   c                2    t          j        | |          pS N)r   check_modpath_has_init)r   r   r   s     N/var/www/piapp/venv/lib/python3.11/site-packages/pylint/lint/expand_modules.py_is_package_cbz*_modpath_from_file.<locals>._is_package_cb   s    .z5AAQ\Q    )r   is_package_cb)r   r
   r   r   r   r   )r   modpath_from_file_with_callback)r	   r   r   r   s    `  r   _modpath_from_filer      sJ    R R R R R R 3t>   r   
modulepathsource_rootsSequence[str]c                   t           j                            t           j                            |                     }t           j                            |          st           j                            |          }|D ]g}t           j                            t           j                            |                    }t           j                            ||g          |k    r|c S h	 t           j                            t           j                            |d                    s|S |}t           j                            |          }||k    rt          j	                    S z)z<Discover package path from one its modules and source roots.T__init__.py)
osr   realpath
expanduserisdirdirname
commonpathexistsjoingetcwd)r   r   r%   source_rootold_dirnames        r   discover_package_pathr,      s   grw11*==>>G7==!! +'//'** $  g&&rw'9'9+'F'FGG7{G455DD E
w~~bgll7MBBCC 	N'//'**'!!9;;r   elementignore_list_relist[Pattern[str]]c                :     t           fd|D                       S )z<Determines if the element is matched in a regex ignore-list.c              3  B   K   | ]}|                               V  d S r   )match).0file_patternr-   s     r   	<genexpr>z(_is_in_ignore_list_re.<locals>.<genexpr>3   s1      NN||!!'**NNNNNNr   )any)r-   r.   s   ` r   _is_in_ignore_list_rer7   1   s&    NNNN~NNNNNNr   ignore_listignore_list_paths_rec                    t           j                            |           } t           j                            |           }||v pt	          ||          pt	          | |          S r   )r!   r   normpathbasenamer7   )r-   r8   r.   r9   r<   s        r   _is_ignored_filer=   6   sb     gw''Gw((HK 	@ >::	@ *>??r   files_or_modulesCtuple[dict[str, ModuleDescriptionDict], list[ErrorDescriptionDict]]c                   i }g }t           j                                        }| D ]Y}t          j                            |          }	t          ||||          r5t          ||          }
d|
g|}t          j                            |          r	 d                    t          j
        ||                    }n5# t          $ r( t          j                            |	          d         }Y nw xY wt          j                            |          r!t          j                            |d          }ne|}nb|}	 t          j        |                    d          |          }|=n1# t          $ r$}|                    d||d           Y d}~gd}~ww xY wt          j                            |          }|p|                    d          }	 t          j        ||          }t          j        |          }t          j        |          }n1# t          $ r$ d}t          j                            |          }Y nw xY w|s||v rd	||         d
<   n||d	||d||<   |                    d          p|dk     o"t          j                            |          dk    }|s|s|rt          j        t          j                            |          pd||          D ]}t          j                            |          }||k    r(t1          t          j                            |          |          st1          ||          rft3          |||          }d                    |          }||v o||         d
         }|||||d||<   [||fS )zTake a list of files/modules/packages and return the list of tuple
    (file, module name) which have to be actually checked.
    .)r   r   r    Nfatal)keymodexFTisarg)r   namerF   basepathr<   z	.__init____init__)list_all)sysr   copyr!   r<   r=   r,   r'   r(   r   modpath_from_fileImportErrorsplitextr$   file_from_modpathsplitappendr;   file_info_from_modpathr   is_directoryendswithget_module_filesr%   r7   r   )r>   r   r8   r.   r9   resulterrorsr   	somethingr<   module_package_pathadditional_search_pathmodnamefilepathrE   modpartsspecr   rT   has_initsubfilepathmodpath
submodnamerF   s                           r   expand_modulesrd   F   s+    02F)+F8==??D% U U	7##I..{N4H
 
 	 3I|LL"%':!BT!B7>>)$$ 	8((.y?UVVV   8 8 8'**844Q78w}}Y'' %7<<	=AA$  G#5MM#&&-C   # $   ggRHHIII 7##H--(y//44
	725  D $066L#066LL  	4 	4 	4 L7==33LLL	4  	6!!,0x )) %#! ( '$ $x  !!+..G'Z2GH <  **m; 	  	| 	| 	'8))0S+        !g..{;;{**(G$$[11>  *;8LMM ,4J   !XXg..
#v-N&2Eg2N'&" ( '' '{## 6>s<   )B::/C,+C,5+E##
F-FFH

+H87H8)r	   r
   r   r   r   r   r   r   )r   r
   r   r   r   r
   )r-   r
   r.   r/   r   r   )
r-   r
   r8   r   r.   r/   r9   r/   r   r   )r>   r   r   r   r8   r   r.   r/   r9   r/   r   r?   )
__future__r   r!   rK   collections.abcr   rer   astroidr   pylint.typingr   r   r   r,   r7   r=   rd    r   r   <module>rk      s   
 # " " " " " 				 



 $ $ $ $ $ $             E E E E E E E E      .O O O O
    d d d d d dr   