Skip to content

Commit 3c0290d

Browse files
Code style fixes for compatibility with latest Ruff.
1 parent 85079ad commit 3c0290d

File tree

206 files changed

+346
-250
lines changed

Some content is hidden

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

206 files changed

+346
-250
lines changed

Diff for: examples/dialogs/button_dialog.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Example of button dialog window.
44
"""
5+
56
from prompt_toolkit.shortcuts import button_dialog
67

78

Diff for: examples/dialogs/checkbox_dialog.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Example of a checkbox-list-based dialog.
44
"""
5+
56
from prompt_toolkit.formatted_text import HTML
67
from prompt_toolkit.shortcuts import checkboxlist_dialog, message_dialog
78
from prompt_toolkit.styles import Style
@@ -30,7 +31,7 @@
3031
if results:
3132
message_dialog(
3233
title="Room service",
33-
text="You selected: %s\nGreat choice sir !" % ",".join(results),
34+
text="You selected: {}\nGreat choice sir !".format(",".join(results)),
3435
).run()
3536
else:
3637
message_dialog("*starves*").run()

Diff for: examples/dialogs/input_dialog.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Example of an input box dialog.
44
"""
5+
56
from prompt_toolkit.shortcuts import input_dialog
67

78

Diff for: examples/dialogs/messagebox.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Example of a message box window.
44
"""
5+
56
from prompt_toolkit.shortcuts import message_dialog
67

78

Diff for: examples/dialogs/password_dialog.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Example of an password input dialog.
44
"""
5+
56
from prompt_toolkit.shortcuts import input_dialog
67

78

Diff for: examples/dialogs/progress_dialog.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Example of a progress bar dialog.
44
"""
5+
56
import os
67
import time
78

Diff for: examples/dialogs/radio_dialog.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Example of a radio list box dialog.
44
"""
5+
56
from prompt_toolkit.formatted_text import HTML
67
from prompt_toolkit.shortcuts import radiolist_dialog
78

Diff for: examples/dialogs/styled_messagebox.py

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
This also demonstrates that the `title` argument can be any kind of formatted
88
text.
99
"""
10+
1011
from prompt_toolkit.formatted_text import HTML
1112
from prompt_toolkit.shortcuts import message_dialog
1213
from prompt_toolkit.styles import Style

Diff for: examples/dialogs/yes_no_dialog.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Example of confirmation (yes/no) dialog window.
44
"""
5+
56
from prompt_toolkit.shortcuts import yes_no_dialog
67

78

Diff for: examples/full-screen/buttons.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
A simple example of a few buttons and click handlers.
44
"""
5+
56
from prompt_toolkit.application import Application
67
from prompt_toolkit.application.current import get_app
78
from prompt_toolkit.key_binding import KeyBindings

Diff for: examples/full-screen/calculator.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
A simple example of a calculator program.
44
This could be used as inspiration for a REPL.
55
"""
6+
67
from prompt_toolkit.application import Application
78
from prompt_toolkit.document import Document
89
from prompt_toolkit.key_binding import KeyBindings

Diff for: examples/full-screen/dummy-app.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
This is the most simple example possible.
44
"""
5+
56
from prompt_toolkit import Application
67

78
app = Application(full_screen=False)

Diff for: examples/full-screen/full-screen-demo.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
2-
"""
3-
"""
2+
""" """
3+
44
from pygments.lexers.html import HtmlLexer
55

66
from prompt_toolkit.application import Application
@@ -218,7 +218,7 @@ def do_exit():
218218

219219
def run():
220220
result = application.run()
221-
print("You said: %r" % result)
221+
print(f"You said: {result!r}")
222222

223223

224224
if __name__ == "__main__":

Diff for: examples/full-screen/hello-world.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
A simple example of a a text area displaying "Hello World!".
44
"""
5+
56
from prompt_toolkit.application import Application
67
from prompt_toolkit.key_binding import KeyBindings
78
from prompt_toolkit.layout import Layout

Diff for: examples/full-screen/no-layout.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
An empty full screen application without layout.
44
"""
5+
56
from prompt_toolkit import Application
67

78
Application(full_screen=True).run()

Diff for: examples/full-screen/pager.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
A simple application that shows a Pager application.
44
"""
5+
56
from pygments.lexers.python import PythonLexer
67

78
from prompt_toolkit.application import Application
@@ -28,10 +29,7 @@ def get_statusbar_text():
2829
("class:status", _pager_py_path + " - "),
2930
(
3031
"class:status.position",
31-
"{}:{}".format(
32-
text_area.document.cursor_position_row + 1,
33-
text_area.document.cursor_position_col + 1,
34-
),
32+
f"{text_area.document.cursor_position_row + 1}:{text_area.document.cursor_position_col + 1}",
3533
),
3634
("class:status", " - Press "),
3735
("class:status.key", "Ctrl-C"),

Diff for: examples/full-screen/scrollable-panes/simple-example.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
A simple example of a scrollable pane.
44
"""
5+
56
from prompt_toolkit.application import Application
67
from prompt_toolkit.application.current import get_app
78
from prompt_toolkit.key_binding import KeyBindings

Diff for: examples/full-screen/scrollable-panes/with-completion-menu.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
A simple example of a scrollable pane.
44
"""
5+
56
from prompt_toolkit.application import Application
67
from prompt_toolkit.application.current import get_app
78
from prompt_toolkit.completion import WordCompleter

Diff for: examples/full-screen/simple-demos/alignment.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Demo of the different Window alignment options.
44
"""
5+
56
from prompt_toolkit.application import Application
67
from prompt_toolkit.key_binding import KeyBindings
78
from prompt_toolkit.layout.containers import HSplit, Window, WindowAlign

Diff for: examples/full-screen/simple-demos/autocompletion.py

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Important is to make sure that there is a `CompletionsMenu` in the layout,
77
otherwise the completions won't be visible.
88
"""
9+
910
from prompt_toolkit.application import Application
1011
from prompt_toolkit.buffer import Buffer
1112
from prompt_toolkit.completion import WordCompleter

Diff for: examples/full-screen/simple-demos/colorcolumn.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Colorcolumn example.
44
"""
5+
56
from prompt_toolkit.application import Application
67
from prompt_toolkit.buffer import Buffer
78
from prompt_toolkit.key_binding import KeyBindings

Diff for: examples/full-screen/simple-demos/cursorcolumn-cursorline.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Cursorcolumn / cursorline example.
44
"""
5+
56
from prompt_toolkit.application import Application
67
from prompt_toolkit.buffer import Buffer
78
from prompt_toolkit.key_binding import KeyBindings

Diff for: examples/full-screen/simple-demos/float-transparency.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Example of the 'transparency' attribute of `Window' when used in a Float.
44
"""
5+
56
from prompt_toolkit.application import Application
67
from prompt_toolkit.formatted_text import HTML
78
from prompt_toolkit.key_binding import KeyBindings

Diff for: examples/full-screen/simple-demos/floats.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Horizontal split example.
44
"""
5+
56
from prompt_toolkit.application import Application
67
from prompt_toolkit.key_binding import KeyBindings
78
from prompt_toolkit.layout.containers import Float, FloatContainer, Window

Diff for: examples/full-screen/simple-demos/focus.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Demonstration of how to programmatically focus a certain widget.
44
"""
5+
56
from prompt_toolkit.application import Application
67
from prompt_toolkit.buffer import Buffer
78
from prompt_toolkit.document import Document

Diff for: examples/full-screen/simple-demos/horizontal-align.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Horizontal align demo with HSplit.
44
"""
5+
56
from prompt_toolkit.application import Application
67
from prompt_toolkit.formatted_text import HTML
78
from prompt_toolkit.key_binding import KeyBindings

Diff for: examples/full-screen/simple-demos/horizontal-split.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Horizontal split example.
44
"""
5+
56
from prompt_toolkit.application import Application
67
from prompt_toolkit.key_binding import KeyBindings
78
from prompt_toolkit.layout.containers import HSplit, Window

Diff for: examples/full-screen/simple-demos/line-prefixes.py

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Important is to make sure that there is a `CompletionsMenu` in the layout,
77
otherwise the completions won't be visible.
88
"""
9+
910
from prompt_toolkit.application import Application
1011
from prompt_toolkit.buffer import Buffer
1112
from prompt_toolkit.filters import Condition

Diff for: examples/full-screen/simple-demos/margins.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
This is mainly used for displaying line numbers and scroll bars, but it could
66
be used to display any other kind of information as well.
77
"""
8+
89
from prompt_toolkit.application import Application
910
from prompt_toolkit.buffer import Buffer
1011
from prompt_toolkit.key_binding import KeyBindings

Diff for: examples/full-screen/simple-demos/vertical-align.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Vertical align demo with VSplit.
44
"""
5+
56
from prompt_toolkit.application import Application
67
from prompt_toolkit.formatted_text import HTML
78
from prompt_toolkit.key_binding import KeyBindings

Diff for: examples/full-screen/simple-demos/vertical-split.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Vertical split example.
44
"""
5+
56
from prompt_toolkit.application import Application
67
from prompt_toolkit.key_binding import KeyBindings
78
from prompt_toolkit.layout.containers import VSplit, Window

Diff for: examples/full-screen/split-screen.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
This will show a window on the left for user input. When the user types, the
66
reversed input is shown on the right. Pressing Ctrl-Q will quit the application.
77
"""
8+
89
from prompt_toolkit.application import Application
910
from prompt_toolkit.buffer import Buffer
1011
from prompt_toolkit.key_binding import KeyBindings

Diff for: examples/full-screen/text-editor.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
A simple example of a Notepad-like text editor.
44
"""
5+
56
import datetime
67
from asyncio import Future, ensure_future
78

@@ -53,10 +54,7 @@ def get_statusbar_text():
5354

5455

5556
def get_statusbar_right_text():
56-
return " {}:{} ".format(
57-
text_field.document.cursor_position_row + 1,
58-
text_field.document.cursor_position_col + 1,
59-
)
57+
return f" {text_field.document.cursor_position_row + 1}:{text_field.document.cursor_position_col + 1} "
6058

6159

6260
search_toolbar = SearchToolbar()

Diff for: examples/gevent-get-input.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
For testing: test to make sure that everything still works when gevent monkey
44
patches are applied.
55
"""
6+
67
from gevent.monkey import patch_all
78

89
from prompt_toolkit.eventloop.defaults import create_event_loop
@@ -21,4 +22,4 @@ def dummy_inputhook(*a):
2122
# Ask for input.
2223
session = PromptSession("Give me some input: ", loop=eventloop)
2324
answer = session.prompt()
24-
print("You said: %s" % answer)
25+
print(f"You said: {answer}")

Diff for: examples/print-text/ansi-colors.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Demonstration of all the ANSI colors.
44
"""
5+
56
from prompt_toolkit import print_formatted_text
67
from prompt_toolkit.formatted_text import HTML, FormattedText
78

Diff for: examples/print-text/ansi.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
The advantage here is that this is cross platform. The escape sequences will be
66
parsed and turned into appropriate Win32 API calls on Windows.
77
"""
8+
89
from prompt_toolkit import print_formatted_text
910
from prompt_toolkit.formatted_text import ANSI, HTML
1011

Diff for: examples/print-text/html.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Demonstration of how to print using the HTML class.
44
"""
5+
56
from prompt_toolkit import HTML, print_formatted_text
67

78
print = print_formatted_text

Diff for: examples/print-text/named-colors.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Demonstration of all the ANSI colors.
44
"""
5+
56
from prompt_toolkit import HTML, print_formatted_text
67
from prompt_toolkit.formatted_text import FormattedText
78
from prompt_toolkit.output import ColorDepth

Diff for: examples/print-text/print-formatted-text.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Example of printing colored text to the output.
44
"""
5+
56
from prompt_toolkit import print_formatted_text
67
from prompt_toolkit.formatted_text import ANSI, HTML, FormattedText
78
from prompt_toolkit.styles import Style

Diff for: examples/print-text/print-frame.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Example usage of 'print_container', a tool to print
44
any layout in a non-interactive way.
55
"""
6+
67
from prompt_toolkit.shortcuts import print_container
78
from prompt_toolkit.widgets import Frame, TextArea
89

Diff for: examples/print-text/prompt-toolkit-logo-ansi-art.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
The ANSI output was generated using "pngtoansi": https://github.com/crgimenes/pngtoansi
55
(ESC still had to be replaced with \x1b
66
"""
7+
78
from prompt_toolkit import print_formatted_text
89
from prompt_toolkit.formatted_text import ANSI
910

Diff for: examples/print-text/pygments-tokens.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Printing a list of Pygments (Token, text) tuples,
44
or an output of a Pygments lexer.
55
"""
6+
67
import pygments
78
from pygments.lexers.python import PythonLexer
89
from pygments.token import Token

Diff for: examples/print-text/true-color-demo.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Demonstration of all the ANSI colors.
44
"""
5+
56
from prompt_toolkit import print_formatted_text
67
from prompt_toolkit.formatted_text import HTML, FormattedText
78
from prompt_toolkit.output import ColorDepth

0 commit comments

Comments
 (0)