<s> import platform <EOL> import asyncio <EOL> import json <EOL> from base . logger import LOG <EOL> def singleton ( cls , * args , ** kw ) : <EOL> instances = { } <EOL> def _singleton ( * args , ** kw ) : <EOL> if cls not in instances : <EOL> instances [ cls ] = cls ( * args , ** kw ) <EOL> return instances [ cls ] <EOL> return _singleton <EOL> def func_coroutine ( func ) : <EOL> """<STR_LIT>""" <EOL> def wrapper ( * args , ** kwargs ) : <EOL> LOG . debug ( "<STR_LIT>" ) <EOL> LOG . debug ( "<STR_LIT>" + func . __name__ ) <EOL> APP_EVENT_LOOP = asyncio . get_event_loop ( ) <EOL> APP_EVENT_LOOP . call_soon ( func , * args ) <EOL> LOG . debug ( "<STR_LIT>" ) <EOL> return wrapper <EOL> def write_json_into_file ( data_json , filepath ) : <EOL> try : <EOL> with open ( filepath , "<STR_LIT:w>" ) as f : <EOL> data_str = json . dumps ( data_json , indent = <NUM_LIT:4> ) <EOL> f . write ( data_str ) <EOL> return True <EOL> except Exception as e : <EOL> LOG . error ( str ( e ) ) <EOL> LOG . error ( "<STR_LIT>" ) <EOL> return False <EOL> def judge_system ( ) : <EOL> sys_info = platform . system ( ) <EOL> return sys_info <EOL> def judge_platform ( ) : <EOL> platform_info = platform . platform ( ) <EOL> info = platform_info . split ( '<STR_LIT:->' ) <EOL> return info </s>
