Skip to content

Commit 94f2e78

Browse files
committed
mypy fixes
1 parent 19795af commit 94f2e78

3 files changed

Lines changed: 18 additions & 13 deletions

File tree

progressbar/bar.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def start(self, **kwargs):
106106
def update(self, value=None):
107107
pass
108108

109-
def finish(self): # pragma: no cover
109+
def finish(self) -> None: # pragma: no cover
110110
self._finished = True
111111

112112
def __del__(self):
@@ -185,7 +185,7 @@ def __init__(
185185

186186
ProgressBarMixinBase.__init__(self, **kwargs)
187187

188-
def update(self, *args, **kwargs):
188+
def update(self, *args: types.Any, **kwargs: types.Any) -> None:
189189
ProgressBarMixinBase.update(self, *args, **kwargs)
190190

191191
line: str = converters.to_unicode(self._format_line())
@@ -202,7 +202,8 @@ def update(self, *args, **kwargs):
202202
except UnicodeEncodeError: # pragma: no cover
203203
self.fd.write(line.encode('ascii', 'replace'))
204204

205-
def finish(self, *args, **kwargs): # pragma: no cover
205+
def finish(self, *args: types.Any, **kwargs: types.Any) -> None: # pragma: no cover
206+
206207
if self._finished:
207208
return
208209

@@ -824,14 +825,18 @@ def update(self, value=None, force=False, **kwargs):
824825
# Only flush if something was actually written
825826
self.fd.flush()
826827

827-
def start(self, max_value=None, init=True):
828+
def start( # type: ignore[override]
829+
self,
830+
max_value: int | None=None,
831+
init: bool=True,
832+
):
828833
'''Starts measuring time, and prints the bar at 0%.
829834
830835
It returns self so you can use it like this:
831836
832837
Args:
833838
max_value (int): The maximum value of the progressbar
834-
reinit (bool): Initialize the progressbar, this is useful if you
839+
init (bool): (Re)Initialize the progressbar, this is useful if you
835840
wish to reuse the same progressbar but can be disabled if
836841
data needs to be passed along to the next run
837842

progressbar/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class Undefined(metaclass=FalseMeta):
2323
try: # pragma: no cover
2424
IO = types.IO # type: ignore
2525
TextIO = types.TextIO # type: ignore
26-
except AttributeError:
26+
except AttributeError: # pragma: no cover
2727
from typing.io import IO, TextIO # type: ignore
2828

29-
assert IO
30-
assert TextIO
29+
assert IO is not None
30+
assert TextIO is not None

progressbar/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
if types.TYPE_CHECKING:
2121
from .bar import ProgressBar, ProgressBarMixinBase
2222

23-
assert timedelta_to_seconds
24-
assert get_terminal_size
25-
assert format_time
26-
assert scale_1024
27-
assert epoch
23+
assert timedelta_to_seconds is not None
24+
assert get_terminal_size is not None
25+
assert format_time is not None
26+
assert scale_1024 is not None
27+
assert epoch is not None
2828

2929
StringT = types.TypeVar('StringT', bound=types.StringTypes)
3030

0 commit comments

Comments
 (0)