Skip to content

Fix code formatting (ruff). #1959

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions examples/dialogs/progress_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ def worker(set_percentage, log_text):
def main():
progress_dialog(
title="Progress dialog example",
text="As an examples, we walk through the filesystem and print "
"all directories",
text="As an examples, we walk through the filesystem and print all directories",
run_callback=worker,
).run()

Expand Down
7 changes: 1 addition & 6 deletions examples/prompts/colored-prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,7 @@ def example_3():
Using ANSI for the formatting.
"""
answer = prompt(
ANSI(
"\x1b[31mjohn\x1b[0m@"
"\x1b[44mlocalhost\x1b[0m:"
"\x1b[4m/user/john\x1b[0m"
"# "
)
ANSI("\x1b[31mjohn\x1b[0m@\x1b[44mlocalhost\x1b[0m:\x1b[4m/user/john\x1b[0m# ")
)
print(f"You said: {answer}")

Expand Down
3 changes: 1 addition & 2 deletions src/prompt_toolkit/filters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ def __bool__(self) -> None:
instead of for instance ``filter1 or Always()``.
"""
raise ValueError(
"The truth value of a Filter is ambiguous. "
"Instead, call it as a function."
"The truth value of a Filter is ambiguous. Instead, call it as a function."
)


Expand Down
6 changes: 3 additions & 3 deletions src/prompt_toolkit/layout/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,9 +847,9 @@ def filter_processor(item: Processor) -> Processor | None:
def apply_transformation(self, ti: TransformationInput) -> Transformation:
from .controls import SearchBufferControl

assert isinstance(
ti.buffer_control, SearchBufferControl
), "`ReverseSearchProcessor` should be applied to a `SearchBufferControl` only."
assert isinstance(ti.buffer_control, SearchBufferControl), (
"`ReverseSearchProcessor` should be applied to a `SearchBufferControl` only."
)

source_to_display: SourceToDisplay | None
display_to_source: DisplayToSource | None
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,11 +870,11 @@ def test_vi_temp_navigation_mode():
"""
feed = partial(_feed_cli_with_input, editing_mode=EditingMode.VI)

result, cli = feed("abcde" "\x0f" "3h" "x\r") # c-o # 3 times to the left.
result, cli = feed("abcde\x0f3hx\r") # c-o # 3 times to the left.
assert result.text == "axbcde"
assert result.cursor_position == 2

result, cli = feed("abcde" "\x0f" "b" "x\r") # c-o # One word backwards.
result, cli = feed("abcde\x0fbx\r") # c-o # One word backwards.
assert result.text == "xabcde"
assert result.cursor_position == 1

Expand Down
Loading