<s> """<STR_LIT>""" <EOL> def check_qids ( qids ) : <EOL> """<STR_LIT>""" <EOL> seen_qids = set ( ) <EOL> prev_qid = None <EOL> for qid in qids : <EOL> assert qid is not None <EOL> if qid != prev_qid : <EOL> if qid in seen_qids : <EOL> raise ValueError ( '<STR_LIT>' ) <EOL> seen_qids . add ( qid ) <EOL> prev_qid = qid <EOL> return len ( seen_qids ) <EOL> def get_groups ( qids ) : <EOL> """<STR_LIT>""" <EOL> prev_qid = None <EOL> prev_limit = <NUM_LIT:0> <EOL> total = <NUM_LIT:0> <EOL> for i , qid in enumerate ( qids ) : <EOL> total += <NUM_LIT:1> <EOL> if qid != prev_qid : <EOL> if i != prev_limit : <EOL> yield ( prev_qid , prev_limit , i ) <EOL> prev_qid = qid <EOL> prev_limit = i <EOL> if prev_limit != total : <EOL> yield ( prev_qid , prev_limit , total ) </s>
