def _violator_values (self) : inv = self.inv bvars = list \ ( x.strip () for x in inv.bvar.replace ("(", "").replace (")", "").split (",") ) for v, d in paired (self.violators, self.violators_attr) : if len (bvars) > 1 and isinstance (v, (list, tuple)) : for k, w in paired (flattened (bvars), flattened (v)) : yield (pyk.decoded (k.strip (), "utf-8"), ui_display (w)) elif isinstance (v, (list, tuple)) : yield \ ( pyk.decoded (inv.bvar, "utf-8") , "[%s]" % (", ".join (map (str, v)), ) ) else : yield (pyk.decoded (inv.bvar, "utf-8"), ui_display (v)) if d : try : items = pyk.iteritems (d) except AttributeError : val = ui_display (d) else : val = sorted \ ( (pyk.decoded (a, "utf-8"), ui_display (x)) for (a, x) in items ) yield ui_display (v), val
def _violator_values (self) : inv = self.inv bvars = list \ ( x.strip () for x in inv.bvar.replace ("(", "").replace (")", "").split (",") ) for v, d in paired (self.violators, self.violators_attr) : if len (bvars) > 1 and isinstance (v, (list, tuple)) : for k, w in paired (flattened (bvars), flattened (v)) : yield (pyk.decoded (k.strip (), "utf-8"), ui_display (w)) elif isinstance (v, (list, tuple)) : yield \ ( pyk.decoded (inv.bvar, "utf-8") , "[%s]" % (", ".join (map (pyk.text_type, v)), ) ) else : yield (pyk.decoded (inv.bvar, "utf-8"), ui_display (v)) if d : try : items = pyk.iteritems (d) except AttributeError : val = ui_display (d) else : val = sorted \ ( (pyk.decoded (a, "utf-8"), ui_display (x)) for (a, x) in items ) yield ui_display (v), val
def __init__ (self, e_type, epk, kw, count, * matches) : assert 1 < count <= len (matches), \ "count = %s, matches = %s" % (count, matches) self.e_type = e_type self.epk = ui_display (epk) self.kw = kw self.count = count self.matches = tuple (m.ui_display for m in matches) self.FO = matches [0].FO