Skip to content

Commit 35f3da4

Browse files
committed
ruff fixes
1 parent ffdcfc9 commit 35f3da4

11 files changed

Lines changed: 23 additions & 58 deletions

File tree

.travis.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

progressbar/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
FormatLabel,
2525
FormatLabelBar,
2626
GranularBar,
27+
JobStatusBar,
2728
MultiProgressBar,
2829
MultiRangeBar,
2930
Percentage,
@@ -34,7 +35,6 @@
3435
Timer,
3536
Variable,
3637
VariableMixin,
37-
JobStatusBar,
3838
)
3939

4040
__date__ = str(date.today())

progressbar/bar.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,12 @@ def __init__(
207207
super().__init__(**kwargs)
208208

209209
def _apply_line_offset(
210-
self, fd: base.TextIO, line_offset: int
210+
self, fd: base.TextIO, line_offset: int,
211211
) -> base.TextIO:
212212
if line_offset:
213213
return progressbar.terminal.stream.LineOffsetStreamWrapper(
214-
line_offset, fd,
214+
line_offset,
215+
fd,
215216
)
216217
else:
217218
return fd
@@ -954,9 +955,9 @@ def start(self, max_value=None, init=True, *args, **kwargs):
954955
if self.max_value is None:
955956
self.max_value = self._DEFAULT_MAXVAL
956957

957-
StdRedirectMixin.start(self, max_value=max_value, *args, **kwargs)
958-
ResizableMixin.start(self, max_value=max_value, *args, **kwargs)
959-
ProgressBarBase.start(self, max_value=max_value, *args, **kwargs)
958+
StdRedirectMixin.start(self, max_value=max_value)
959+
ResizableMixin.start(self, max_value=max_value)
960+
ProgressBarBase.start(self, max_value=max_value)
960961

961962
# Constructing the default widgets is only done when we know max_value
962963
if not self.widgets:

progressbar/multi.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,7 @@ def update(force=True, write=True): # pragma: no cover
227227
self._label_bar(bar_)
228228
bar_.update(force=force)
229229
if write:
230-
yield typing.cast(
231-
stream.LastLineStream, bar_.fd).line
230+
yield typing.cast(stream.LastLineStream, bar_.fd).line
232231

233232
if bar_.finished():
234233
yield from self._render_finished_bar(bar_, now, expired, update)

progressbar/terminal/base.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class _CPR(str): # pragma: no cover
146146
_response_lock = threading.Lock()
147147

148148
def __call__(self, stream) -> tuple[int, int]:
149-
res : str = ''
149+
res: str = ''
150150

151151
with self._response_lock:
152152
stream.write(str(self))
@@ -160,10 +160,9 @@ def __call__(self, stream) -> tuple[int, int]:
160160

161161
res_list = res[2:-1].split(';')
162162

163-
res_list = tuple(int(item)
164-
if item.isdigit()
165-
else item
166-
for item in res_list)
163+
res_list = tuple(
164+
int(item) if item.isdigit() else item for item in res_list
165+
)
167166

168167
if len(res_list) == 1:
169168
return types.cast(tuple[int, int], res_list[0])

progressbar/terminal/stream.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ def truncate(self, __size: int | None = None) -> int:
126126

127127
return len(self.line)
128128

129-
def __iter__(self) -> typing.Generator[str, typing.Any,
130-
typing.Any]:
129+
def __iter__(self) -> typing.Generator[str, typing.Any, typing.Any]:
131130
yield self.line
132131

133132
def writelines(self, __lines: Iterable[str]) -> None:

tests/test_color.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
import typing
44

5-
import pytest
6-
75
import progressbar
86
import progressbar.env
97
import progressbar.terminal
8+
import pytest
109
from progressbar import env, terminal, widgets
11-
from progressbar.terminal import apply_colors, Colors, colors
10+
from progressbar.terminal import Colors, apply_colors, colors
1211

1312

1413
@pytest.mark.parametrize(

tests/test_job_status.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import time
22

3-
import pytest
4-
53
import progressbar
4+
import pytest
65

76

87
@pytest.mark.parametrize('status', [

tests/test_multibar.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import threading
21
import random
2+
import threading
33
import time
44

55
import progressbar
@@ -191,7 +191,8 @@ def print_sometimes(bar, probability):
191191
multibar.update(force=True, flush=True)
192192

193193
def test_multibar_no_format():
194-
with progressbar.MultiBar(initial_format=None, finished_format=None) as multibar:
194+
with progressbar.MultiBar(
195+
initial_format=None, finished_format=None) as multibar:
195196
bar = multibar['a']
196197

197198
for i in bar(range(5)):
@@ -215,7 +216,8 @@ def test_multibar_finished():
215216

216217

217218
def test_multibar_finished_format():
218-
multibar = progressbar.MultiBar(finished_format='Finished {label}', show_finished=True)
219+
multibar = progressbar.MultiBar(
220+
finished_format='Finished {label}', show_finished=True)
219221
bar = multibar['bar'] = progressbar.ProgressBar(max_value=5)
220222
bar2 = multibar['bar2']
221223
multibar.render(force=True)

tests/test_progressbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import os
21
import contextlib
2+
import os
33
import time
44

55
import original_examples # type: ignore

0 commit comments

Comments
 (0)