<s> import os <EOL> import sys <EOL> import yaml <EOL> workdir = os . environ . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> main = '<STR_LIT>' <EOL> images = '<STR_LIT>' <EOL> labels = '<STR_LIT>' <EOL> def merge ( ) : <EOL> conf = yaml . safe_load ( file ( os . path . join ( workdir , main ) , '<STR_LIT:r>' ) ) <EOL> images_conf = yaml . safe_load ( file ( os . path . join ( workdir , images ) , '<STR_LIT:r>' ) ) <EOL> labels_conf = yaml . safe_load ( file ( os . path . join ( workdir , labels ) , '<STR_LIT:r>' ) ) <EOL> for defined_provider in conf [ '<STR_LIT>' ] : <EOL> defined_provider [ '<STR_LIT>' ] = [ ] <EOL> for provider in images_conf : <EOL> for defined_provider in conf [ '<STR_LIT>' ] : <EOL> if provider [ '<STR_LIT>' ] == defined_provider [ '<STR_LIT:name>' ] : <EOL> defined_provider [ '<STR_LIT>' ] = provider [ '<STR_LIT>' ] <EOL> conf [ '<STR_LIT>' ] = labels_conf [ '<STR_LIT>' ] <EOL> return yaml . dump ( conf , default_flow_style = False ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> if len ( sys . argv ) < <NUM_LIT:2> : <EOL> print "<STR_LIT>" <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> else : <EOL> try : <EOL> out = merge ( ) <EOL> except Exception as err : <EOL> print err <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> file ( os . path . join ( workdir , sys . argv [ <NUM_LIT:1> ] ) , '<STR_LIT:w>' ) . write ( out ) </s>
