def loaded(result): self.debug("loaded tracks for %r trackScores", len(kept)) trackIdToScore = {} res = [] for trackScore in kept: trackIdToScore[trackScore.subjectId] = trackScore for succeeded, track in result: if not succeeded: log.warningFailure(track) else: trackScore = trackIdToScore[track.id] res.append((track, trackScore.score, trackScore.userId)) # res.sort(key=lambda r: r[0].id) if random: import random as rm rm.shuffle(res) return res
def eb(failure): log.warningFailure(failure) print 'ERROR: could not verify %s.%s: %r' % ( sourceKlazz.__name__, attribute, failure)
def eb(failure, file): log.warningFailure(failure) self.warning("failure %r on file %r" % (log.getFailureMessage(failure), file)) return failure