• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript async-utils.callback_opts函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中smc-util/async-utils.callback_opts函数的典型用法代码示例。如果您正苦于以下问题:TypeScript callback_opts函数的具体用法?TypeScript callback_opts怎么用?TypeScript callback_opts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了callback_opts函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: raw_server_port

async function raw_server_port(
  project_id: string,
  compute_server: any
): Promise<string> {
  const project = await callback_opts(compute_server.project)({ project_id });
  const status = await callback_opts(project.status)();
  if (status["raw.port"]) {
    return status["raw.port"];
  } else {
    throw Error("no raw server listening");
  }
}
开发者ID:DrXyzzy,项目名称:smc,代码行数:12,代码来源:hub-http-server.ts


示例2: tidy

async function tidy(input_path) {
  const args = [
    "-modify",
    "-xml",
    "--indent",
    "yes",
    "--vertical-space",
    "yes",
    "--indent-spaces",
    "2", // tune that if we let users ever choose the indentation
    "--wrap",
    "80",
    "--sort-attributes",
    "alpha",
    "--quiet",
    "yes",
    "--write-back",
    "yes",
    "--show-warnings",
    "no", // enable it, if we want to show warnings upon exit code == 1
    "--tidy-mark",
    "no",
    input_path
  ];

  return await callback_opts(execute_code)({
    command: "tidy",
    args: args,
    err_on_exit: false,
    bash: false,
    timeout: 15
  });
}
开发者ID:DrXyzzy,项目名称:smc,代码行数:33,代码来源:xml-format.ts


示例3: biber

async function biber(input_path, output_path) {
  const args = [
    "--tool",
    "--output-align",
    "--output-indent=2",
    "--output-fieldcase=lower",
    "--output-file",
    output_path,
    input_path
  ];

  return await callback_opts(execute_code)({
    command: "biber",
    args: args,
    err_on_exit: false,
    bash: false,
    timeout: 20
  });
}
开发者ID:DrXyzzy,项目名称:smc,代码行数:19,代码来源:bib-format.ts


示例4: get_port

async function get_port(
  port_number: string,
  type: string,
  project_id: string,
  compute_server: any,
  database?: any
): Promise<string> {
  if (type === "raw") {
    return await raw_server_port(project_id, compute_server);
  } else if (port_number === "jupyter") {
    return await callback_opts(hub_proxy.jupyter_server_port)({
      project_id,
      compute_server: compute_server,
      database: database
    });
  } else {
    return port_number;
  }
}
开发者ID:DrXyzzy,项目名称:smc,代码行数:19,代码来源:hub-http-server.ts


示例5: nbconvert

export async function nbconvert(opts: nbconvertParams) : Promise<void> {
  if (!opts.timeout) {
    opts.timeout = 30;
  }
  let j: number = 0;
  let to: string = '';
  for (let i = 0; i < opts.args.length; i++) {
    if (opts.args[i] === "--to") {
      j = i;
      to = opts.args[i + 1];
      break;
    }
  }
  let command: string;
  let args: string[];
  if (to === "sagews") {
    // support sagews converter, which is its own script, not in nbconvert.
    // NOTE that if to is set, then j must be set.
    command = "smc-ipynb2sagews";
    args = opts.args.slice(0, j).concat(opts.args.slice(j + 3)); // j+3 cuts out --to and --.
  } else {
    command = "jupyter";
    args = ["nbconvert"].concat(opts.args);
  }
  // Note about bash/ulimit_timeout below.  This is critical since nbconvert
  // could launch things like pdflatex that might run forever and without
  // ulimit they do not get killed properly; this has happened in production!
  const output = await callback_opts(execute_code)({
    command,
    args,
    path: opts.directory,
    err_on_exit: false,
    timeout: opts.timeout, // in seconds
    ulimit_timeout: true,
    bash: true
  });
  if(output.exit_code != 0) {
    throw Error(output.stderr);
  }
}
开发者ID:DrXyzzy,项目名称:smc,代码行数:40,代码来源:nbconvert.ts


示例6: wait_until_store

 async wait_until_store(until: Function): Promise<void> {
   await callback_opts(this.store.wait)({
     until: until
   });
 }
开发者ID:DrXyzzy,项目名称:smc,代码行数:5,代码来源:util.ts


示例7: wait_until_loaded

 async wait_until_loaded(): Promise<void> {
   await callback_opts(this.data.redux.editor.store.wait)({
     until: s => s.get("is_loaded")
   });
 }
开发者ID:DrXyzzy,项目名称:smc,代码行数:5,代码来源:util.ts


示例8: exec

async function exec(opts: any): Promise<ExecuteOutput> {
  return await callback_opts(execute_code)(opts);
}
开发者ID:DrXyzzy,项目名称:smc,代码行数:3,代码来源:api.ts



注:本文中的smc-util/async-utils.callback_opts函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript misc2.path_split函数代码示例发布时间:2022-05-25
下一篇:
TypeScript async-utils.callback2函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap