Skip to content

Commit d3ad16d

Browse files
Ken Odegardjonathanslenders
authored andcommitted
Typing for stop_time
1 parent 7ca1e46 commit d3ad16d

File tree

1 file changed

+3
-4
lines changed
  • prompt_toolkit/shortcuts/progress_bar

1 file changed

+3
-4
lines changed

prompt_toolkit/shortcuts/progress_bar/base.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def __init__(self, progress_bar: ProgressBar,
307307
total: Optional[int] = None) -> None:
308308

309309
self.start_time = datetime.datetime.now()
310-
self.stop_time = None
310+
self.stop_time: Optional[datetime.datetime] = None
311311
self.progress_bar = progress_bar
312312
self.data = data
313313
self.items_completed = 0
@@ -350,8 +350,7 @@ def done(self) -> bool:
350350
def done(self, value: bool) -> None:
351351
self._done = value
352352

353-
# if declared done then store the stop_time
354-
# otherwise clear the stop_time
353+
# If done then store the stop_time, otherwise clear.
355354
self.stop_time = datetime.datetime.now() if value else None
356355

357356
if value and self.remove_when_done:
@@ -367,7 +366,7 @@ def percentage(self) -> float:
367366
@property
368367
def time_elapsed(self) -> datetime.timedelta:
369368
"""
370-
return how much time has been elapsed since the start.
369+
Return how much time has been elapsed since the start.
371370
"""
372371
if self.stop_time is None:
373372
return datetime.datetime.now() - self.start_time

0 commit comments

Comments
 (0)