<s> """<STR_LIT>""" <EOL> from os import mkdir <EOL> from os . path import exists , dirname , join <EOL> import jinja2 <EOL> from entity_test import get_entity_mm <EOL> def main ( debug = False ) : <EOL> this_folder = dirname ( __file__ ) <EOL> entity_mm = get_entity_mm ( debug ) <EOL> person_model = entity_mm . model_from_file ( join ( this_folder , '<STR_LIT>' ) ) <EOL> def javatype ( s ) : <EOL> """<STR_LIT>""" <EOL> return { <EOL> '<STR_LIT>' : '<STR_LIT:int>' , <EOL> '<STR_LIT:string>' : '<STR_LIT>' <EOL> } . get ( s . name , s . name ) <EOL> srcgen_folder = join ( this_folder , '<STR_LIT>' ) <EOL> if not exists ( srcgen_folder ) : <EOL> mkdir ( srcgen_folder ) <EOL> jinja_env = jinja2 . Environment ( <EOL> loader = jinja2 . FileSystemLoader ( this_folder ) ) <EOL> jinja_env . filters [ '<STR_LIT>' ] = javatype <EOL> template = jinja_env . get_template ( '<STR_LIT>' ) <EOL> for entity in person_model . entities : <EOL> with open ( join ( srcgen_folder , <EOL> "<STR_LIT>" % entity . name . capitalize ( ) ) , '<STR_LIT:w>' ) as f : <EOL> f . write ( template . render ( entity = entity ) ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
