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


Python click.INT属性代码示例

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


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

示例1: pagination_options

# 需要导入模块: import click [as 别名]
# 或者: from click import INT [as 别名]
def pagination_options(sort_fields, default_sort):
    """Shared pagination options."""

    def _pagination_options(f):
        f = click.option('--limit', metavar='LIMIT', type=click.INT,
                         help='Maximum number of items to show.')(f)
        f = click.option('--page', metavar='PAGE', type=click.INT,
                         help='Page to retrieve items from. This is '
                         'influenced by the size of LIMIT.')(f)
        f = click.option('--sort', metavar='FIELD', default=default_sort,
                         type=click.Choice(sort_fields),
                         help='Sort output on given field.')(f)

        return f

    return _pagination_options 
开发者ID:getpatchwork,项目名称:git-pw,代码行数:18,代码来源:utils.py

示例2: fossor_cli_flags

# 需要导入模块: import click [as 别名]
# 或者: from click import INT [as 别名]
def fossor_cli_flags(f):
    '''Add default Fossor CLI flags'''
    # Flags will appear in reverse order of how they  are listed here:
    f = add_dynamic_args(f)  # Must be applied after all other click options since this requires click's context object to be passed

    # Add normal flags
    csv_list = CsvList()
    f = click.option('--black-list', 'blacklist', type=csv_list, help='Do not run these plugins.')(f)
    f = click.option('--white-list', 'whitelist', type=csv_list, help='Only run these plugins.')(f)
    f = click.option('--truncate/--no-truncate', 'truncate', show_default=True, default=True, is_flag=True)(f)
    f = click.option('-v', '--verbose', is_flag=True)(f)
    f = click.option('-d', '--debug', is_flag=True, callback=setup_logging)(f)
    f = click.option('-t', '--time-out', 'timeout', show_default=True, default=600, help='Default timeout for plugins.')(f)
    f = click.option('--end-time', callback=set_end_time, help='Plugins may optionally implement and use this. Defaults to now.')(f)
    f = click.option('--start-time', callback=set_start_time, help='Plugins may optionally implement and use this.')(f)
    f = click.option('-r', '--report', type=click.STRING, show_default=True, default='StdOut', help='Report Plugin to run.')(f)
    f = click.option('--hours', type=click.INT, default=24, show_default=True, callback=set_relative_start_time,
                     help='Sets start-time to X hours ago. Plugins may optionally implement and use this.')(f)
    f = click.option('--plugin-dir', default=default_plugin_dir, show_default=True, help=f'Import all plugins from this directory.')(f)
    f = click.option('-p', '--pid', type=click.INT, help='Pid to investigate.')(f)

    # Required for parsing dynamics arguments
    f = click.pass_context(f)
    f = click.command(context_settings=dict(ignore_unknown_options=True, allow_extra_args=True, help_option_names=['-h', '--help']))(f)
    return f 
开发者ID:linkedin,项目名称:fossor,代码行数:27,代码来源:cli.py

示例3: common_options

# 需要导入模块: import click [as 别名]
# 或者: from click import INT [as 别名]
def common_options(func: Callable) -> Callable:
    """A decorator that combines commonly appearing @click.option decorators."""

    @click.option(
        "--private-key", required=True, help="Path to a private key store.", type=click.STRING
    )
    @click.option("--password", help="password file for the keystore json file", type=click.STRING)
    @click.option(
        "--rpc-url",
        default="http://127.0.0.1:8545",
        help="Address of the Ethereum RPC provider",
        type=click.STRING,
    )
    @click.option(
        "--token-address", required=True, help="Address of the token contract", type=click.STRING
    )
    @click.option(
        "--amount", required=True, help="Amount to mint/deposit/transfer", type=click.INT
    )
    @click.option("--wait", default=300, help="Max tx wait time in s.", type=click.INT)
    @functools.wraps(func)
    def wrapper(*args: List, **kwargs: Dict) -> Any:
        return func(*args, **kwargs)

    return wrapper 
开发者ID:raiden-network,项目名称:raiden-contracts,代码行数:27,代码来源:token_ops.py

示例4: tokens2counts

# 需要导入模块: import click [as 别名]
# 或者: from click import INT [as 别名]
def tokens2counts(sep, limit, tokens):
    '''Count unique tokens in a list of tokens.
    Tokens are sorted by top counts.'''
    content = read_tokens(tokens)
    counts = sort_counts(get_counts(content))

    # we want the argument type to be an INT - but python only
    # has support for a float infinity. So if it the limit is negative,
    # it becomes infinite
    if limit < 0:
        limit = float('inf')

    # using csv writer to ensure proper encoding of the seperator.
    rows = [list(map(str, vals)) for ind, vals in enumerate(counts) if ind < limit]
    write_csv(rows, str(sep)) 
开发者ID:learntextvis,项目名称:textkit,代码行数:17,代码来源:tokens_to_counts.py

示例5: vm_memory_mb_option

# 需要导入模块: import click [as 别名]
# 或者: from click import INT [as 别名]
def vm_memory_mb_option(command: Callable[..., None]) -> Callable[..., None]:
    """
    An option decorator for the amount of memory given to each VM.
    """
    backend = Vagrant()
    function = click.option(
        '--vm-memory-mb',
        type=click.INT,
        default=backend.vm_memory_mb,
        show_default=True,
        help='The amount of memory to give each VM.',
    )(command)  # type: Callable[..., None]
    return function 
开发者ID:dcos,项目名称:dcos-e2e,代码行数:15,代码来源:_options.py

示例6: masters_option

# 需要导入模块: import click [as 别名]
# 或者: from click import INT [as 别名]
def masters_option(command: Callable[..., None]) -> Callable[..., None]:
    """
    An option decorator for the number of masters.
    """
    function = click.option(
        '--masters',
        type=click.INT,
        default=1,
        show_default=True,
        help='The number of master nodes.',
    )(command)  # type: Callable[..., None]
    return function 
开发者ID:dcos,项目名称:dcos-e2e,代码行数:14,代码来源:cluster_size.py

示例7: agents_option

# 需要导入模块: import click [as 别名]
# 或者: from click import INT [as 别名]
def agents_option(command: Callable[..., None]) -> Callable[..., None]:
    """
    An option decorator for the number of agents.
    """
    function = click.option(
        '--agents',
        type=click.INT,
        default=1,
        show_default=True,
        help='The number of agent nodes.',
    )(command)  # type: Callable[..., None]
    return function 
开发者ID:dcos,项目名称:dcos-e2e,代码行数:14,代码来源:cluster_size.py

示例8: public_agents_option

# 需要导入模块: import click [as 别名]
# 或者: from click import INT [as 别名]
def public_agents_option(command: Callable[..., None]) -> Callable[..., None]:
    """
    An option decorator for the number of agents.
    """
    function = click.option(
        '--public-agents',
        type=click.INT,
        default=1,
        show_default=True,
        help='The number of public agent nodes.',
    )(command)  # type: Callable[..., None]
    return function 
开发者ID:dcos,项目名称:dcos-e2e,代码行数:14,代码来源:cluster_size.py

示例9: _check_type

# 需要导入模块: import click [as 别名]
# 或者: from click import INT [as 别名]
def _check_type(self, val):
        # it is easy to introduce a deploy-time function that that accidentally
        # returns a value whose type is not compatible with what is defined
        # in Parameter. Let's catch those mistakes early here, instead of
        # showing a cryptic stack trace later.

        # note: this doesn't work with long in Python2 or types defined as
        # click types, e.g. click.INT
        TYPES = {bool: 'bool',
                 int: 'int',
                 float: 'float',
                 list: 'list'}

        msg = "The value returned by the deploy-time function for "\
              "the parameter *%s* field *%s* has a wrong type. " %\
              (self.parameter_name, self.field)

        if self.parameter_type in TYPES:
            if type(val) != self.parameter_type:
                msg += 'Expected a %s.' % TYPES[self.parameter_type]
                raise ParameterFieldTypeMismatch(msg)
            return str(val) if self.return_str else val
        else:
            if not is_stringish(val):
                msg += 'Expected a string.'
                raise ParameterFieldTypeMismatch(msg)
            return val 
开发者ID:Netflix,项目名称:metaflow,代码行数:29,代码来源:parameters.py

示例10: add_yatai_service_sub_command

# 需要导入模块: import click [as 别名]
# 或者: from click import INT [as 别名]
def add_yatai_service_sub_command(cli):
    # pylint: disable=unused-variable

    @cli.command(help='Start BentoML YataiService for model management and deployment')
    @click.option(
        '--db-url',
        type=click.STRING,
        help='Database URL following RFC-1738, and usually can include username, '
        'password, hostname, database name as well as optional keyword arguments '
        'for additional configuration',
        envvar='BENTOML_DB_URL',
    )
    @click.option(
        '--repo-base-url',
        type=click.STRING,
        help='Base URL for storing BentoML saved bundle files, this can be a filesystem'
        'path(POSIX/Windows), or a S3 URL, usually starting with "s3://"',
        envvar='BENTOML_REPO_BASE_URL',
    )
    @click.option(
        '--grpc-port',
        type=click.INT,
        default=50051,
        help='Port to run YataiService gRPC server',
        envvar='BENTOML_GRPC_PORT',
    )
    @click.option(
        '--ui-port',
        type=click.INT,
        default=3000,
        help='Port to run YataiService Web UI server',
        envvar='BENTOML_WEB_UI_PORT',
    )
    @click.option(
        '--ui/--no-ui',
        default=True,
        help='Run YataiService with or without Web UI, when running with --no-ui, it '
        'will only run the gRPC server',
        envvar='BENTOML_ENABLE_WEB_UI',
    )
    @click.option(
        '--s3-endpoint-url',
        type=click.STRING,
        help='S3 Endpoint URL is used for deploying with storage services that are '
        'compatible with Amazon S3, such as MinIO',
        envvar='BENTOML_S3_ENDPOINT_URL',
    )
    def yatai_service_start(
        db_url, repo_base_url, grpc_port, ui_port, ui, s3_endpoint_url
    ):
        start_yatai_service_grpc_server(
            db_url, repo_base_url, grpc_port, ui_port, ui, s3_endpoint_url
        ) 
开发者ID:bentoml,项目名称:BentoML,代码行数:55,代码来源:yatai_service.py


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