argument_types.py 文件源码

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

项目:bay 作者: eventbrite 项目源码 文件源码
def convert(self, value, param, ctx):
        self.context = ctx

        # Exact match
        if value in self.choices:
            return value

        # Match through normalization
        if ctx is not None and \
           ctx.token_normalize_func is not None:
            value = ctx.token_normalize_func(value)
            for choice in self.choices:
                if ctx.token_normalize_func(choice) == value:
                    return choice

        self.fail('invalid choice: %s. %s' % (PURPLE(value), self.get_missing_message(param, value)), param, ctx)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号