<s> import json , uuid , re <EOL> HEADER_COLOR = '<STR_LIT>' <EOL> BLUE_COLOR = '<STR_LIT>' <EOL> GREEN_COLOR = '<STR_LIT>' <EOL> WARNING_COLOR = '<STR_LIT>' <EOL> FAIL_COLOR = '<STR_LIT>' <EOL> END_COLOR = '<STR_LIT>' <EOL> def announcement_print ( msg ) : <EOL> print "<STR_LIT>" + WARNING_COLOR + str ( msg ) + END_COLOR <EOL> return None <EOL> def green_print ( msg ) : <EOL> print "<STR_LIT>" + GREEN_COLOR + str ( msg ) + END_COLOR <EOL> return None <EOL> def red_print ( msg ) : <EOL> print "<STR_LIT>" + FAIL_COLOR + str ( msg ) + END_COLOR <EOL> return None <EOL> def lg ( msg , color_num ) : <EOL> if color_num == <NUM_LIT:4> : <EOL> announcement_print ( msg ) <EOL> elif color_num == <NUM_LIT:5> : <EOL> green_print ( msg ) <EOL> elif color_num == <NUM_LIT:6> : <EOL> print ( msg ) <EOL> else : <EOL> red_print ( msg ) <EOL> return None <EOL> def build_unique_key ( length = - <NUM_LIT:1> ) : <EOL> return str ( str ( uuid . uuid4 ( ) ) . replace ( "<STR_LIT:->" , "<STR_LIT>" ) [ <NUM_LIT:0> : length ] ) <EOL> def pretty_print_json ( json_data ) : <EOL> return str ( json . dumps ( json_data , sort_keys = True , indent = <NUM_LIT:4> , separators = ( '<STR_LIT:U+002C>' , '<STR_LIT>' ) ) ) <EOL> def ppj ( json_data ) : <EOL> return str ( json . dumps ( json_data , sort_keys = True , indent = <NUM_LIT:4> , separators = ( '<STR_LIT:U+002C>' , '<STR_LIT>' ) ) ) <EOL> def log_msg_to_unique_file ( msg , path_to_file = "<STR_LIT>" ) : <EOL> log_file = str ( path_to_file ) + str ( uuid . uuid4 ( ) ) . replace ( "<STR_LIT:->" , "<STR_LIT>" ) + "<STR_LIT>" <EOL> with open ( log_file , "<STR_LIT:w>" ) as output_file : <EOL> output_file . write ( str ( msg ) ) <EOL> return log_file <EOL> def camel_case_string ( name ) : <EOL> output = '<STR_LIT>' . join ( x for x in name . title ( ) if not x . isspace ( ) ) . replace ( "<STR_LIT:_>" , "<STR_LIT>" ) <EOL> return output <EOL> def un_camel_case_string ( name ) : <EOL> s1 = re . sub ( '<STR_LIT>' , r'<STR_LIT>' , name ) <EOL> return re . sub ( '<STR_LIT>' , r'<STR_LIT>' , s1 ) . lower ( ) <EOL> def build_dict ( start_status = "<STR_LIT>" , start_error = "<STR_LIT>" , record = { } ) : <EOL> return { "<STR_LIT>" : str ( start_status ) , "<STR_LIT>" : str ( start_error ) , "<STR_LIT>" : record } </s>
