(module, reload="False")
Creates a global translation dictionary for module.

    The argument module has to be one of the following strings: "math",
    "mpmath", "numpy", "sympy".
    These dictionaries map names of python functions to their equivalent in
    other modules.
Creates a global translation dictionary for module.
Creates a global translation dictionary for module .
def _import(module, reload="False"):
    """
    Creates a global translation dictionary for module.

    The argument module has to be one of the following strings: "math",
    "mpmath", "numpy", "sympy".
    These dictionaries map names of python functions to their equivalent in
    other modules.
    """
    try:
        namespace, namespace_default, translations, import_commands = MODULES[
            module]
    except KeyError:
        raise NameError(
            "'%s' module can't be used for lambdification" % module)

    # Clear namespace or exit
    if namespace != namespace_default:
        # The namespace was already generated, don't do it again if not forced.
        if reload:
            namespace.clear()
            namespace.update(namespace_default)
        else:
            return

    for import_command in import_commands:
        if import_command.startswith('import_module'):
            module = eval(import_command)

            if module is not None:
                namespace.update(module.__dict__)
                continue
        else:
            try:
                exec_(import_command, {}, namespace)
                continue
            except ImportError:
                pass

        raise ImportError(
            "can't import '%s' with '%s' command" % (module, import_command))

    # Add translated names to namespace
    for sympyname, translation in translations.items():
        namespace[sympyname] = namespace[translation]
def _import ( module , reload = "False" ) : try : namespace , namespace_default , translations , import_commands = MODULES [ module ] except KeyError : raise NameError ( "'%s' module can't be used for lambdification" % module ) # Clear namespace or exit if namespace != namespace_default : # The namespace was already generated, don't do it again if not forced. if reload : namespace . clear ( ) namespace . update ( namespace_default ) else : return for import_command in import_commands : if import_command . startswith ( 'import_module' ) : module = eval ( import_command ) if module is not None : namespace . update ( module . __dict__ ) continue else : try : exec_ ( import_command , { } , namespace ) continue except ImportError : pass raise ImportError ( "can't import '%s' with '%s' command" % ( module , import_command ) ) # Add translated names to namespace for sympyname , translation in translations . items ( ) : namespace [ sympyname ] = namespace [ translation ]