def init_console_server(host: str, port: int, _locals, loop): def _factory(streams=None) -> aioconsole.AsynchronousConsole: return NoBannerConsole(locals=_locals, streams=streams, loop=loop) coro = aioconsole.start_interactive_server( host=host, port=port, factory=_factory, loop=loop ) console_future = asyncio.run_coroutine_threadsafe(coro, loop=loop) return console_future
def main(args=None): host, port, serve_cli = parse_args(args) if serve_cli: cli_host, cli_port = serve_cli coro = start_interactive_server(make_cli, cli_host, cli_port) server = asyncio.get_event_loop().run_until_complete(coro) print_server(server, 'command line interface') else: asyncio.async(make_cli().interact()) return echo.run(host, port)
def init_console_server(host: str, port: int, locals: OptLocals, loop: Loop) -> 'Future[Server]': def _factory(streams: Any = None) -> aioconsole.AsynchronousConsole: return aioconsole.AsynchronousConsole( locals=locals, streams=streams, loop=loop) coro = aioconsole.start_interactive_server( host=host, port=port, factory=_factory, loop=loop) console_future = asyncio.run_coroutine_threadsafe(coro, loop=loop) return console_future
def init_console_server(host: str, port: int, locals: OptLocals, loop: Loop) -> Server: def _factory(streams: Any = None) -> aioconsole.AsynchronousConsole: return aioconsole.AsynchronousConsole(locals=locals, streams=streams, loop=loop) coro = aioconsole.start_interactive_server(host=host, port=port, factory=_factory, loop=loop) server = loop.run_until_complete(coro) # type: Server return server
def init_console_server(host, port, loop): coro = aioconsole.start_interactive_server(host=host, port=port, loop=loop) console_future = asyncio.run_coroutine_threadsafe(coro, loop=loop) return console_future