sleep defaults to one second

This commit is contained in:
Kovid Goyal
2022-11-22 21:54:51 +05:30
parent c0d06adcb5
commit 2b676b63b1
2 changed files with 3 additions and 2 deletions

View File

@@ -296,6 +296,7 @@ def single_integer_arg(func: str, rest: str) -> FuncArgsType:
@func_with_args('sleep')
def sleep(func: str, sleep_time: str) -> FuncArgsType:
mult = 1
sleep_time = sleep_time or '1'
if sleep_time[-1] in 'shmd':
mult = {'s': 1, 'm': 60, 'h': 3600, 'd': 24 * 3600}[sleep_time[-1]]
sleep_time = sleep_time[:-1]