Module hlrun.globals

Global constants and utility functions.

Functions

def dbg_print(*args: Any, **kwargs: Any) ‑> None
Expand source code
def dbg_print(*args: Any, **kwargs: Any) -> None:
    global DEBUG
    try:
        if DEBUG:  # type: ignore
            print("[pyhl] [py] ", end="")
            print(*args, **kwargs)
    except NameError:
        pass
def is_debug() ‑> bool
Expand source code
def is_debug() -> bool:
    """
    Checks if pyhl has DEBUG enabled in this runtime.
    """
    if not is_runtime():
        return False
    global DEBUG
    try:
        assert isinstance(DEBUG, bool)  # type: ignore
        return DEBUG  # type: ignore
    except NameError:
        return False

Checks if pyhl has DEBUG enabled in this runtime.

def is_runtime() ‑> bool
Expand source code
def is_runtime() -> bool:
    """
    Checks if the environment hlrun is running in is the pyhl runtime.
    """
    global RUNTIME
    try:
        assert isinstance(RUNTIME, bool)  # type: ignore
        return RUNTIME  # type: ignore
    except NameError:
        return False

Checks if the environment hlrun is running in is the pyhl runtime.