3 ^D@s<ddZddZddZddZdd Zd d Zd d ZdS)cCs"|rt|jt|S||kSdS)z Match the object with optional regular expression. Parameters: obj The object to match. criteria The criteria to match. regex If regular expression matching should be used. N)boolsearchstr)objcriteriaregexr/usr/lib64/python3.6/util.py match_regexs r cCs|r ||kSt|j|SdS)a Match the object (a set) with optional set equality. Parameters: obj The object to match. (a set) criteria The criteria to match. (a set) equal If set equality should be used. Otherwise any set intersection will match. N)r intersection)rrequalrrr match_set%s r cs"|rfdd|DS|kSdS)z Match if the criteria is in the list, with optional regular expression matching. Parameters: obj The object to match. criteria The criteria to match. regex If regular expression matching should be used. csg|]}jt|r|qSr)rr).0m)rrr Bsz match_in_set..Nr)rrrr)rr match_in_set6s rcsF|r6|rfdd|jDStjj|jSn t||SdS)aK Match the object with optional regular expression and indirection. Parameters: obj The object to match. criteria The criteria to match. regex If regular expression matching should be used. indirect If object indirection should be used, e.g. expanding an attribute. csg|]}jt|r|qSr)rr)r o)rrrrUsz(match_indirect_regex..N)expandsetr r )rrZindirectrr)rrmatch_indirect_regexGs rcs*|rfdd|DSt|t|SdS)a" Match the object (a set) with either set comparisons (equality or intersection) or by regex matching of the set members. Regular expression matching will override the set equality option. Parameters: obj The object to match. (a set) criteria The criteria to match. equal If set equality should be used. Otherwise any set intersection will match. Ignored if regular expression matching is used. regex If regular expression matching should be used. csg|]}jt|r|qSr)rr)r r)rrrrmsz&match_regex_or_set..N)r r)rrr rr)rrmatch_regex_or_set\srcCs|rX|j|jko|jknpV|j|jko:|jknpV|j|jkoV|j|jkS|r|r|j|jkrx|j|jkp|j|jko|j|jkS|j|jko|j|jkSnp|r|r|j|jkr|j|jkp|j|jko|j|jkS|j|jko|j|jkSn|j|jko|j|jkSdS)aR Match ranges of objects. obj An object with attributes named "low" and "high", representing the range. criteria An object with attributes named "low" and "high", representing the criteria. subset If true, the criteria will match if it is a subset obj's range. overlap If true, the criteria will match if it overlaps any of the obj's range. superset If true, the criteria will match if it is a superset of the obj's range. proper If true, use proper superset/subset operations. No effect if not using set operations. N)ZlowZhigh)rrZsubsetZoverlapZsupersetZproperrrr match_rangers rcCs0|r ||kS|r||kS|r$||AS||kSdS)aX Match the an MLS level. obj The level to match. criteria The criteria to match. (a level) dom If true, the criteria will match if it dominates obj. domby If true, the criteria will match if it is dominated by obj. incomp If true, the criteria will match if it is incomparable to obj. Nr)rrZdomZdombyZincomprrr match_levels rN)r r rrrrrrrrrs !