def QueryFunction(ctx, funcid, cfg): cfg_dict = json.loads(cfg.read()) client = Client(cfg_dict['token'], cfg_dict['url']) result = query_function(client, funcid) result.pop("sourceCode") result = json.dumps(result, sort_keys=True, indent=2) click.echo(result)
def QueryFuncSet(ctx, funcset, cfg): cfg_dict = json.loads(cfg.read()) client = Client(cfg_dict['token'], cfg_dict['url']) result = json.dumps(query_function_set(client, funcset), sort_keys=True, indent=2) click.echo(result)
def cli(ctx, url, token, help, version): if ctx.invoked_subcommand is None or help: if version: import binaryai click.echo(binaryai.__version__) ctx.exit() else: banner = ''' ____ _ _ ___ | __ )(_)_ __ __ _ _ __ _ _ / \ |_ _| | _ \| | '_ \ / _` | '__| | | | / _ \ | | | |_) | | | | | (_| | | | |_| |/ ___ \ | | |____/|_|_| |_|\__,_|_| \__, /_/ \_\___| |___/ ''' click.echo(banner) click.echo(ctx.get_help()) ctx.exit() client = Client(token, url) ctx.obj = client
def client(request): from binaryai.client import Client url = request.config.getoption("--url") token = request.config.getoption("--token") return Client(url=url, token=token)
def CreateFuncSet(ctx, cfg): cfg_dict = json.loads(cfg.read()) client = Client(cfg_dict['token'], cfg_dict['url']) result = create_function_set(client) click.echo({"funcsetid": result})
def CreateFuncSet(ctx, cfg, name, description): cfg_dict = json.loads(cfg.read()) client = Client(cfg_dict['token'], cfg_dict['url']) result = create_function_set(client, name, description) click.echo(json.dumps({"funcsetid": result}))