ok

Mini Shell

Direktori : /proc/self/root/opt/alt/python33/lib64/python3.3/unittest/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python33/lib64/python3.3/unittest/__pycache__/util.cpython-33.pyo

�
ryMa=c@s�dZddlmZmZdZdZddd�Zdd�Z	dd	�Z
d
d�Zdd
�Zedd�Z
dd�Zdd�Zdd�ZdS(uVarious utility functions.i(u
namedtupleuOrderedDictiPcCscyt|�}Wn!tk
r3tj|�}YnX|sMt|�tkrQ|S|dt�dS(Nu [truncated]...(urepru	Exceptionuobjectu__repr__ulenu_MAX_LENGTH(uobjushorturesult((u2/opt/alt/python33/lib64/python3.3/unittest/util.pyu	safe_reprs
u	safe_reprcCsd|j|jfS(Nu%s.%s(u
__module__u__name__(ucls((u2/opt/alt/python33/lib64/python3.3/unittest/util.pyustrclasssustrclasscCsnd}}g}g}xKy||}||}||krw|j|�|d7}x�|||krs|d7}qVWn�||kr�|j|�|d7}x|||kr�|d7}q�Wn^|d7}z%x|||kr�|d7}q�WWd|d7}x|||kr|d7}q�WXWqtk
r`|j||d��|j||d��PYqXq||fS(urFinds elements in only one or the other of two, sorted input lists.

    Returns a two-element tuple of lists.    The first list contains those
    elements in the "expected" list but not in the "actual" list, and the
    second contains those elements in the "actual" list but not in the
    "expected" list.    Duplicate elements in either input list are ignored.
    iiN(uappendu
IndexErroruextend(uexpecteduactualuiujumissingu
unexpectedueua((u2/opt/alt/python33/lib64/python3.3/unittest/util.pyusorted_list_differences:









	usorted_list_differencecCs\g}xI|rQ|j�}y|j|�Wq	tk
rM|j|�Yq	Xq	W||fS(u�Same behavior as sorted_list_difference but
    for lists of unorderable items (like dicts).

    As it does a linear search per item (remove) it
    has O(n*n) performance.(upopuremoveu
ValueErroruappend(uexpecteduactualumissinguitem((u2/opt/alt/python33/lib64/python3.3/unittest/util.pyuunorderable_list_difference=s	
uunorderable_list_differencecCs||k||kS(u.Return -1 if x < y, 0 if x == y and 1 if x > y((uxuy((u2/opt/alt/python33/lib64/python3.3/unittest/util.pyu
three_way_cmpNsu
three_way_cmpuMismatchuactual expected valuecCs�t|�t|�}}t|�t|�}}t�}g}x�t|�D]�\}}	|	|krlqNnd}
}x>t||�D]-}|||	kr�|
d7}
|||<q�q�Wx=t|�D]/\}}
|
|	kr�|d7}|||<q�q�W|
|krNt|
||	�}|j|�qNqNWx�t|�D]�\}}	|	|krTq6nd}x>t||�D]-}|||	krj|d7}|||<qjqjWtd||	�}|j|�q6W|S(uHReturns list of (cnt_act, cnt_exp, elem) triples where the counts differii(ulistulenuobjectu	enumerateurangeu	_Mismatchuappend(uactualuexpectedusutumunuNULLuresultuiuelemucnt_sucnt_tuju
other_elemudiff((u2/opt/alt/python33/lib64/python3.3/unittest/util.pyu_count_diff_all_purposeTs<	



u_count_diff_all_purposecCs8t�}x(|D] }|j|d�d||<qW|S(u@Return dict of element counts, in the order they were first seenii(uOrderedDictuget(uiterableucuelem((u2/opt/alt/python33/lib64/python3.3/unittest/util.pyu_ordered_countws	
u_ordered_countc	Cs�t|�t|�}}g}xZ|j�D]L\}}|j|d�}||kr,t|||�}|j|�q,q,WxH|j�D]:\}}||kr�td||�}|j|�q�q�W|S(uHReturns list of (cnt_act, cnt_exp, elem) triples where the counts differi(u_ordered_countuitemsugetu	_Mismatchuappend(	uactualuexpectedusuturesultuelemucnt_sucnt_tudiff((u2/opt/alt/python33/lib64/python3.3/unittest/util.pyu_count_diff_hashable~su_count_diff_hashableNTF(u__doc__ucollectionsu
namedtupleuOrderedDictuTrueu
__unittestu_MAX_LENGTHuFalseu	safe_reprustrclassusorted_list_differenceuunorderable_list_differenceu
three_way_cmpu	_Mismatchu_count_diff_all_purposeu_ordered_countu_count_diff_hashable(((u2/opt/alt/python33/lib64/python3.3/unittest/util.pyu<module>s	)#

Zerion Mini Shell 1.0