# Utilities function for the other files.

from inspect import getmodule
from inspect import isfunction
from inspect import signature

# Verify that the function is part of the module (we only want the functions from a file, not the
# functions from imported modules).
def is_mod_function(mod, func):
    return isfunction(func) and getmodule(func) == mod

# List the functions of a module, with the parameters (except the lazyFrame parameter).
def list_functions(mod):
    list_functions = []
    for func in mod.__dict__.values():
        if is_mod_function(mod, func):
            args = []
            function = func.__name__
            for arg in signature(func).parameters.keys():
                if (arg != "lazyFrame"):
                    args.append(arg)
            if args:
                function += '(' + ", ".join(args) + ')'
            list_functions.append(function)
    return list_functions