コード例 #1
0
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
コード例 #2
0
ファイル: cli.py プロジェクト: piannucci/aioconsole
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)
コード例 #3
0
ファイル: utils.py プロジェクト: pidoorrr/aiomonitor
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
コード例 #4
0
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
コード例 #5
0
ファイル: utils.py プロジェクト: gridl/aiomonitor
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