def generate_data(self, obj): """Generate data to insert into the Permutation table.""" data = { 'id': srz.perm_to_int(obj), 'cycle_decomp': srz.seq_to_int(obj.cycle_decomposition.count) } yield data
def generate_data(self, obj): """Generate data to insert into the Histogram table.""" for cycle_decomp, count in obj['fingerprint'].iteritems(): decomp = srz.seq_to_int(cycle_decomp) yield {'id': obj['id'], 'decomp': decomp, 'count': count}