Skip to content

Commit

Permalink
rename waituntil => delay
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Feb 25, 2021
1 parent caf6dbb commit 90cb341
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions tests/tests_tqdm.py
Expand Up @@ -622,11 +622,11 @@ def test_max_interval():
t2.close()


def test_waituntil():
"""Test waituntil"""
def test_delay():
"""Test delay"""
timer = DiscreteTimer()
with closing(StringIO()) as our_file:
t = tqdm(total=2, file=our_file, leave=True, waituntil=3)
t = tqdm(total=2, file=our_file, leave=True, delay=3)
cpu_timify(t, timer)
timer.sleep(2)
t.update(1)
Expand Down
14 changes: 7 additions & 7 deletions tqdm/std.py
Expand Up @@ -844,7 +844,7 @@ def __init__(self, iterable=None, desc=None, total=None, leave=True, file=None,
ascii=None, disable=False, unit='it', unit_scale=False,
dynamic_ncols=False, smoothing=0.3, bar_format=None, initial=0,
position=None, postfix=None, unit_divisor=1000, write_bytes=None,
lock_args=None, nrows=None, colour=None, waituntil=0, gui=False,
lock_args=None, nrows=None, colour=None, delay=0, gui=False,
**kwargs):
"""
Parameters
Expand Down Expand Up @@ -952,7 +952,7 @@ def __init__(self, iterable=None, desc=None, total=None, leave=True, file=None,
The fallback is 20.
colour : str, optional
Bar colour (e.g. 'green', '#00ff00').
waituntil : float, optional
delay : float, optional
Don't display until [default: 0] seconds have elapsed.
gui : bool, optional
WARNING: internal parameter - do not use.
Expand Down Expand Up @@ -1071,7 +1071,7 @@ def __init__(self, iterable=None, desc=None, total=None, leave=True, file=None,
self.unit_divisor = unit_divisor
self.initial = initial
self.lock_args = lock_args
self.waituntil = waituntil
self.delay = delay
self.gui = gui
self.dynamic_ncols = dynamic_ncols
self.smoothing = smoothing
Expand Down Expand Up @@ -1103,7 +1103,7 @@ def __init__(self, iterable=None, desc=None, total=None, leave=True, file=None,
if not gui:
# Initialize the screen printer
self.sp = self.status_printer(self.fp)
if waituntil <= 0:
if delay <= 0:
self.refresh(lock_args=self.lock_args)

# Init the time counter
Expand Down Expand Up @@ -1168,7 +1168,7 @@ def __iter__(self):
mininterval = self.mininterval
last_print_t = self.last_print_t
last_print_n = self.last_print_n
min_start_t = self.start_t + self.waituntil
min_start_t = self.start_t + self.delay
n = self.n
time = self._time

Expand Down Expand Up @@ -1227,7 +1227,7 @@ def update(self, n=1):
if self.n - self.last_print_n >= self.miniters:
cur_t = self._time()
dt = cur_t - self.last_print_t
if dt >= self.mininterval and cur_t >= self.start_t + self.waituntil:
if dt >= self.mininterval and cur_t >= self.start_t + self.delay:
cur_t = self._time()
dn = self.n - self.last_print_n # >= n
if self.smoothing and dt and dn:
Expand Down Expand Up @@ -1287,7 +1287,7 @@ def fp_write(s):
leave = pos == 0 if self.leave is None else self.leave

with self._lock:
if self.last_print_t < self.start_t + self.waituntil:
if self.last_print_t < self.start_t + self.delay:
# haven't ever displayed; nothing to clear
return
if leave:
Expand Down

0 comments on commit 90cb341

Please sign in to comment.