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
评论列表
文章目录