validation.py 文件源码

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

项目:Main 作者: N-BodyPhysicsSimulator 项目源码 文件源码
def int_greater_than_zero(time: int) -> int:
    """
    >>> int_greater_than_zero(1)
    1

    >>> int_greater_than_zero(0)
    Traceback (most recent call last):
    argparse.ArgumentTypeError: Value should be greater than 0.

    >>> int_greater_than_zero(-10)
    Traceback (most recent call last):
    argparse.ArgumentTypeError: Value should be greater than 0.
    """
    time = int(time)

    if time <= 0:
        raise ArgumentTypeError('Value should be greater than 0.')

    return time
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号