def _sortOffer(self, offer): categoryLimitChanges = [] stackLimitChanges = [] setAccumulators = [] stackables = [] locatable = [] accumulators = [] doIds = [] for i in offer: a = i[0] if InventoryId.isLimitChange(a): changing = InventoryId.getChangeCategoryOrType(a) if InventoryId.isCategory(changing): categoryLimitChanges.append(i) elif InventoryId.isStackable(changing): stackLimitChanges.append(i) elif InventoryId.isAccumulator(changing): setAccumulators.append(i) else: print '=============EXCEPTION1 RAISED: %s' % a raise Exception, 'undefined trade category' elif InventoryId.isStackable(a): stackables.append(i) elif isLocatable(a): locatable.append(i) elif InventoryId.isAccumulator(a): accumulators.append(i) elif InventoryId.isCategory(a): doIds.append(i) else: print '=============EXCEPTION2 RAISED: %s' % a raise Exception, 'undefined trade type' offer = categoryLimitChanges + stackLimitChanges + setAccumulators + stackables + locatable + accumulators + doIds
def _sortOffer(self, offer): categoryLimitChanges = [] stackLimitChanges = [] setAccumulators = [] stackables = [] locatable = [] accumulators = [] doIds = [] for i in offer: a = i[0] if InventoryId.isLimitChange(a): changing = InventoryId.getChangeCategoryOrType(a) if InventoryId.isCategory(changing): categoryLimitChanges.append(i) elif InventoryId.isStackable(changing): stackLimitChanges.append(i) elif InventoryId.isAccumulator(changing): setAccumulators.append(i) else: print "=============EXCEPTION1 RAISED: %s" % a raise Exception, "undefined trade category" InventoryId.isCategory(changing) if InventoryId.isStackable(a): stackables.append(i) continue if isLocatable(a): locatable.append(i) continue if InventoryId.isAccumulator(a): accumulators.append(i) continue if InventoryId.isCategory(a): doIds.append(i) continue print "=============EXCEPTION2 RAISED: %s" % a raise Exception, "undefined trade type" offer = ( categoryLimitChanges + stackLimitChanges + setAccumulators + stackables + locatable + accumulators + doIds )