Your IP : 216.73.216.213
B
a�\- � @ sF d dl mZ d dlZd dlZdZd
dd�Zddd�Zdd � Ze� ZdS )� )�defaultdictN)�blend�BLEND_COMBOSc
s� �pt �dd� tt���D �}g }xZ| D ]R}|j|jf}d}x.t��D ]"\� }||krFd}|� �|� qFW |s(|�|� q(W xnt|�D ]b\� }t|�dkr�q�|j� �fdd�d� |d |kr�|�|d � x|d d
� D ]
} d| _q�W q�W dd� |D �S )z�
Given a list of messages on the same line, blend them together so that we
end up with one message per actual problem. Note that we can still return
more than one message here if there are two or more different errors for
the line.
c S s g | ]}g �qS � r )�.0�_r r �C/opt/alt/python37/lib/python3.7/site-packages/prospector/blender.py�
<listcomp> s zblend_line.<locals>.<listcomp>FTr c s �� � | j| jf�S )N)�index�source�code)�msg)�blend_combo_idx�blend_combosr r �<lambda>9 s zblend_line.<locals>.<lambda>)�key� Nc S s g | ]}t |d d�s|�qS )�usedF)�getattr)r �mr r r r M s ) r �range�lenr r � enumerate�append�sortr )
�messagesr Zblend_listsZblended�messager �foundZblend_comboZ
blend_listZnow_usedr )r r r �
blend_line s,
r c C sv |pt }tdd� �}x&| D ]}||jj |jj �|� qW g }x0|�� D ]$}x|�� D ]}|t||�7 }qXW qJW |S )Nc S s t t�S )N)r �listr r r r r T � zblend.<locals>.<lambda>)r r �location�path�liner �valuesr )r r Zmsgs_groupedr �outZby_lineZmessages_on_liner r r r P s
r c C sd t �t�td��} | �dg �} g }x8| D ]0}g }x|D ]}||�� 7 }q6W |�t|�� q(W t|�S )Nzblender_combinations.yaml�combinations) �yamlZ safe_load�
pkg_resources�resource_string�__name__�get�itemsr �tuple)Zcombos�defaultsZcomboZtoblendr
r r r �get_default_blend_combinationsd s
r/ )N)N) �collectionsr r( r'