Skip to content

Commit 3790a61

Browse files
committed
moved common instruction to method
1 parent 901db37 commit 3790a61

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/prompt_toolkit/application/application.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def __init__(
192192
key_bindings: KeyBindingsBase | None = None,
193193
clipboard: Clipboard | None = None,
194194
full_screen: bool = False,
195-
color_depth: (ColorDepth | Callable[[], ColorDepth | None] | None) = None,
195+
color_depth: ColorDepth | Callable[[], ColorDepth | None] | None = None,
196196
mouse_support: FilterOrBool = False,
197197
enable_page_navigation_bindings: None
198198
| (FilterOrBool) = None, # Can be None, True or False.

src/prompt_toolkit/layout/containers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,9 +1464,7 @@ def __init__(
14641464
always_hide_cursor: FilterOrBool = False,
14651465
cursorline: FilterOrBool = False,
14661466
cursorcolumn: FilterOrBool = False,
1467-
colorcolumns: (
1468-
None | list[ColorColumn] | Callable[[], list[ColorColumn]]
1469-
) = None,
1467+
colorcolumns: None | list[ColorColumn] | Callable[[], list[ColorColumn]] = None,
14701468
align: WindowAlign | Callable[[], WindowAlign] = WindowAlign.LEFT,
14711469
style: str | Callable[[], str] = "",
14721470
char: None | str | Callable[[], str] = None,

src/prompt_toolkit/shortcuts/prompt.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,9 +522,11 @@ def accept(buff: Buffer) -> bool:
522522
enable_history_search=dyncond("enable_history_search"),
523523
validator=DynamicValidator(lambda: self.validator),
524524
completer=DynamicCompleter(
525-
lambda: ThreadedCompleter(self.completer)
526-
if self.complete_in_thread and self.completer
527-
else self.completer
525+
lambda: (
526+
ThreadedCompleter(self.completer)
527+
if self.complete_in_thread and self.completer
528+
else self.completer
529+
)
528530
),
529531
history=self.history,
530532
auto_suggest=DynamicAutoSuggest(lambda: self.auto_suggest),

tests/test_cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ def _feed_cli_with_password(text, check_line_ending=True, hide_password=False):
5555
)
5656

5757
_ = session.prompt()
58-
return output
58+
59+
output.stdout.seek(0) # Reset the stream pointer
60+
return output
5961

6062

6163
def _feed_cli_with_input(
@@ -98,7 +100,6 @@ def test_visible_password():
98100
# but that's not what the user sees on screen.
99101
password = "secret-value\r"
100102
output = _feed_cli_with_password(password, hide_password=False)
101-
output.stdout.seek(0) # Reset the stream pointer
102103
actual_output = output.stdout.read().strip()
103104

104105
# Test that the string is made up only of `*` characters
@@ -112,7 +113,6 @@ def test_visible_password():
112113
def test_invisible_password():
113114
password = "secret-value\r"
114115
output = _feed_cli_with_password(password, hide_password=True)
115-
output.stdout.seek(0) # Reset the stream pointer
116116
actual_output = output.stdout.read().strip()
117117

118118
# Test that, if the `hide_password` flag is set to True,

0 commit comments

Comments
 (0)