<s> """<STR_LIT>""" <EOL> import logging <EOL> LOG = logging . getLogger ( '<STR_LIT>' ) <EOL> import yaml <EOL> from stdtool import standard_main , standard_json_out <EOL> from asset2json import JsonAsset <EOL> __version__ = '<STR_LIT>' <EOL> __dependencies__ = [ '<STR_LIT>' ] <EOL> def parse ( input_filename = "<STR_LIT>" , output_filename = "<STR_LIT>" , asset_url = "<STR_LIT>" , asset_root = "<STR_LIT:.>" , <EOL> infiles = None , options = None ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> with open ( input_filename , '<STR_LIT:r>' ) as source : <EOL> try : <EOL> materials = yaml . load ( source ) <EOL> except yaml . scanner . ScannerError as e : <EOL> LOG . error ( '<STR_LIT>' , input_filename ) <EOL> LOG . error ( '<STR_LIT>' , e ) <EOL> else : <EOL> json_asset = JsonAsset ( ) <EOL> for mat_name , material in materials . iteritems ( ) : <EOL> effect = material . pop ( '<STR_LIT>' , None ) <EOL> technique = material . pop ( '<STR_LIT>' , None ) <EOL> meta = material . pop ( '<STR_LIT>' , None ) <EOL> json_asset . attach_material ( mat_name , effect , technique , material , meta ) <EOL> standard_json_out ( json_asset , output_filename , options ) <EOL> return json_asset <EOL> except IOError as e : <EOL> LOG . error ( '<STR_LIT>' , output_filename ) <EOL> LOG . error ( '<STR_LIT>' , e ) <EOL> return None <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> try : <EOL> standard_main ( parse , __version__ , <EOL> "<STR_LIT>" , <EOL> __dependencies__ ) <EOL> except Exception as err : <EOL> LOG . critical ( '<STR_LIT>' , err ) <EOL> exit ( <NUM_LIT:1> ) </s>
