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


Python click.clear方法代码示例

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


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

示例1: resources

# 需要导入模块: import click [as 别名]
# 或者: from click import clear [as 别名]
def resources(cls, jobs_resources):
        jobs_resources = to_list(jobs_resources)
        click.clear()
        data = [["Job", "Mem Usage / Total", "CPU% - CPUs"]]
        for job_resources in jobs_resources:
            job_resources = ContainerResourcesConfig.from_dict(job_resources)
            line = [
                job_resources.job_name,
                "{} / {}".format(
                    to_unit_memory(job_resources.memory_used),
                    to_unit_memory(job_resources.memory_limit),
                ),
                "{} - {}".format(
                    to_percentage(job_resources.cpu_percentage / 100),
                    job_resources.n_cpus,
                ),
            ]
            data.append(line)
        click.echo(tabulate(data, headers="firstrow"))
        sys.stdout.flush() 
开发者ID:polyaxon,项目名称:polyaxon,代码行数:22,代码来源:formatting.py

示例2: search

# 需要导入模块: import click [as 别名]
# 或者: from click import clear [as 别名]
def search(ctx, query, num, safe, filetype, imagetype,
           imagesize, dominantcolor, download_path, width, height):

    search_params = {
        'q': query,
        'num': num,
        'safe': safe,
        'fileType': filetype,
        'imgType': imagetype,
        'imgSize': imagesize,
        'imgDominantColor': dominantcolor
    }

    click.clear()

    try:
        ctx.obj['object'].search(search_params, download_path, width, height)

        for image in ctx.obj['object'].results():
            click.echo(image.url)
            if image.path:
                click.secho(image.path, fg='blue')
                if not image.resized:
                    click.secho('[image is not resized]', fg='red')
            else:
                click.secho('[image is not download]', fg='red')
            click.echo()

    except GoogleBackendException:
        click.secho('Error occurred trying to fetch '
                    'images from Google. Please try again.', fg='red')
        return 
开发者ID:arrrlo,项目名称:Google-Images-Search,代码行数:34,代码来源:cli.py

示例3: traverse_json

# 需要导入模块: import click [as 别名]
# 或者: from click import clear [as 别名]
def traverse_json(data, previous=''):
    click.clear()
    keys = list(data.keys())
    click.echo(create_table(keys, previous))
    val = click.prompt("Select Option", type = int, default = 1) - 1
    
    if type(data[keys[val]]) == dict:
        traverse_json(data[keys[val]], keys[val])
    else:
        click.echo(f"Current value: {data[keys[val]]}")
        newVal = click.prompt(f"Input new value for {keys[val]}", type = str)

        #Normal strings cause an error
        try:
            newVal = eval(newVal)
        except (SyntaxError, NameError) as e:
            pass
        
        if type(newVal) != type(data[keys[val]]):
            choice = click.confirm(f"{newVal} appears to be of an incorrect type. Continue")

            if not choice:
                exit()
            elif data[keys[val]] is not None:
                try:
                    newVal = type(data[keys[val]])(newVal)
                except TypeError:
                    click.echo(f"'{newVal}' could not be converted to the correct type")
                    exit()

        data[keys[val]] = newVal 
开发者ID:vn-ki,项目名称:anime-downloader,代码行数:33,代码来源:config.py

示例4: get_ansible_ssh_user

# 需要导入模块: import click [as 别名]
# 或者: from click import clear [as 别名]
def get_ansible_ssh_user():
    click.clear()
    message = """
This installation process involves connecting to remote hosts via ssh. Any
account may be used. However, if a non-root account is used, then it must have
passwordless sudo access.
"""
    click.echo(message)
    return click.prompt('User for ssh access', default='root') 
开发者ID:openshift,项目名称:origin-ci-tool,代码行数:11,代码来源:cli_installer.py

示例5: get_routingconfig_subdomain

# 需要导入模块: import click [as 别名]
# 或者: from click import clear [as 别名]
def get_routingconfig_subdomain():
    click.clear()
    message = """
You might want to override the default subdomain used for exposed routes. If you don't know what this is, use the default value.
"""
    click.echo(message)
    return click.prompt('New default subdomain (ENTER for none)', default='') 
开发者ID:openshift,项目名称:origin-ci-tool,代码行数:9,代码来源:cli_installer.py

示例6: collect_new_nodes

# 需要导入模块: import click [as 别名]
# 或者: from click import clear [as 别名]
def collect_new_nodes(oo_cfg):
    click.clear()
    click.echo('*** New Node Configuration ***')
    message = """
Add new nodes here
    """
    click.echo(message)
    new_nodes, _ = collect_hosts(oo_cfg, existing_env=True, masters_set=True, print_summary=False)
    return new_nodes 
开发者ID:openshift,项目名称:origin-ci-tool,代码行数:11,代码来源:cli_installer.py

示例7: initialise

# 需要导入模块: import click [as 别名]
# 或者: from click import clear [as 别名]
def initialise():
    click.clear()
    click.secho("Enter the User access token", fg="green", bold=True)
    token = input()
    click.secho(
        "Enter the no of result pages for your input.\nBy default it is set to 5.",
        fg="green",
        bold=True)
    try:
        val = int(input())
        npa = val
    except ValueError:
        npa = 5
    click.secho(
        "Enter the no of posts in the output page.\nBy default it is set to 5.",
        fg="green",
        bold=True)
    try:
        val = int(input())
        npo = val
    except ValueError:
        npo = 5
    click.clear()
    click.secho("Data initialised succesfully", fg="green", bold=True)
    with open("userdata.json", "w") as outfile:
        data = {'token': token, 'npa': npa, 'npo': npo}
        json.dump(data, outfile)

# shows the data stored in userdata.json file 
开发者ID:Parth-Vader,项目名称:FB-Spider,代码行数:31,代码来源:graph.py

示例8: monitor

# 需要导入模块: import click [as 别名]
# 或者: from click import clear [as 别名]
def monitor(app):
    """Set up application monitoring."""
    heroku_app = HerokuApp(dallinger_uid=app)
    webbrowser.open(heroku_app.dashboard_url)
    webbrowser.open("https://requester.mturk.com/mturk/manageHITs")
    heroku_app.open_logs()
    check_call(["open", heroku_app.db_uri])
    while _keep_running():
        summary = get_summary(app)
        click.clear()
        click.echo(header)
        click.echo("\nExperiment {}\n".format(app))
        click.echo(summary)
        time.sleep(10) 
开发者ID:Dallinger,项目名称:Dallinger,代码行数:16,代码来源:command_line.py

示例9: clear

# 需要导入模块: import click [as 别名]
# 或者: from click import clear [as 别名]
def clear(ctx):
    '''
        Clears request, response and error fields.
    '''
    ctx.obj['manager'].rpcs[ctx.obj['RPC_TYPE']][ctx.obj['RPC_NAME']].clear() 
开发者ID:nokia,项目名称:SROS-grpc-services,代码行数:7,代码来源:grpc_shell.py

示例10: details

# 需要导入模块: import click [as 别名]
# 或者: from click import clear [as 别名]
def details(name):
    """
    Get details of a domain
    """
    _display_domain_details(details_domain(name), clear=False) 
开发者ID:fandoghpaas,项目名称:fandogh-cli,代码行数:7,代码来源:domain_commands.py

示例11: _display_domain_details

# 需要导入模块: import click [as 别名]
# 或者: from click import clear [as 别名]
def _display_domain_details(domain_details, clear=True):
    if clear:
        click.clear()
    click.echo('Domain: {}'.format(format_text(domain_details['name'], TextStyle.HEADER)))
    if domain_details['verified'] is True:
        click.echo('\tVerified: {}'.format(format_text("Yes", TextStyle.OKGREEN)))
    else:
        click.echo('\tVerified: {}'.format(format_text("Yes", TextStyle.FAIL)))
    if domain_details.get('certificate', None) is None:
        click.echo("\tCertificate: {}".format(format_text("Not requested", TextStyle.OKBLUE)))
    else:
        certificate_details = domain_details['certificate'].get('details')
        status = certificate_details['status']
        if status == 'PENDING':
            click.echo("\tCertificate: {}".format(format_text('Trying to get a certificate', TextStyle.OKBLUE)))
        elif status == 'ERROR':
            click.echo("\tCertificate: {}".format(format_text('Getting certificate failed', TextStyle.FAIL)))
        elif status == 'READY':
            click.echo("\tCertificate: {}".format(format_text('Certificate is ready to use', TextStyle.OKGREEN)))
        else:
            click.echo('\tCertificate: {}'.format(format_text('Certificate status is unknown', TextStyle.WARNING)))

        info = certificate_details.get("info", False)
        if info:
            click.echo('\tInfo: {}'.format(format_text(info, TextStyle.WARNING)))
        if len(certificate_details.get('events', [])) > 0:
            click.echo("\tEvents:")
            for condition in certificate_details.get("events", []):
                click.echo("\t + {}".format(condition)) 
开发者ID:fandoghpaas,项目名称:fandogh-cli,代码行数:31,代码来源:domain_commands.py

示例12: resources

# 需要导入模块: import click [as 别名]
# 或者: from click import clear [as 别名]
def resources(cls, jobs_resources):
        jobs_resources = to_list(jobs_resources)
        click.clear()
        data = [['Job', 'Mem Usage / Total', 'CPU% - CPUs']]
        for job_resources in jobs_resources:
            job_resources = ContainerResourcesConfig.from_dict(job_resources)
            line = [
                job_resources.job_name,
                '{} / {}'.format(to_unit_memory(job_resources.memory_used),
                                 to_unit_memory(job_resources.memory_limit)),
                '{} - {}'.format(to_percentage(job_resources.cpu_percentage / 100),
                                 job_resources.n_cpus)]
            data.append(line)
        click.echo(tabulate(data, headers="firstrow"))
        sys.stdout.flush() 
开发者ID:polyaxon,项目名称:polyaxon-cli,代码行数:17,代码来源:formatting.py

示例13: gpu_resources

# 需要导入模块: import click [as 别名]
# 或者: from click import clear [as 别名]
def gpu_resources(cls, jobs_resources):
        jobs_resources = to_list(jobs_resources)
        click.clear()
        data = [
            ['job_name', 'name', 'GPU Usage', 'GPU Mem Usage / Total', 'GPU Temperature',
             'Power Draw / Limit']
        ]
        non_gpu_jobs = 0
        for job_resources in jobs_resources:
            job_resources = ContainerResourcesConfig.from_dict(job_resources)
            line = []
            if not job_resources.gpu_resources:
                non_gpu_jobs += 1
                continue
            for gpu_resources in job_resources.gpu_resources:
                line += [
                    job_resources.job_name,
                    gpu_resources.name,
                    to_percentage(gpu_resources.utilization_gpu / 100),
                    '{} / {}'.format(
                        to_unit_memory(gpu_resources.memory_used),
                        to_unit_memory(gpu_resources.memory_total)),
                    gpu_resources.temperature_gpu,
                    '{} / {}'.format(gpu_resources.power_draw, gpu_resources.power_limit),
                ]
            data.append(line)
        if non_gpu_jobs == len(jobs_resources):
            Printer.print_error(
                'No GPU job was found, please run `resources` command without `-g | --gpu` option.')
            exit(1)
        click.echo(tabulate(data, headers="firstrow"))
        sys.stdout.flush() 
开发者ID:polyaxon,项目名称:polyaxon-cli,代码行数:34,代码来源:formatting.py

示例14: optimize_mode

# 需要导入模块: import click [as 别名]
# 或者: from click import clear [as 别名]
def optimize_mode(start_date: str, finish_date: str):
    # clear the screen
    click.clear()
    print('loading candles...')
    click.clear()

    # load historical candles and divide them into training
    # and testing candles (15% for test, 85% for training)
    training_candles, testing_candles = get_training_and_testing_candles(start_date, finish_date)

    optimizer = Optimizer(training_candles, testing_candles)

    optimizer.run()

    # TODO: store hyper parameters into each strategies folder per each Exchange-symbol-timeframe 
开发者ID:jesse-ai,项目名称:jesse,代码行数:17,代码来源:__init__.py

示例15: clear

# 需要导入模块: import click [as 别名]
# 或者: from click import clear [as 别名]
def clear(self):
        click.clear() 
开发者ID:eliangcs,项目名称:http-prompt,代码行数:4,代码来源:output.py


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