Merging upstream version 3.0.30.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
dd7a66a4f1
commit
3707c10a3c
35 changed files with 212 additions and 195 deletions
|
@ -25,7 +25,7 @@ async def print_counter() -> None:
|
|||
Coroutine that prints counters and saves it in a global variable.
|
||||
"""
|
||||
while True:
|
||||
print("Counter: %i" % counter[0])
|
||||
print(f"Counter: {counter[0]}")
|
||||
counter[0] += 1
|
||||
await asyncio.sleep(3)
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@ async def main(port: int = 8222) -> None:
|
|||
def create_server() -> MySSHServer:
|
||||
return MySSHServer(lambda: environ)
|
||||
|
||||
print("Listening on :%i" % port)
|
||||
print('To connect, do "ssh localhost -p %i"' % port)
|
||||
print(f"Listening on: {port}")
|
||||
print(f'To connect, do "ssh localhost -p {port}"')
|
||||
|
||||
await asyncssh.create_server(
|
||||
create_server, "", port, server_host_keys=["/etc/ssh/ssh_host_dsa_key"]
|
||||
|
|
|
@ -6,6 +6,8 @@ Thanks to Vincent Michel for this!
|
|||
https://gist.github.com/vxgmichel/7685685b3e5ead04ada4a3ba75a48eef
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import pathlib
|
||||
|
||||
|
@ -15,7 +17,7 @@ from prompt_toolkit.contrib.ssh.server import (
|
|||
PromptToolkitSSHServer,
|
||||
PromptToolkitSSHSession,
|
||||
)
|
||||
from prompt_toolkit.contrib.telnet.server import TelnetServer
|
||||
from prompt_toolkit.contrib.telnet.server import TelnetConnection, TelnetServer
|
||||
|
||||
from ptpython.repl import embed
|
||||
|
||||
|
@ -28,7 +30,7 @@ def ensure_key(filename: str = "ssh_host_key") -> str:
|
|||
return str(path)
|
||||
|
||||
|
||||
async def interact(connection: PromptToolkitSSHSession) -> None:
|
||||
async def interact(connection: PromptToolkitSSHSession | TelnetConnection) -> None:
|
||||
global_dict = {**globals(), "print": print_formatted_text}
|
||||
await embed(return_asyncio_coroutine=True, globals=global_dict)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue