scripts/hapy_cli.py
def do(code, compile_only, english):
    """Compile Hapy from line of code"""
    compiled_python = ""

    if (english):
        # tell Hapy compiler that it should listen for English vocabulary
        # one way to do that is to change the ENV_VAR
        os.environ["HAPY_LANG"] = "eng"
    else:
        os.environ["HAPY_LANG"] = "hausa"

    if code:
        # compile the python or execute!
        compiled_python = transpile(code)
        if compile_only:
            return click.echo(compiled_python, nl=False)
        else:
            try:
                click.echo(eval(compiled_python), nl=False)
            except:
                try:
                    out = exec(compiled_python)
                    if out is not None:
                        click.echo(out, nl=False)
                except Exception as e:
                    click.echo(f"Error: {e}")
Compile Hapy from line of code
Compile Hapy from line of code
Compile Hapy from line of code
def do(code, compile_only, english):
    compiled_python = ""
    if (english):
        os.environ["HAPY_LANG"] = "eng"
    else:
        os.environ["HAPY_LANG"] = "hausa"
    if code:
        compiled_python = transpile(code)
        if compile_only:
            return click.echo(compiled_python, nl=False)
        else:
            try:
                click.echo(eval(compiled_python), nl=False)
            except:
                try:
                    out = exec(compiled_python)
                    if out is not None:
                        click.echo(out, nl=False)
                except Exception as e:
                    click.echo(f"Error: {e}")
def do ( code , compile_only , english ) : compiled_python = "" if ( english ) : os . environ [ "HAPY_LANG" ] = "eng" else : os . environ [ "HAPY_LANG" ] = "hausa" if code : compiled_python = transpile ( code ) if compile_only : return click . echo ( compiled_python , nl = False ) else : try : click . echo ( eval ( compiled_python ) , nl = False ) except : try : out = exec ( compiled_python ) if out is not None : click . echo ( out , nl = False ) except Exception as e : click . echo ( f"Error: {e}" )
Compile Hapy from line of code
Compile Hapy from line of code
"""Compile Hapy from line of code""" # tell Hapy compiler that it should listen for English vocabulary # one way to do that is to change the ENV_VAR # compile the python or execute!
code
compile_only
english