<s> """<STR_LIT>""" <EOL> def name ( ) : <EOL> """<STR_LIT>""" <EOL> return '<STR_LIT>' <EOL> def expand ( value ) : <EOL> """<STR_LIT>""" <EOL> return expand_item ( value ) <EOL> def block_to_list ( block ) : <EOL> """<STR_LIT>""" <EOL> block += '<STR_LIT:U+002C>' <EOL> result = [ ] <EOL> val = val1 = '<STR_LIT>' <EOL> in_range = False <EOL> for letter in block : <EOL> if letter in [ '<STR_LIT:U+002C>' , '<STR_LIT:->' ] : <EOL> if in_range : <EOL> val2 = val <EOL> val2_len = len ( val2 ) <EOL> for value in range ( int ( val1 ) , int ( val2 ) + <NUM_LIT:1> ) : <EOL> if val1 . startswith ( '<STR_LIT:0>' ) : <EOL> result . append ( str ( value ) . zfill ( val2_len ) ) <EOL> else : <EOL> result . append ( str ( value ) ) <EOL> val = '<STR_LIT>' <EOL> val1 = None <EOL> in_range = False <EOL> else : <EOL> val1 = val <EOL> val1_len = len ( val1 ) <EOL> val = '<STR_LIT>' <EOL> if letter == '<STR_LIT:U+002C>' : <EOL> if val1 is not None : <EOL> result . append ( val1 . zfill ( val1_len ) ) <EOL> else : <EOL> in_range = True <EOL> else : <EOL> val += letter <EOL> return result <EOL> def expand_item ( item ) : <EOL> result = [ ] <EOL> in_block = False <EOL> pre_block = '<STR_LIT>' <EOL> for count in range ( <NUM_LIT:0> , len ( item ) ) : <EOL> letter = item [ count ] <EOL> if letter == '<STR_LIT:[>' : <EOL> in_block = True <EOL> block = '<STR_LIT>' <EOL> elif letter == '<STR_LIT:]>' and in_block : <EOL> in_block = False <EOL> for value in block_to_list ( block ) : <EOL> result . append ( '<STR_LIT>' % ( pre_block , value , item [ count + <NUM_LIT:1> : ] ) ) <EOL> elif in_block : <EOL> block += letter <EOL> elif not in_block : <EOL> pre_block += letter <EOL> if len ( result ) : <EOL> return result <EOL> else : <EOL> return [ item ] </s>
