관리-도구
편집 파일: mypy.cpython-38.pyc
U -?�f�. � @ s� d dl mZ d dlZd dlZd dlmZ d dlZd dlZd dlZd dl Z ddl mZ ddlm Z ddlmZ d d lmZ e jjG dd� de��ZdS ) � )�annotationsN)�Path� )�TestBase� )�config)�eq_� )�utilc @ sz e Zd ZdZejdd�dd� �Zejdd�dd� �Zd d � Ze�� dd� �Z ejd d� �Z edd� �Zdd� Z dd� ZdS )�MypyTest)Zno_sqlalchemy2_stubs�function)�scopec c s | � � E d H d S �N�� _cachedir��self� r �P/opt/hc_python/lib64/python3.8/site-packages/sqlalchemy/testing/fixtures/mypy.py�per_func_cachedir s zMypyTest.per_func_cachedir�classc c s | � � E d H d S r r r r r r �cachedir! s zMypyTest.cachedirc c s� d}t �� �l}tt|�d d��}|�d|� d�� W 5 Q R X tt|�d d��}|�d|� d�� W 5 Q R X |V W 5 Q R X d S ) N� �sqla_mypy_config.cfg�wz� [mypy] plugins = sqlalchemy.ext.mypy.plugin show_error_codes = True z� disable_error_code = no-untyped-call [mypy-sqlalchemy.*] ignore_errors = True �plain_mypy_config.cfgz^ [mypy] show_error_codes = True z� disable_error_code = var-annotated,no-untyped-call [mypy-sqlalchemy.*] ignore_errors = True )�tempfile�TemporaryDirectory�openr �write)r Z mypy_pathr �config_filer r r r % s. ��� ���zMypyTest._cachedirc s ddl m� d� �fdd� }|S )Nr )�apiFc s� |d kr�}ddd|dt j�||r&dnd�g}t j�| �}t j�||�}| |kr\t�| |� |�|� t j�dd � � � |�\}}}|||fS )Nz--strictz--raise-exceptionsz--cache-dirz --config-filer r ZMYPY_FORCE_COLOR) �os�path�join�basename�shutil�copyfile�append�environ�pop�run) r# � use_pluginZuse_cachedir�args�filenameZtest_program�stdout�stderr�exitcode�r! r r r r+ N s, ��� z!MypyTest.mypy_runner.<locals>.run)FN)�mypyr! )r r r+ r r2 r �mypy_runnerJ s %zMypyTest.mypy_runnerc s d� �fdd� }|S )NFc s2 �� | �}� | |d�\}}}��| ||||� d S )N)r, )�_collect_messages� _check_output)r# r, �expected_messagesr/ r0 r1 �r4 r r r r+ w s �z)MypyTest.mypy_typecheck_file.<locals>.run)Fr )r r4 r+ r r8 r �mypy_typecheck_fileu s zMypyTest.mypy_typecheck_filec C s� t j�| �r| }n$t�� d j}t j�t j�|�| �}tt |�� d��}tjj D ],}|rPt j�|�rP|�t |�| � d�� qP|S )Nr z**/*.py)r"