Skip to content

Commit 0177b03

Browse files
Black formatting (#3035)
* fix: minor black formatting * style: update CONTRIBUTORS.md * fix: more black formatting Default black with no arguments provided --------- Co-authored-by: Darren Burns <[email protected]>
1 parent 7a168a2 commit 0177b03

31 files changed

+4
-39
lines changed

Diff for: CONTRIBUTORS.md

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ The following people have contributed to the development of Rich:
3131
- [Andrew Kettmann](https://github.com/akettmann)
3232
- [Martin Larralde](https://github.com/althonos)
3333
- [Hedy Li](https://github.com/hedythedev)
34+
- [Henry Mai](https://github.com/tanducmai)
3435
- [Luka Mamukashvili](https://github.com/UltraStudioLTD)
3536
- [Alexander Mancevice](https://github.com/amancevice)
3637
- [Will McGugan](https://github.com/willmcgugan)

Diff for: examples/dynamic_progress.py

-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ def run_steps(name, step_times, app_steps_task_id):
8989
# which allows for running multiple different progress bars in parallel,
9090
# and dynamically showing/hiding them
9191
with Live(progress_group):
92-
9392
for idx, (name, step_times) in enumerate(apps):
9493
# update message on overall progress bar
9594
top_descr = "[bold #AAAAAA](%d out of %d apps installed)" % (idx, len(apps))

Diff for: examples/top_lite_simulator.py

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def generate_process(pid: int) -> Process:
5353

5454

5555
def create_process_table(height: int) -> Table:
56-
5756
processes = sorted(
5857
[generate_process(pid) for pid in range(height)],
5958
key=lambda p: p.cpu_percent,

Diff for: rich/__main__.py

-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ def iter_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]:
207207

208208

209209
if __name__ == "__main__": # pragma: no cover
210-
211210
console = Console(
212211
file=io.StringIO(),
213212
force_terminal=True,

Diff for: rich/_ratio.py

-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ def ratio_distribute(
151151

152152
@dataclass
153153
class E:
154-
155154
size: Optional[int] = None
156155
ratio: int = 1
157156
minimum_size: int = 1

Diff for: rich/_windows.py

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class WindowsConsoleFeatures:
3030
)
3131

3232
except (AttributeError, ImportError, ValueError):
33-
3433
# Fallback if we can't load the Windows DLL
3534
def get_windows_console_features() -> WindowsConsoleFeatures:
3635
features = WindowsConsoleFeatures()

Diff for: rich/bar.py

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ def __repr__(self) -> str:
4848
def __rich_console__(
4949
self, console: Console, options: ConsoleOptions
5050
) -> RenderResult:
51-
5251
width = min(
5352
self.width if self.width is not None else options.max_width,
5453
options.max_width,

Diff for: rich/box.py

-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,6 @@ def get_bottom(self, widths: Iterable[int]) -> str:
464464

465465

466466
if __name__ == "__main__": # pragma: no cover
467-
468467
from rich.columns import Columns
469468
from rich.panel import Panel
470469

Diff for: rich/cells.py

-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ def chop_cells(text: str, max_size: int, position: int = 0) -> List[str]:
145145

146146

147147
if __name__ == "__main__": # pragma: no cover
148-
149148
print(get_character_cell_size("😽"))
150149
for line in chop_cells("""这是对亚洲语言支持的测试。面对模棱两可的想法,拒绝猜测的诱惑。""", 8):
151150
print(line)

Diff for: rich/color.py

-1
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,6 @@ def blend_rgb(
592592

593593

594594
if __name__ == "__main__": # pragma: no cover
595-
596595
from .console import Console
597596
from .table import Table
598597
from .text import Text

Diff for: rich/json.py

-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ def __rich__(self) -> Text:
103103

104104

105105
if __name__ == "__main__":
106-
107106
import argparse
108107
import sys
109108

Diff for: rich/layout.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ def tree(self) -> "Tree":
227227
from rich.tree import Tree
228228

229229
def summary(layout: "Layout") -> Table:
230-
231230
icon = layout.splitter.get_tree_icon()
232231

233232
table = Table.grid(padding=(0, 1, 0, 0))
@@ -403,7 +402,7 @@ def __rich_console__(
403402
self._render_map = render_map
404403
layout_lines: List[List[Segment]] = [[] for _ in range(height)]
405404
_islice = islice
406-
for (region, lines) in render_map.values():
405+
for region, lines in render_map.values():
407406
_x, y, _layout_width, layout_height = region
408407
for row, line in zip(
409408
_islice(layout_lines, y, y + layout_height), lines

Diff for: rich/live.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def process_renderables(
362362
table.add_column("Destination Currency")
363363
table.add_column("Exchange Rate")
364364

365-
for ((source, dest), exchange_rate) in exchange_rate_dict.items():
365+
for (source, dest), exchange_rate in exchange_rate_dict.items():
366366
table.add_row(
367367
source,
368368
dest,

Diff for: rich/live_render.py

-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ def restore_cursor(self) -> Control:
8282
def __rich_console__(
8383
self, console: Console, options: ConsoleOptions
8484
) -> RenderResult:
85-
8685
renderable = self.renderable
8786
style = console.get_style(self.style)
8887
lines = console.render_lines(renderable, options, style=style, pad=False)

Diff for: rich/progress_bar.py

-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ def _render_pulse(
156156
def __rich_console__(
157157
self, console: Console, options: ConsoleOptions
158158
) -> RenderResult:
159-
160159
width = min(self.width or options.max_width, options.max_width)
161160
ascii = options.legacy_windows or options.ascii_only
162161
should_pulse = self.pulse or self.total is None

Diff for: rich/prompt.py

-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ def process_response(self, value: str) -> bool:
346346

347347

348348
if __name__ == "__main__": # pragma: no cover
349-
350349
from rich import print
351350

352351
if Confirm.ask("Run [i]prompt[/i] tests?", default=True):

Diff for: rich/segment.py

-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ def is_control(self) -> bool:
109109
@classmethod
110110
@lru_cache(1024 * 16)
111111
def _split_cells(cls, segment: "Segment", cut: int) -> Tuple["Segment", "Segment"]:
112-
113112
text, style, control = segment
114113
_Segment = Segment
115114

Diff for: rich/status.py

-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ def __exit__(
107107

108108

109109
if __name__ == "__main__": # pragma: no cover
110-
111110
from time import sleep
112111

113112
from .console import Console

Diff for: rich/table.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ def __init__(
212212
caption_justify: "JustifyMethod" = "center",
213213
highlight: bool = False,
214214
) -> None:
215-
216215
self.columns: List[Column] = []
217216
self.rows: List[Row] = []
218217
self.title = title
@@ -471,7 +470,6 @@ def add_section(self) -> None:
471470
def __rich_console__(
472471
self, console: "Console", options: "ConsoleOptions"
473472
) -> "RenderResult":
474-
475473
if not self.columns:
476474
yield Segment("\n")
477475
return
@@ -685,7 +683,7 @@ def get_padding(first_row: bool, last_row: bool) -> Tuple[int, int, int, int]:
685683
getattr(renderable, "vertical", None) or column.vertical,
686684
)
687685
else:
688-
for (style, renderable) in raw_cells:
686+
for style, renderable in raw_cells:
689687
yield _Cell(
690688
style,
691689
renderable,

Diff for: rich/traceback.py

-3
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,6 @@ def render_locals(frame: Frame) -> Iterable[ConsoleRenderable]:
636636

637637
excluded = False
638638
for frame_index, frame in enumerate(stack.frames):
639-
640639
if exclude_frames and frame_index in exclude_frames:
641640
excluded = True
642641
continue
@@ -720,7 +719,6 @@ def render_locals(frame: Frame) -> Iterable[ConsoleRenderable]:
720719

721720

722721
if __name__ == "__main__": # pragma: no cover
723-
724722
from .console import Console
725723

726724
console = Console()
@@ -744,7 +742,6 @@ def foo(a: Any) -> None:
744742
bar(a)
745743

746744
def error() -> None:
747-
748745
try:
749746
try:
750747
foo(0)

Diff for: rich/tree.py

-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def add(
7272
def __rich_console__(
7373
self, console: "Console", options: "ConsoleOptions"
7474
) -> "RenderResult":
75-
7675
stack: List[Iterator[Tuple[bool, Tree]]] = []
7776
pop = stack.pop
7877
push = stack.append
@@ -195,7 +194,6 @@ def __rich_measure__(
195194

196195

197196
if __name__ == "__main__": # pragma: no cover
198-
199197
from rich.console import Group
200198
from rich.markdown import Markdown
201199
from rich.panel import Panel

Diff for: tests/test_align.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99

1010
def test_bad_align_legal():
11-
1211
# Legal
1312
Align("foo", "left")
1413
Align("foo", "center")

Diff for: tests/test_color.py

-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ def test_get_ansi_codes() -> None:
124124

125125

126126
def test_downgrade() -> None:
127-
128127
assert Color.parse("color(9)").downgrade(0) == Color(
129128
"color(9)", ColorType.STANDARD, 9, None
130129
)

Diff for: tests/test_file_proxy.py

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def test_flush():
2828

2929

3030
def test_new_lines():
31-
3231
file = io.StringIO()
3332
console = Console(file=file)
3433
file_proxy = FileProxy(console, file)

Diff for: tests/test_live.py

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def create_capture_console(
2222

2323

2424
def test_live_state() -> None:
25-
2625
with Live("") as live:
2726
assert live._started
2827
live.start()

Diff for: tests/test_progress.py

-4
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ def get_time():
150150

151151

152152
def test_download_progress_uses_decimal_units() -> None:
153-
154153
column = DownloadColumn()
155154
test_task = Task(1, "test", 1000, 500, _get_time=lambda: 1.0)
156155
rendered_progress = str(column.render(test_task))
@@ -159,7 +158,6 @@ def test_download_progress_uses_decimal_units() -> None:
159158

160159

161160
def test_download_progress_uses_binary_units() -> None:
162-
163161
column = DownloadColumn(binary_units=True)
164162
test_task = Task(1, "test", 1024, 512, _get_time=lambda: 1.0)
165163
rendered_progress = str(column.render(test_task))
@@ -280,7 +278,6 @@ def test_render() -> None:
280278

281279

282280
def test_track() -> None:
283-
284281
console = Console(
285282
file=io.StringIO(),
286283
force_terminal=True,
@@ -339,7 +336,6 @@ def test_progress_track() -> None:
339336

340337

341338
def test_columns() -> None:
342-
343339
console = Console(
344340
file=io.StringIO(),
345341
force_terminal=True,

Diff for: tests/test_stack.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33

44
def test_stack():
5-
65
stack = Stack()
76
stack.push("foo")
87
stack.push("bar")

Diff for: tests/test_status.py

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77

88
def test_status():
9-
109
console = Console(
1110
color_system=None, width=80, legacy_windows=False, get_time=lambda: 0.0
1211
)

Diff for: tests/test_table.py

-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ def test_init_append_column():
114114

115115

116116
def test_rich_measure():
117-
118117
console = Console()
119118
assert Table("test_header", width=-1).__rich_measure__(
120119
console, console.options

Diff for: tests/test_traceback.py

-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,6 @@ def level3():
345345

346346

347347
if __name__ == "__main__": # pragma: no cover
348-
349348
expected = render(get_exception())
350349

351350
with open("_exception_render.py", "wt") as fh:

Diff for: tools/make_terminal_widths.py

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def make_widths_table() -> List[Tuple[int, int, int]]:
4040

4141

4242
def get_cell_size(table: List[Tuple[int, int, int]], character: str) -> int:
43-
4443
codepoint = ord(character)
4544
lower_bound = 0
4645
upper_bound = len(table) - 1

0 commit comments

Comments
 (0)