File "util.cpython-36.opt-1.pyc"

Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/opt/alt/python36/lib64/python3.6/unittest/__pycache__/util.cpython-36.opt-1.pyc
File size: 4.59 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit

3

 f9@sdZddlmZmZddlmZdZdZdZdZ	dZ
dZee	eeee
Zdd	Z
d
dZd d
dZddZddZddZddZeddZddZddZddZdS)!zVarious utility functions.)
namedtupleOrderedDict)commonprefixTPcCsBt|||}|tkr>d|d|||t||df}|S)Nz%s[%d chars]%s)len_PLACEHOLDER_LEN)s	prefixlenZ	suffixlenskipr
2/opt/alt/python36/lib64/python3.6/unittest/util.py_shortens&rcsttt|}ttt|}|tkr(|St|tt|tt}|t	krxt
t|tfdd|DSt
tt	tfdd|DS)Nc3s|]}|dVqdS)Nr
).0r
)prefixrr
r	<genexpr>'sz'_common_shorten_repr.<locals>.<genexpr>c3s&|]}t|dttVqdS)N)r
_MIN_DIFF_LEN_MIN_END_LEN)rr
)rrr
rr*s)tuplemap	safe_reprmaxr_MAX_LENGTHr_MIN_BEGIN_LENr	_MIN_COMMON_LENr)argsmaxlenZ
common_lenr
)rrr_common_shorten_reprsrFcCsRyt|}Wntk
r*tj|}YnX|s>t|tkrB|S|dtdS)Nz [truncated]...)repr	Exceptionobject__repr__rr)objZshortresultr
r
rr-srcCsd|j|jfS)Nz%s.%s)
__module____qualname__)clsr
r
rstrclass6sr(cCs*d}}g}g}xy||}||}||kr\|j||d7}x|||krX|d7}qBWn||kr|j||d7}xf|||kr|d7}qxWnL|d7}zx|||kr|d7}qWWd|d7}x|||kr|d7}qWXWqtk
r|j||d|j||dPYqXqW||fS)arFinds 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.
    rN)append
IndexErrorextend)expectedactualijmissingZ
unexpectedear
r
rsorted_list_difference9s:

r4cCsLg}x>|rB|j}y|j|Wqtk
r>|j|YqXqW||fS)zSame 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.)popremove
ValueErrorr*)r-r.r1itemr
r
runorderable_list_differencebsr9cCs||k||kS)z.Return -1 if x < y, 0 if x == y and 1 if x > yr
)xyr
r
r
three_way_cmpssr<ZMismatchzactual expected valuecCsDt|t|}}t|t|}}t}g}xt|D]\}}	|	|krJq8d}
}x.t||D] }|||	kr^|
d7}
|||<q^Wx,t|D] \}}
|
|	kr|d7}|||<qW|
|kr8t|
||	}|j|q8Wxlt|D]`\}}	|	|krqd}x2t||D]$}|||	kr|d7}|||<qWtd||	}|j|qW|S)zHReturns list of (cnt_act, cnt_exp, elem) triples where the counts differrr))listrr!	enumeraterange	_Mismatchr*)r.r-r
tmnZNULLr$r/elemcnt_scnt_tr0Z
other_elemdiffr
r
r_count_diff_all_purposeys<rHcCs,t}x |D]}|j|dd||<qW|S)z@Return dict of element counts, in the order they were first seenrr))rget)iterablecrDr
r
r_ordered_counts
rLc	Cst|t|}}g}x>|jD]2\}}|j|d}||kr t|||}|j|q Wx2|jD]&\}}||kr`td||}|j|q`W|S)zHReturns list of (cnt_act, cnt_exp, elem) triples where the counts differr)rLitemsrIr@r*)	r.r-r
rAr$rDrErFrGr
r
r_count_diff_hashablesrNN)F)__doc__collectionsrrZos.pathrZ
__unittestrr	rrrrrrrr(r4r9r<r@rHrLrNr
r
r
r<module>s*
	)
#