Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib/python3.7/site-packages/prospector/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/prospector/__pycache__/autodetect.cpython-37.pyc

B

a�\j�@s�ddlZddlZddlZddlmZddlmZddlmZddl	m
Z
dZe�d�Z
e�d�Ze�d	�Zd
d�Zdd
�Zdd�Zdd�ZdS)�N)�find_requirements)�RequirementsNotFound)�encoding)�
is_virtualenv)ZdjangoZceleryZflaskz%^\s*from ([\._a-zA-Z0-9]+) import .*$z^\s*import ([\._a-zA-Z0-9]+)$z$^\s*import ([\._a-zA-Z0-9]+(, ){1})+cCs�t�}x�|�d�D]�}t�|�}|rrg}|�d�}|�|dd��xZ|�|�d�d�D]}|�|���qZWn.t�|�p�t�|�}|dkr�q|�d��d�}x|D]}|t	kr�|�
|�q�WqW|S)N�
�����,�.)�set�split�_IMPORT_MULTIPLE_REGEX�match�group�append�strip�
_IMPORT_REGEX�_FROM_IMPORT_REGEX�POSSIBLE_LIBRARIES�add)�
file_contents�names�linerZimport_names�first�nameZimport_name�r�F/opt/alt/python37/lib/python3.7/site-packages/prospector/autodetect.py�find_from_importss"


rcCs�t�}tt�}x�t�|�D]�}tj�tj�||��}tj�|�rXt	|�rJq|t
|�O}nntj�|�s�|�d�r�yt
�|�}|t|�O}Wn<t
jk
r�}zt�d�|j|j�t�Wdd}~XYnXt|�|krPqW|S)Nz.pyz{0}: {1})r�lenr�os�listdir�path�abspath�join�isdirr�find_from_path�islink�endswithrZread_py_filerZCouldNotHandleEncoding�warnings�warn�format�cause�
ImportWarning)r!rZmax_possible�itemZ	item_path�contents�errrrrr%*s"
*r%cCsFt|�}g}x4|D],}|jdk	r|j��tkr|�|j���qW|S)N)rr�lowerrr)r!�reqsr�requirementrrr�find_from_requirementsCs

r3cCsftj�|�r$tj�|�}|dkr$d}g}yt|�}Wntk
rHYnXt|�tt�krbt|�}|S)N�r
)	rr!�isfile�dirnamer3rrrr%)r!�	librariesrrr�autodetect_librariesMsr8)r(r�reZrequirements_detectorrZrequirements_detector.detectr�
prospectorrZprospector.pathutilsrr�compilerrr
rr%r3r8rrrr�<module>s