o
    g                     @   s   d dl Z d dlZd dlmZmZmZ d dlmZ d dlm	Z	m
Z
 dddZdedefd	d
Zdedee defddZdee dee dee dee deee
 ee	 f f
ddZdS )    N)ListPatternTuple)modutils)ErrorDescriptionDictModuleDescriptionDictc                    s    fdd}t j| ||dS )Nc                    s   t | |p S N)r   check_modpath_has_init)pathpartsis_namespace X/home/ubuntu/cloudmapper/venv/lib/python3.10/site-packages/pylint/lint/expand_modules.py_is_package_cb   s   z*_modpath_from_file.<locals>._is_package_cb)r
   is_package_cb)r   modpath_from_file_with_callback)filenamer   r
   r   r   r   r   _modpath_from_file
   s   r   filepathreturnc                 C   sj   t jt j| }t j|st j|}	 t jt j|ds$|S |}t j|}||kr4t  S q)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_dirnamer   r   r   get_python_path   s   r!   elementignore_list_rec                 C   s   |D ]
}| | r dS qdS )z;determines if the element is matched in a regex ignore-listTF)match)r"   r#   file_patternr   r   r   _is_in_ignore_list_re"   s
   
r&   files_or_modulesignore_listignore_list_paths_rec                 C   sd  g }g }t j }| D ]!}tj|}||v s&ttj||s&t||r'qt|}	d|	g| }
tj|rfzdt	j
||
d}W n tyT   tj|d }Y nw tj|rctj|d}n5|}n2|}zt	j|d|
d}|du ryW qW n ttfy } z|d||d W Y d}~qd}~ww tj|}|p|d}z	t	j||
d}W n ty   d}tj|}Y nw t	|}t	|}|s|||d	||d
 |dp|dk otj|dk}|s|s|r-t	jtj|||dD ]0}||krqttj||st||rqt|||
d}d|}|||d||d
 qq||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)r
   nameisargbasepathbasenamez	.__init____init__)list_all)sysr
   copyr   r2   r&   r!   r   r   r   modpath_from_fileImportErrorsplitextr   file_from_modpathsplitSyntaxErrorappendnormpathfile_info_from_modpathr   is_directoryendswithget_module_filesr   r   )r'   r(   r#   r)   resulterrorsr
   	somethingr2   module_pathadditional_search_pathmodnamer   r.   modpartsspecr   r@   has_initsubfilepathmodpath
submodnamer   r   r   expand_modules*   s   	









	rO   r   )r   r5   typingr   r   r   astroidr   pylint.typingr   r   r   strr!   boolr&   rO   r   r   r   r   <module>   s&    
	