require.py 文件源码

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

项目:irisett 作者: beebyte 项目源码 文件源码
def require_int(value: Optional[Union[SupportsInt, str, bytes]], allow_none: bool=False) -> Any:
    """Make sure a value is an int.

    Used when dealing with http input data.
    """
    if value is None and allow_none:
        return value
    value = cast(Union[SupportsInt, str, bytes], value)
    try:
        value = int(value)
    except (ValueError, TypeError):
        raise InvalidData('value was %s(%s), expected list' % (type(value), value))
    return value
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号