iota/bin/repl.py
def _start_repl(api):
        # type: (Iota) -> None
        """
        Starts the REPL.
        """
        banner = (
            'IOTA API client for {uri} ({testnet}) '
            'initialized as variable `api`.\n'
            'Type `help(api)` for list of API commands.'.format(
                testnet='testnet' if api.testnet else 'mainnet',
                uri=api.adapter.get_uri(),
            )
        )

        scope_vars = {'api': api}

        try:
            # noinspection PyUnresolvedReferences
            import IPython
        except ImportError:
            # IPython not available; use regular Python REPL.
            from code import InteractiveConsole
            InteractiveConsole(locals=scope_vars).interact(banner, '')
        else:
            print(banner)
            IPython.start_ipython(argv=[], user_ns=scope_vars)
def _start_repl(api):
        # type: (Iota) -> None
        """
        Starts the REPL.
        """
        banner = (
            'IOTA API client for {uri} ({testnet}) '
            'initialized as variable `api`.\n'
            'Type `help(api)` for list of API commands.'.format(
                testnet='testnet' if api.testnet else 'mainnet',
                uri=api.adapter.get_uri(),
            )
        )

        scope_vars = {'api': api}

        try:
            # noinspection PyUnresolvedReferences
            import IPython
        except ImportError:
            # IPython not available; use regular Python REPL.
            from code import InteractiveConsole
            InteractiveConsole(locals=scope_vars).interact(banner, '')
        else:
            print(banner)
            IPython.start_ipython(argv=[], user_ns=scope_vars)
Starts the REPL.