Skip to content

Commit 568de64

Browse files
Black 23.1.0
1 parent 4e22156 commit 568de64

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+5
-97
lines changed

examples/progress-bar/nested-progress-bars.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ def main():
1313
title=HTML('<b fg="#aa00ff">Nested progress bars</b>'),
1414
bottom_toolbar=HTML(" <b>[Control-L]</b> clear <b>[Control-C]</b> abort"),
1515
) as pb:
16-
1716
for i in pb(range(6), label="Main task"):
1817
for j in pb(range(200), label=f"Subtask <{i + 1}>", remove_when_done=True):
1918
time.sleep(0.01)

examples/progress-bar/styled-2.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def main():
4141
formatters=custom_formatters,
4242
style=style,
4343
) as pb:
44-
4544
for i in pb(range(20), label="Downloading..."):
4645
time.sleep(1)
4746

src/prompt_toolkit/application/application.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ def __init__(
226226
input: Optional[Input] = None,
227227
output: Optional[Output] = None,
228228
) -> None:
229-
230229
# If `enable_page_navigation_bindings` is not specified, enable it in
231230
# case of full screen applications only. This can be overridden by the user.
232231
if enable_page_navigation_bindings is None:
@@ -736,7 +735,6 @@ def flush_input() -> None:
736735
with self.input.raw_mode(), self.input.attach(
737736
read_from_input
738737
), attach_winch_signal_handler(self._on_resize):
739-
740738
# Draw UI.
741739
self._request_absolute_cursor_position()
742740
self._redraw()

src/prompt_toolkit/application/current.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class AppSession:
4444
def __init__(
4545
self, input: Optional["Input"] = None, output: Optional["Output"] = None
4646
) -> None:
47-
4847
self._input = input
4948
self._output = output
5049

src/prompt_toolkit/auto_suggest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ class ConditionalAutoSuggest(AutoSuggest):
151151
"""
152152

153153
def __init__(self, auto_suggest: AutoSuggest, filter: Union[bool, Filter]) -> None:
154-
155154
self.auto_suggest = auto_suggest
156155
self.filter = to_filter(filter)
157156

src/prompt_toolkit/buffer.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ def __init__(
8484
completions: Optional[List["Completion"]] = None,
8585
complete_index: Optional[int] = None,
8686
) -> None:
87-
8887
#: Document as it was when the completion started.
8988
self.original_document = original_document
9089

@@ -156,7 +155,6 @@ class YankNthArgState:
156155
def __init__(
157156
self, history_position: int = 0, n: int = -1, previous_inserted_word: str = ""
158157
) -> None:
159-
160158
self.history_position = history_position
161159
self.previous_inserted_word = previous_inserted_word
162160
self.n = n
@@ -253,7 +251,6 @@ def __init__(
253251
on_completions_changed: Optional[BufferEventHandler] = None,
254252
on_suggestion_set: Optional[BufferEventHandler] = None,
255253
):
256-
257254
# Accept both filters and booleans as input.
258255
enable_history_search = to_filter(enable_history_search)
259256
complete_while_typing = to_filter(complete_while_typing)
@@ -1720,7 +1717,6 @@ async def async_completer(
17201717
insert_common_part: bool = False,
17211718
complete_event: Optional[CompleteEvent] = None,
17221719
) -> None:
1723-
17241720
document = self.document
17251721
complete_event = complete_event or CompleteEvent(text_inserted=True)
17261722

src/prompt_toolkit/clipboard/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class ClipboardData:
2525
def __init__(
2626
self, text: str = "", type: SelectionType = SelectionType.CHARACTERS
2727
) -> None:
28-
2928
self.text = text
3029
self.type = type
3130

src/prompt_toolkit/clipboard/in_memory.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class InMemoryClipboard(Clipboard):
1919
def __init__(
2020
self, data: Optional[ClipboardData] = None, max_size: int = 60
2121
) -> None:
22-
2322
assert max_size >= 1
2423

2524
self.max_size = max_size

src/prompt_toolkit/completion/base.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ def __init__(
4646
style: str = "",
4747
selected_style: str = "",
4848
) -> None:
49-
5049
from prompt_toolkit.formatted_text import to_formatted_text
5150

5251
self.text = text
@@ -354,7 +353,6 @@ def get_completions(
354353
async def get_completions_async(
355354
self, document: Document, complete_event: CompleteEvent
356355
) -> AsyncGenerator[Completion, None]:
357-
358356
# Get all completions in a non-blocking way.
359357
if self.filter():
360358
async with aclosing(
@@ -382,7 +380,6 @@ def get_completions(
382380
async def get_completions_async(
383381
self, document: Document, complete_event: CompleteEvent
384382
) -> AsyncGenerator[Completion, None]:
385-
386383
# Get all completions from the other completers in a non-blocking way.
387384
for completer in self.completers:
388385
async with aclosing(
@@ -416,6 +413,7 @@ def get_common_complete_suffix(
416413
"""
417414
Return the common prefix for all completions.
418415
"""
416+
419417
# Take only completions that don't change the text before the cursor.
420418
def doesnt_change_before_cursor(completion: Completion) -> bool:
421419
end = completion.text[: -completion.start_position]

src/prompt_toolkit/completion/filesystem.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def __init__(
3030
min_input_len: int = 0,
3131
expanduser: bool = False,
3232
) -> None:
33-
3433
self.only_directories = only_directories
3534
self.get_paths = get_paths or (lambda: ["."])
3635
self.file_filter = file_filter or (lambda _: True)

src/prompt_toolkit/completion/fuzzy_completer.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def __init__(
5050
pattern: Optional[str] = None,
5151
enable_fuzzy: FilterOrBool = True,
5252
) -> None:
53-
5453
assert pattern is None or pattern.startswith("^")
5554

5655
self.completer = completer
@@ -190,7 +189,6 @@ def __init__(
190189
meta_dict: Optional[Dict[str, str]] = None,
191190
WORD: bool = False,
192191
) -> None:
193-
194192
self.words = words
195193
self.meta_dict = meta_dict or {}
196194
self.WORD = WORD

src/prompt_toolkit/completion/nested.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class NestedCompleter(Completer):
2828
def __init__(
2929
self, options: Dict[str, Optional[Completer]], ignore_case: bool = True
3030
) -> None:
31-
3231
self.options = options
3332
self.ignore_case = ignore_case
3433

src/prompt_toolkit/completion/word_completer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def __init__(
4040
match_middle: bool = False,
4141
pattern: Optional[Pattern[str]] = None,
4242
) -> None:
43-
4443
assert not (WORD and sentence)
4544

4645
self.words = words

src/prompt_toolkit/contrib/regular_languages/compiler.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ def __init__(
8484
escape_funcs: Optional[EscapeFuncDict] = None,
8585
unescape_funcs: Optional[EscapeFuncDict] = None,
8686
) -> None:
87-
8887
self.root_node = root_node
8988
self.escape_funcs = escape_funcs or {}
9089
self.unescape_funcs = unescape_funcs or {}

src/prompt_toolkit/contrib/regular_languages/completion.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class GrammarCompleter(Completer):
2626
def __init__(
2727
self, compiled_grammar: _CompiledGrammar, completers: Dict[str, Completer]
2828
) -> None:
29-
3029
self.compiled_grammar = compiled_grammar
3130
self.completers = completers
3231

src/prompt_toolkit/contrib/regular_languages/lexer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def __init__(
3737
default_style: str = "",
3838
lexers: Optional[Dict[str, Lexer]] = None,
3939
) -> None:
40-
4140
self.compiled_grammar = compiled_grammar
4241
self.default_style = default_style
4342
self.lexers = lexers or {}

src/prompt_toolkit/contrib/regular_languages/validation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class GrammarValidator(Validator):
2626
def __init__(
2727
self, compiled_grammar: _CompiledGrammar, validators: Dict[str, Validator]
2828
) -> None:
29-
3029
self.compiled_grammar = compiled_grammar
3130
self.validators = validators
3231

src/prompt_toolkit/contrib/telnet/protocol.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ def __init__(
7171
size_received_callback: Callable[[int, int], None],
7272
ttype_received_callback: Callable[[str], None],
7373
) -> None:
74-
7574
self.data_received_callback = data_received_callback
7675
self.size_received_callback = size_received_callback
7776
self.ttype_received_callback = ttype_received_callback

src/prompt_toolkit/contrib/telnet/server.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ def __init__(
134134
vt100_input: PipeInput,
135135
enable_cpr: bool = True,
136136
) -> None:
137-
138137
self.conn = conn
139138
self.addr = addr
140139
self.interact = interact
@@ -280,7 +279,6 @@ def __init__(
280279
style: Optional[BaseStyle] = None,
281280
enable_cpr: bool = True,
282281
) -> None:
283-
284282
self.host = host
285283
self.port = port
286284
self.interact = interact

src/prompt_toolkit/document.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ def __init__(
102102
cursor_position: Optional[int] = None,
103103
selection: Optional[SelectionState] = None,
104104
) -> None:
105-
106105
# Check cursor position. It can also be right after the end. (Where we
107106
# insert text.)
108107
assert cursor_position is None or cursor_position <= len(text), AssertionError(

src/prompt_toolkit/key_binding/bindings/named_commands.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ def print_last_kbd_macro(event: E) -> None:
574574
"""
575575
Print the last keyboard macro.
576576
"""
577+
577578
# TODO: Make the format suitable for the inputrc file.
578579
def print_macro() -> None:
579580
macro = event.app.emacs_state.macro

src/prompt_toolkit/key_binding/bindings/vi.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ class TextObject:
7171
def __init__(
7272
self, start: int, end: int = 0, type: TextObjectType = TextObjectType.EXCLUSIVE
7373
):
74-
7574
self.start = start
7675
self.end = end
7776
self.type = type

src/prompt_toolkit/key_binding/key_bindings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,6 @@ def setting_is_true():
547547
def __init__(
548548
self, key_bindings: KeyBindingsBase, filter: FilterOrBool = True
549549
) -> None:
550-
551550
_Proxy.__init__(self)
552551

553552
self.key_bindings = key_bindings

src/prompt_toolkit/key_binding/key_processor.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,6 @@ def __init__(
437437
previous_key_sequence: List[KeyPress],
438438
is_repeat: bool,
439439
) -> None:
440-
441440
self._key_processor_ref = key_processor_ref
442441
self.key_sequence = key_sequence
443442
self.previous_key_sequence = previous_key_sequence

src/prompt_toolkit/layout/containers.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ def __init__(
213213
key_bindings: Optional[KeyBindingsBase] = None,
214214
style: Union[str, Callable[[], str]] = "",
215215
) -> None:
216-
217216
self.children = [to_container(c) for c in children]
218217
self.window_too_small = window_too_small or _window_too_small()
219218
self.padding = padding
@@ -287,7 +286,6 @@ def __init__(
287286
key_bindings: Optional[KeyBindingsBase] = None,
288287
style: Union[str, Callable[[], str]] = "",
289288
) -> None:
290-
291289
super().__init__(
292290
children=children,
293291
window_too_small=window_too_small,
@@ -525,7 +523,6 @@ def __init__(
525523
key_bindings: Optional[KeyBindingsBase] = None,
526524
style: Union[str, Callable[[], str]] = "",
527525
) -> None:
528-
529526
super().__init__(
530527
children=children,
531528
window_too_small=window_too_small,
@@ -769,7 +766,6 @@ def __init__(
769766
style: Union[str, Callable[[], str]] = "",
770767
z_index: Optional[int] = None,
771768
) -> None:
772-
773769
self.content = to_container(content)
774770
self.floats = floats
775771

@@ -1069,7 +1065,6 @@ def __init__(
10691065
z_index: int = 1,
10701066
transparent: bool = False,
10711067
) -> None:
1072-
10731068
assert z_index >= 1
10741069

10751070
self.left = left
@@ -1149,7 +1144,6 @@ def __init__(
11491144
y_offset: int,
11501145
wrap_lines: bool,
11511146
) -> None:
1152-
11531147
self.window = window
11541148
self.ui_content = ui_content
11551149
self.vertical_scroll = vertical_scroll
@@ -1342,7 +1336,6 @@ def __init__(
13421336
left: Union[int, Callable[[], int]] = 0,
13431337
right: Union[int, Callable[[], int]] = 0,
13441338
) -> None:
1345-
13461339
self._top = top
13471340
self._bottom = bottom
13481341
self._left = left
@@ -1490,7 +1483,6 @@ def __init__(
14901483
char: Union[None, str, Callable[[], str]] = None,
14911484
get_line_prefix: Optional[GetLinePrefixCallable] = None,
14921485
) -> None:
1493-
14941486
self.allow_scroll_beyond_bottom = to_filter(allow_scroll_beyond_bottom)
14951487
self.always_hide_cursor = to_filter(always_hide_cursor)
14961488
self.wrap_lines = to_filter(wrap_lines)
@@ -1551,6 +1543,7 @@ def _get_margin_width(self, margin: Margin) -> int:
15511543
Return the width for this margin.
15521544
(Calculate only once per render time.)
15531545
"""
1546+
15541547
# Margin.get_width, needs to have a UIContent instance.
15551548
def get_ui_content() -> UIContent:
15561549
return self._get_ui_content(width=0, height=0)
@@ -2205,7 +2198,6 @@ def _fill_bg(
22052198
def _apply_style(
22062199
self, new_screen: Screen, write_position: WritePosition, parent_style: str
22072200
) -> None:
2208-
22092201
# Apply `self.style`.
22102202
style = parent_style + " " + to_str(self.style)
22112203

src/prompt_toolkit/layout/controls.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ def __init__(
164164
menu_position: Optional[Point] = None,
165165
show_cursor: bool = True,
166166
):
167-
168167
self.get_line = get_line
169168
self.line_count = line_count
170169
self.cursor_position = cursor_position or Point(x=0, y=0)
@@ -308,7 +307,6 @@ def __init__(
308307
modal: bool = False,
309308
get_cursor_position: Optional[Callable[[], Optional[Point]]] = None,
310309
) -> None:
311-
312310
self.text = text # No type check on 'text'. This is done dynamically.
313311
self.style = style
314312
self.focusable = to_filter(focusable)
@@ -536,7 +534,6 @@ def __init__(
536534
focus_on_click: FilterOrBool = False,
537535
key_bindings: Optional["KeyBindingsBase"] = None,
538536
):
539-
540537
self.input_processors = input_processors
541538
self.include_default_input_processors = include_default_input_processors
542539

@@ -627,7 +624,6 @@ def preferred_height(
627624
wrap_lines: bool,
628625
get_line_prefix: Optional[GetLinePrefixCallable],
629626
) -> Optional[int]:
630-
631627
# Calculate the content height, if it was drawn on a screen with the
632628
# given width.
633629
height = 0
@@ -657,6 +653,7 @@ def _get_formatted_text_for_line_func(
657653
"""
658654
Create a function that returns the fragments for a given line.
659655
"""
656+
660657
# Cache using `document.text`.
661658
def get_formatted_text_for_line() -> Callable[[int], StyleAndTextTuples]:
662659
return self.lexer.lex_document(document)
@@ -681,6 +678,7 @@ def _create_get_processed_line_func(
681678

682679
def transform(lineno: int, fragments: StyleAndTextTuples) -> _ProcessedLine:
683680
"Transform the fragments for a given line number."
681+
684682
# Get cursor position at this line.
685683
def source_to_display(i: int) -> int:
686684
"""X position from the buffer to the x position in the
@@ -943,7 +941,6 @@ def __init__(
943941
key_bindings: Optional["KeyBindingsBase"] = None,
944942
ignore_case: FilterOrBool = False,
945943
):
946-
947944
super().__init__(
948945
buffer=buffer,
949946
input_processors=input_processors,

0 commit comments

Comments
 (0)