(**kwargs)
\b
    - DESCRIPTION:
        Flow CLI Init Command. Custom can choose to provide an absolute path of server conf file,
        or provide ip address and http port of a valid fate flow server. Notice that, if custom
        provides both, the server conf would be loaded in priority. In this case, ip address and
        http port would be ignored.

    \b
    - USAGE:
        flow init -c /data/projects/fate/python/conf/service_conf.yaml
        flow init --ip 127.0.0.1 --port 9380
\b
    - DESCRIPTION:
        Flow CLI Init Command. Custom can choose to provide an absolute path of server conf file,
        or provide ip address and http port of a valid fate flow server. Notice that, if custom
        provides both, the server conf would be loaded in priority. In this case, ip address and
        http port would be ignored.
\ b - DESCRIPTION : Flow CLI Init Command . Custom can choose to provide an absolute path of server conf file or provide ip address and http port of a valid fate flow server . Notice that if custom provides both the server conf would be loaded in priority . In this case ip address and http port would be ignored .
def initialization(**kwargs):
    """
    \b
    - DESCRIPTION:
        Flow CLI Init Command. Custom can choose to provide an absolute path of server conf file,
        or provide ip address and http port of a valid fate flow server. Notice that, if custom
        provides both, the server conf would be loaded in priority. In this case, ip address and
        http port would be ignored.

    \b
    - USAGE:
        flow init -c /data/projects/fate/python/conf/service_conf.yaml
        flow init --ip 127.0.0.1 --port 9380
    """
    with open(os.path.join(os.path.dirname(__file__), "settings.yaml"), "r") as fin:
        config = yaml.safe_load(fin)

    if kwargs.get('reset'):
        config['api_version'] = 'v1'
        for i in ('server_conf_path', 'ip', 'port', 'app_key', 'secret_key'):
            config[i] = None

        with open(os.path.join(os.path.dirname(__file__), "settings.yaml"), "w") as fout:
            yaml.dump(config, fout, Dumper=yaml.RoundTripDumper)
        prettify(
            {
                "retcode": 0,
                "retmsg": "Fate Flow CLI has been reset successfully. "
                          "Please do initialization again before you using flow CLI v2."
            }
        )
    else:
        config['api_version'] = 'v1'
        if kwargs.get("server_conf_path"):
            config["server_conf_path"] = os.path.abspath(kwargs["server_conf_path"])
        for i in ('ip', 'port', 'app_key', 'secret_key'):
            if kwargs.get(i):
                config[i] = kwargs[i]

        if config.get("server_conf_path") or (config.get("ip") and config.get("port")):
            with open(os.path.join(os.path.dirname(__file__), "settings.yaml"), "w") as fout:
                yaml.dump(config, fout, Dumper=yaml.RoundTripDumper)
            prettify(
                {
                    "retcode": 0,
                    "retmsg": "Fate Flow CLI has been initialized successfully."
                }
            )
        else:
            prettify(
                {
                    "retcode": 100,
                    "retmsg": "Fate Flow CLI initialization failed. Please provides server configuration file path "
                              "or server http ip address and port information."
                }
            )
def initialization ( * * kwargs ) : with open ( os . path . join ( os . path . dirname ( __file__ ) , "settings.yaml" ) , "r" ) as fin : config = yaml . safe_load ( fin ) if kwargs . get ( 'reset' ) : config [ 'api_version' ] = 'v1' for i in ( 'server_conf_path' , 'ip' , 'port' , 'app_key' , 'secret_key' ) : config [ i ] = None with open ( os . path . join ( os . path . dirname ( __file__ ) , "settings.yaml" ) , "w" ) as fout : yaml . dump ( config , fout , Dumper = yaml . RoundTripDumper ) prettify ( { "retcode" : 0 , "retmsg" : "Fate Flow CLI has been reset successfully. " "Please do initialization again before you using flow CLI v2." } ) else : config [ 'api_version' ] = 'v1' if kwargs . get ( "server_conf_path" ) : config [ "server_conf_path" ] = os . path . abspath ( kwargs [ "server_conf_path" ] ) for i in ( 'ip' , 'port' , 'app_key' , 'secret_key' ) : if kwargs . get ( i ) : config [ i ] = kwargs [ i ] if config . get ( "server_conf_path" ) or ( config . get ( "ip" ) and config . get ( "port" ) ) : with open ( os . path . join ( os . path . dirname ( __file__ ) , "settings.yaml" ) , "w" ) as fout : yaml . dump ( config , fout , Dumper = yaml . RoundTripDumper ) prettify ( { "retcode" : 0 , "retmsg" : "Fate Flow CLI has been initialized successfully." } ) else : prettify ( { "retcode" : 100 , "retmsg" : "Fate Flow CLI initialization failed. Please provides server configuration file path " "or server http ip address and port information." } )