
    c&                    ~    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     :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   filepathc                   t           j                            t           j                            |                     }t           j                            |          st           j                            |          }	 t           j                            t           j                            |d                    s|S |}t           j                            |          }||k    rt          j                    S z)zTODO This get the python path with the (bad) assumption that there is always
    an __init__.py.

    This is not true since python 3.3 and is causing problem.
    T__init__.py)	osr   realpath
expanduserisdirdirnameexistsjoingetcwd)r   r#   old_dirnames      r   get_python_pathr(      s     grw11(;;<<G7==!! +'//'**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>.   s1      NN||!!'**NNNNNNr   )any)r)   r*   s   ` r   _is_in_ignore_list_rer3   ,   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basenamer3   )r)   r4   r*   r5   r8   s        r   _is_ignored_filer9   1   sb     gw''Gw((HK 	@ >::	@ *>??r   files_or_modulesSequence[str]Ctuple[dict[str, ModuleDescriptionDict], list[ErrorDescriptionDict]]c                   i }g }t           j                                        }| D ]8}t          j                            |          }t          ||||          r5t          |          }	d|	g|z   }
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                            |          ||          D ]}||k    r	t1          t          j                            |          |          st1          ||          rGt3          |||
          }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   namerC   basepathr8   z	.__init____init__)list_all)sysr   copyr   r8   r9   r(   r$   r%   r   modpath_from_fileImportErrorsplitextr"   file_from_modpathsplitappendr7   file_info_from_modpathr   is_directoryendswithget_module_filesr#   r3   r   )r:   r4   r*   r5   resulterrorsr   	somethingr8   module_pathadditional_search_pathmodnamer   rB   modpartsspecr   rQ   has_initsubfilepathmodpath
submodnamerC   s                          r   expand_modulesr`   A   s    02F)+F8==??D% T T	7##I..{N4H
 
 	 %i00"%{!3d!: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));        {* (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
   r4   r   r*   r+   r5   r+   r   r   )
r:   r;   r4   r   r*   r+   r5   r+   r   r<   )
__future__r   r   rH   collections.abcr   rer   astroidr   pylint.typingr   r   r   r(   r3   r9   r`    r   r   <module>rg      s   
 # " " " " " 				 



 $ $ $ $ $ $             E E E E E E E E      $O O O O
    b b b b b br   