def _label_from_kvlayer(self, k, v):
        '''Make a label from a kvlayer row.'''
        (content_id1, content_id2, subtopic_id1, subtopic_id2,
         annotator_id, inverted_epoch_ticks) = k
        epoch_ticks = time_complement(inverted_epoch_ticks)

        (unpacked,) = struct.unpack('B', v[0])
        value = (unpacked & 15) - 1
        rating = (unpacked >> 4)
        meta = None
        if len(v) > 1:
            meta = cbor.loads(v[1:])

        return Label(content_id1=content_id1,
                     content_id2=content_id2,
                     annotator_id=annotator_id,
                     value=value,
                     subtopic_id1=subtopic_id1,
                     subtopic_id2=subtopic_id2,
                     epoch_ticks=epoch_ticks,
                     rating=rating,
                     meta=meta)
def _label_from_kvlayer ( self , k , v ) : ( content_id1 , content_id2 , subtopic_id1 , subtopic_id2 , annotator_id , inverted_epoch_ticks ) = k epoch_ticks = time_complement ( inverted_epoch_ticks ) ( unpacked , ) = struct . unpack ( 'B' , v [ 0 ] ) value = ( unpacked & 15 ) - 1 rating = ( unpacked >> 4 ) meta = None if len ( v ) > 1 : meta = cbor . loads ( v [ 1 : ] ) return Label ( content_id1 = content_id1 , content_id2 = content_id2 , annotator_id = annotator_id , value = value , subtopic_id1 = subtopic_id1 , subtopic_id2 = subtopic_id2 , epoch_ticks = epoch_ticks , rating = rating , meta = meta )
Make a label from a kvlayer row.