mpylab.tools.compare module

mpylab.tools.compare module.

mpylab.tools.compare.cmp(a, b)

cmp function.

mpylab.tools.compare.cplx_cmp(a, b)

cplx_cmp function.

mpylab.tools.compare.cplx_key(a)

cplx_key function.

mpylab.tools.compare.fstrcmp(a, possibilities, cutoff=0.0, ignorecase=True, use_rmcp=True)

fstrcmp function.

mpylab.tools.compare.fstrcmp_scpi(a, possibilities, cutoff=0.0, ignorecase=True)

Token-based fuzzy matcher for SCPI commands.

The command is split at ‘:’ and each token is compared separately. Ranking prefers: 1. exact token matches 2. token prefix matches 3. token substring matches 4. best fuzzy token similarity

Example

fstrcmp_scpi(“BAND”, [“SENS:FREQ:START”, “SENS:BAND:RES”]) -> [“SENS:BAND:RES”, “SENS:FREQ:START”]

mpylab.tools.compare.relative(a, b, first_must_match=True)

Computes a relative distance between two strings. It’s in the range (0-1] where 1 means total equality. @type a: string @param a: arg one @type b: string @param b: arg two @rtype: float @return: the distance

mpylab.tools.compare.rmcp(seq, ignorecase=True)

remove common prefix from sequence elements