예제 #1
0
파일: cmdline.py 프로젝트: kartikm/hy
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
예제 #2
0
파일: cmdline.py 프로젝트: nathancahill/hy
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
예제 #3
0
파일: cmdline.py 프로젝트: kaizoku/hy
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
예제 #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
예제 #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
예제 #6
0
파일: cmdline.py 프로젝트: zenhack/hy
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
예제 #7
0
파일: cmdline.py 프로젝트: jams2/hy
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
예제 #8
0
파일: cmdline.py 프로젝트: rubythonode/hy
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
예제 #9
0
파일: cmdline.py 프로젝트: hylang/hy
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