<s> import string <EOL> import random <EOL> from Misc import misc <EOL> install_base = misc . base_install_path ( ) <EOL> def create_project_file ( all_parameters , path ) : <EOL> """<STR_LIT>""" <EOL> qpf_template = string . Template ( <EOL> """<STR_LIT>""" ) <EOL> qpf = qpf_template . substitute ( all_parameters ) <EOL> project_name = all_parameters [ "<STR_LIT>" ] <EOL> misc . write_file ( path , project_name + "<STR_LIT>" , qpf ) <EOL> def random_20bit_hex ( ) : <EOL> rnd = random . getrandbits ( <NUM_LIT:20> ) <EOL> return hex ( rnd ) [ <NUM_LIT:2> : - <NUM_LIT:1> ] <EOL> def random_color ( ) : <EOL> return abs ( int ( random . getrandbits ( <NUM_LIT> ) ) ) <EOL> def create_Scalar_partition ( all_parameters ) : <EOL> color = random_color ( ) <EOL> partition_id = random_20bit_hex ( ) <EOL> dp_template = string . Template ( <EOL> """<STR_LIT>""" ) <EOL> all_parameters . update ( { "<STR_LIT>" : color , <EOL> "<STR_LIT>" : partition_id } ) <EOL> dp = dp_template . substitute ( all_parameters ) <EOL> return dp <EOL> def create_settings_file ( all_parameters , path , install_base = install_base ) : <EOL> """<STR_LIT>""" <EOL> qsf_template = string . Template ( <EOL> """<STR_LIT>""" ) <EOL> all_parameters [ "<STR_LIT>" ] = install_base <EOL> if all_parameters [ "<STR_LIT>" ] == True : <EOL> scalar_module_partition = create_Scalar_partition ( all_parameters ) <EOL> else : <EOL> scalar_module_partition = "<STR_LIT>" <EOL> all_parameters . update ( { "<STR_LIT>" : scalar_module_partition } ) <EOL> qsf = qsf_template . substitute ( all_parameters ) <EOL> project_name = all_parameters [ "<STR_LIT>" ] <EOL> misc . write_file ( path , project_name + "<STR_LIT>" , qsf ) <EOL> def project ( all_parameters , path ) : <EOL> create_project_file ( all_parameters , path ) <EOL> create_settings_file ( all_parameters , path ) </s>
