{fc@sdZddlmZmZeZdZedZdZ dZ edZ edd Z d Z d Zd Zd S(sVarious utility functions.i(t namedtuplet OrderedDictiPcCs\yt|}Wn tk r2tj|}nX| sLt|tkrP|S|t dS(Ns [truncated]...(treprt Exceptiontobjectt__repr__tlent _MAX_LENGTH(tobjtshorttresult((s%/usr/lib64/python2.7/unittest/util.pyt safe_reprs cCsd|j|jfS(Ns%s.%s(t __module__t__name__(tcls((s%/usr/lib64/python2.7/unittest/util.pytstrclassscCshd}}g}g}xEtr]y||}||}||kr}|j||d7}x|||kry|d7}q\Wn||kr|j||d7}x|||kr|d7}qWn^|d7}z%x|||kr|d7}qWWd|d7}x|||kr |d7}qWXWqtk rY|j|||j||PqXqW||fS(srFinds 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(tTruetappendt IndexErrortextend(texpectedtactualtitjtmissingt unexpectedteta((s%/usr/lib64/python2.7/unittest/util.pytsorted_list_differences:              cCsg}g}x|r|j}y|j|Wntk rR|j|nX|rxI||fD]8}yxtr|j|qrWWqftk rqfXqfWqqW|rxU|r|j}|j|yxtr|j|qWWqtk rqXqW||fS||fS(sSame 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. (tpoptremovet ValueErrorRR(RRtignore_duplicateRRtitemtlst((s%/usr/lib64/python2.7/unittest/util.pytunorderable_list_difference>s4           tMismatchsactual expected valuecCst|t|}}t|t|}}t}g}xt|D]\}} | |krlqNnd} } x>t||D]-} || | kr| d7} ||| t||D]-} || | krj| d7} ||| s  ) $ #