当前位置: 首页>>代码示例>>Python>>正文


Python click_completion.init方法代码示例

本文整理汇总了Python中click_completion.init方法的典型用法代码示例。如果您正苦于以下问题:Python click_completion.init方法的具体用法?Python click_completion.init怎么用?Python click_completion.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在click_completion的用法示例。


在下文中一共展示了click_completion.init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: cli

# 需要导入模块: import click_completion [as 别名]
# 或者: from click_completion import init [as 别名]
def cli(ctx, path, external_storage_requested):
    """Check common Renku commands used in various situations."""
    renku_path = Path(path) / RENKU_HOME
    if not renku_path.exists() and not is_allowed_command(ctx):
        raise UsageError((
            '`{0}` is not a renku repository.\n'
            'To initialize this as a renku '
            'repository use: `renku init`'.format(path)
        ))

    ctx.obj = LocalClient(
        path=path,
        external_storage_requested=external_storage_requested,
    )

    if (
        path != os.getcwd() and
        ctx.invoked_subcommand not in WARNING_UNPROTECTED_COMMANDS
    ):
        click.secho(
            WARNING +
            'Run CLI commands only from project\'s root directory.\n',
            err=True
        ) 
开发者ID:SwissDataScienceCenter,项目名称:renku-python,代码行数:26,代码来源:__init__.py

示例2: init

# 需要导入模块: import click_completion [as 别名]
# 或者: from click_completion import init [as 别名]
def init():
    """Initializes the dsl for basic configs and bp directory etc."""
    pass 
开发者ID:nutanix,项目名称:calm-dsl,代码行数:5,代码来源:main.py

示例3: main

# 需要导入模块: import click_completion [as 别名]
# 或者: from click_completion import init [as 别名]
def main(args=None):
    global main_shell
    set_logger()

    click_completion.init()
    ctx = click.Context(grpc_shell)
    try:
        load_config_fc(ctx, sys.argv[1])
    except IndexError:
        load_config_fc(ctx)
    ctx.obj = dict()
    main_shell = make_click_shell(ctx, prompt=default_prompt, intro='Starting grpc shell', hist_file=os.path.join(home,'.grpc_shell.history'))
    if startup_config:
        exec_config_fc(startup_config)
    main_shell.cmdloop() 
开发者ID:nokia,项目名称:SROS-grpc-services,代码行数:17,代码来源:grpc_shell.py

示例4: run_with_conda_env

# 需要导入模块: import click_completion [as 别名]
# 或者: from click_completion import init [as 别名]
def run_with_conda_env(bundle_path, command):
    config = load_saved_bundle_config(bundle_path)
    metadata = config['metadata']
    env_name = metadata['service_name'] + '_' + metadata['service_version']

    yaml = YAML()
    yaml.default_flow_style = False
    tmpf = tempfile.NamedTemporaryFile(delete=False)
    env_path = tmpf.name + '.yaml'
    yaml.dump(config['env']['conda_env'], Path(env_path))

    pip_req = os.path.join(bundle_path, 'requirements.txt')

    subprocess.call(
        'command -v conda >/dev/null 2>&1 || {{ echo >&2 "--with-conda '
        'parameter requires conda but it\'s not installed."; exit 1; }} && '
        'conda env update -n {env_name} -f {env_file} && '
        'conda init bash && '
        'eval "$(conda shell.bash hook)" && '
        'conda activate {env_name} && '
        '{{ [ -f {pip_req} ] && pip install -r {pip_req} || echo "no pip '
        'dependencies."; }} && {cmd}'.format(
            env_name=env_name, env_file=env_path, pip_req=pip_req, cmd=command,
        ),
        shell=True,
    )
    return 
开发者ID:bentoml,项目名称:BentoML,代码行数:29,代码来源:__init__.py


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