Beispiel #1
0
def run_repl(hr=None, spy=False):
    import platform

    sys.ps1 = "=> "
    sys.ps2 = "... "

    namespace = {"__name__": "__console__", "__doc__": ""}

    with completion(Completer(namespace)):

        if not hr:
            hr = HyREPL(spy, namespace)

        hr.interact(
            "{appname} {version} using "
            "{py}({build}) {pyversion} on {os}".format(
                appname=hy.__appname__,
                version=hy.__version__,
                py=platform.python_implementation(),
                build=platform.python_build()[0],
                pyversion=platform.python_version(),
                os=platform.system(),
            )
        )

    return 0
Beispiel #2
0
def run_repl(hr=None):
    sys.ps1 = "=> "
    sys.ps2 = "... "

    with completion():
        if not hr:
            hr = HyREPL()

        hr.interact("{appname} {version}".format(appname=hy.__appname__, version=hy.__version__))

    return 0
Beispiel #3
0
def run_repl(hr=None, spy=False):
    sys.ps1 = "=> "
    sys.ps2 = "... "

    with completion():
        if not hr:
            hr = HyREPL(spy)

        hr.interact("{appname} {version}".format(appname=hy.__appname__,
                                                 version=hy.__version__))

    return 0
Beispiel #4
0
def test_history_custom_location():
    import readline

    expected_entry = '(print "Hy, custom history file!")'

    with tempfile.TemporaryDirectory() as tmp:
        history_location = tmp + os.sep + ".hy-custom-history"
        os.environ["HY_HISTORY"] = history_location

        with completion():
            readline.clear_history()
            readline.add_history(expected_entry)

        with open(history_location, "r") as hf:
            actual_entry = hf.readline()
            assert expected_entry in actual_entry
Beispiel #5
0
def run_repl(hr=None, spy=False):
    import platform
    sys.ps1 = "=> "
    sys.ps2 = "... "

    with completion():
        if not hr:
            hr = HyREPL(spy)

        hr.interact("{appname} {version} using "
                    "{py}({build}) {pyversion} on {os}".format(
                        appname=hy.__appname__,
                        version=hy.__version__,
                        py=platform.python_implementation(),
                        build=platform.python_build()[0],
                        pyversion=platform.python_version(),
                        os=platform.system()
                    ))

    return 0
Beispiel #6
0
def run_repl(hr=None, spy=False):
    import platform
    sys.ps1 = "=> "
    sys.ps2 = "... "

    with completion():
        if not hr:
            hr = HyREPL(spy)

        hr.interact("{appname} {version} using "
                    "{py}({build}) {pyversion} on {os}".format(
                        appname=hy.__appname__,
                        version=hy.__version__,
                        py=platform.python_implementation(),
                        build=platform.python_build()[0],
                        pyversion=platform.python_version(),
                        os=platform.system()
                    ))

    return 0
Beispiel #7
0
def run_repl(hr=None, **kwargs):
    import platform
    sys.ps1 = "=> "
    sys.ps2 = "... "

    if not hr:
        hr = HyREPL(**kwargs)

    namespace = hr.locals
    with filtered_hy_exceptions(), \
         extend_linecache(hr.cmdline_cache), \
         completion(Completer(namespace)):
        hr.interact("{appname} {version} using "
                    "{py}({build}) {pyversion} on {os}".format(
                        appname=hy.__appname__,
                        version=hy.__version__,
                        py=platform.python_implementation(),
                        build=platform.python_build()[0],
                        pyversion=platform.python_version(),
                        os=platform.system()))

    return 0
Beispiel #8
0
def run_repl(hr=None, **kwargs):
    import platform
    sys.ps1 = "=> "
    sys.ps2 = "... "

    namespace = {'__name__': '__console__', '__doc__': ''}

    with completion(Completer(namespace)):

        if not hr:
            hr = HyREPL(locals=namespace, **kwargs)

        hr.interact("{appname} {version} using "
                    "{py}({build}) {pyversion} on {os}".format(
                        appname=hy.__appname__,
                        version=hy.__version__,
                        py=platform.python_implementation(),
                        build=platform.python_build()[0],
                        pyversion=platform.python_version(),
                        os=platform.system()))

    return 0
Beispiel #9
0
def run_repl(hr=None, **kwargs):
    import platform
    sys.ps1 = "=> "
    sys.ps2 = "... "

    if not hr:
        hr = HyREPL(**kwargs)

    namespace = hr.locals
    with filtered_hy_exceptions(), \
         extend_linecache(hr.cmdline_cache), \
         completion(Completer(namespace)):
        hr.interact("{appname} {version} using "
                    "{py}({build}) {pyversion} on {os}".format(
                        appname=hy.__appname__,
                        version=hy.__version__,
                        py=platform.python_implementation(),
                        build=platform.python_build()[0],
                        pyversion=platform.python_version(),
                        os=platform.system()
                    ))

    return 0