Skip to content

Commit

Permalink
chore(deps): Bump prompt-toolkit from 2.0.10 to 3.0.50 (openwallet-fo…
Browse files Browse the repository at this point in the history
…undation#3526)

* chore(deps): Bump prompt-toolkit from 2.0.10 to 3.0.50

Bumps [prompt-toolkit](https://github.com/prompt-toolkit/python-prompt-toolkit) from 2.0.10 to 3.0.50.
- [Release notes](https://github.com/prompt-toolkit/python-prompt-toolkit/releases)
- [Changelog](https://github.com/prompt-toolkit/python-prompt-toolkit/blob/master/CHANGELOG)
- [Commits](prompt-toolkit/python-prompt-toolkit@2.0.10...3.0.50)

---
updated-dependencies:
- dependency-name: prompt-toolkit
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* 🎨 Remove `use_asyncio_event_loop` --

prompt-toolkit now runs on top of asyncio by default

Signed-off-by: ff137 <[email protected]>

* 🎨 Remove need for prompt init

Signed-off-by: ff137 <[email protected]>

* ✅ Remove mocking of unused function

Signed-off-by: ff137 <[email protected]>

* ✅ Mock only `sys.stdout.isatty`, not `sys.stdout`

Signed-off-by: ff137 <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: ff137 <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: ff137 <[email protected]>
Co-authored-by: jamshale <[email protected]>
  • Loading branch information
3 people authored Feb 21, 2025
1 parent 7c73d98 commit 825840b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 142 deletions.
4 changes: 0 additions & 4 deletions acapy_agent/config/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import markdown
import prompt_toolkit
from prompt_toolkit.eventloop.defaults import use_asyncio_event_loop
from prompt_toolkit.formatted_text import HTML
from uuid_utils import uuid4

Expand Down Expand Up @@ -211,9 +210,6 @@ async def select_aml_tty(taa_info, provision: bool = False) -> Optional[str]:
+ taa_html
)

# setup for prompt_toolkit
use_asyncio_event_loop()

prompt_toolkit.print_formatted_text(HTML(taa_html))

opts = []
Expand Down
13 changes: 3 additions & 10 deletions acapy_agent/config/tests/test_ledger.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from unittest import IsolatedAsyncioTestCase

import pytest
Expand Down Expand Up @@ -634,9 +635,8 @@ async def test_ledger_accept_taa_not_tty_not_accept_config(self, mock_stdout):
None, self.profile, taa_info, provision=False
)

@mock.patch("sys.stdout")
async def test_ledger_accept_taa_tty(self, mock_stdout):
mock_stdout.isatty = mock.MagicMock(return_value=True)
async def test_ledger_accept_taa_tty(self):
sys.stdout.isatty = mock.MagicMock(return_value=True)
self.profile = await create_test_profile()

taa_info = {
Expand All @@ -645,7 +645,6 @@ async def test_ledger_accept_taa_tty(self, mock_stdout):
}

with (
mock.patch.object(test_module, "use_asyncio_event_loop", mock.MagicMock()),
mock.patch.object(
test_module.prompt_toolkit, "prompt", mock.CoroutineMock()
) as mock_prompt,
Expand All @@ -656,9 +655,6 @@ async def test_ledger_accept_taa_tty(self, mock_stdout):
)

with (
mock.patch.object(
test_module, "use_asyncio_event_loop", mock.MagicMock()
) as mock_use_aio_loop,
mock.patch.object(
test_module.prompt_toolkit, "prompt", mock.CoroutineMock()
) as mock_prompt,
Expand All @@ -669,9 +665,6 @@ async def test_ledger_accept_taa_tty(self, mock_stdout):
)

with (
mock.patch.object(
test_module, "use_asyncio_event_loop", mock.MagicMock()
) as mock_use_aio_loop,
mock.patch.object(
test_module.prompt_toolkit, "prompt", mock.CoroutineMock()
) as mock_prompt,
Expand Down
9 changes: 0 additions & 9 deletions demo/runners/support/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import prompt_toolkit
import pygments
from prompt_toolkit.application import run_in_terminal
from prompt_toolkit.eventloop.defaults import use_asyncio_event_loop
from prompt_toolkit.formatted_text import FormattedText, PygmentsTokens
from prompt_toolkit.patch_stdout import patch_stdout
from prompt_toolkit.shortcuts import ProgressBar
Expand Down Expand Up @@ -142,15 +141,7 @@ def flatten(args):
yield arg


def prompt_init():
if hasattr(prompt_init, "_called"):
return
prompt_init._called = True
use_asyncio_event_loop()


async def prompt(*args, **kwargs):
prompt_init()
with patch_stdout():
try:
while True:
Expand Down
Loading

0 comments on commit 825840b

Please sign in to comment.