d = read_name_val(f)
if d != None: q.append(d)
def mycmp(x, y):
- rc = cmp(x['Time'], y['Time'])
+ rc = util.cmp(x['Time'], y['Time'])
if rc == 0 and 'Type' in x and 'Type' in y:
- return cmp(x['Type'], y['Type'])
+ return util.cmp(x['Type'], y['Type'])
else:
return rc
q.sort(key=util.cmp_to_key(mycmp))
log.alert("found strange lock in got-lock: %s" % b)
def mycmp(b1, b2):
- return cmp(bs[b1], bs[b2])
+ return util.cmp(bs[b1], bs[b2])
bl.sort(key=util.cmp_to_key(mycmp))
def mycmp(r1, r2):
if r1.kind != 'group' or r2.kind != 'group':
raise Exception("non-group requests")
- pri_diff = cmp(r1.priority, r2.priority)
+ pri_diff = util.cmp(r1.priority, r2.priority)
if pri_diff == 0:
- return cmp(r1.time, r2.time)
+ return util.cmp(r1.time, r2.time)
else:
return pri_diff
q.requests.sort(key=util.cmp_to_key(mycmp))
def mycmp(r1, r2):
if r1.kind != 'group' or r2.kind != 'group':
raise Exception("non-group requests")
- pri_diff = cmp(r1.priority, r2.priority)
+ pri_diff = util.cmp(r1.priority, r2.priority)
if pri_diff == 0:
- return cmp(r1.time, r2.time)
+ return util.cmp(r1.time, r2.time)
else:
return pri_diff
q.requests.sort(key=util.cmp_to_key(mycmp))
return s
else:
raise TypeError("Expected bytes or string, but got %s." % type(s))
+
+def cmp(a, b):
+ return (a > b) - (a < b)