manage.py 文件源码

python
阅读 111 收藏 0 点赞 0 评论 0

项目:streamalert 作者: airbnb 项目源码 文件源码
def _add_default_app_integration_args(app_integration_parser, clusters):
    """Add the default arguments to the app integration parsers"""

    # App integration cluster options
    app_integration_parser.add_argument(
        '--cluster', choices=clusters, required=True, help=ARGPARSE_SUPPRESS)

    # Validate the name being used to make sure it does not contain specific characters
    def _validate_name(val):
        """Validate acceptable inputs for the name of the function"""
        acceptable_chars = ''.join([string.digits, string.letters, '_-'])
        if not set(str(val)).issubset(acceptable_chars):
            raise app_integration_parser.error('Name must contain only letters, numbers, '
                                               'hyphens, or underscores.')

        return val

    # App integration name to be used for this instance that must be unique per cluster
    app_integration_parser.add_argument(
        '--name', dest='app_name', required=True, help=ARGPARSE_SUPPRESS, type=_validate_name)

    # Allow verbose output for the CLI with the --debug option
    app_integration_parser.add_argument('--debug', action='store_true', help=ARGPARSE_SUPPRESS)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号