#NEWLINE# @ staticmethod #NEWLINE# def parse_item( args , cluster , jobs , parsing_service = '' , current_job = '' , host_id = 0 , instance_id = ( - 1 ) , item = None ) : #NEWLINE# #INDENT# "\n    Parse item which is enclosed by '%{}' in key/value\n    " #NEWLINE# reg_expr = VARIABLE_REGEX . findall ( item ) #NEWLINE# new_item = [ ] #NEWLINE# for iter in range ( len ( iter ) ) : #NEWLINE# #INDENT# for ( key , callback ) in SCHEMA_MAP . iteritems ( ) : #NEWLINE# #INDENT# if ( reg_expr [ iter ] == key ) : #NEWLINE# #INDENT# new_item . append ( callback ( args , cluster , jobs , current_job , host_id ) ) #NEWLINE# break #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( type ( key ) == type ( VARIABLE_REGEX ) ) and key . match ( reg_expr [ iter ] ) ) : #NEWLINE# #INDENT# new_item . append ( callback ( args , cluster , jobs , parsing_service , current_job , host_id , instance_id , reg_expr [ iter ] ) ) #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# for iter in range ( len ( new_item ) ) : #NEWLINE# #INDENT# item = item . replace ( ( ( '%{' + reg_expr [ iter ] ) + '}' ) , str ( new_item [ iter ] ) ) #NEWLINE# #UNINDENT# return item