How to use the asteval.astutils.HAS_NUMPY function in asteval

To help you get started, we’ve selected a few asteval examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github newville / asteval / asteval / asteval.py View on Github external
self.err_writer = err_writer or stderr

        if symtable is None:
            if usersyms is None:
                usersyms = {}
            symtable = make_symbol_table(use_numpy=use_numpy, **usersyms)

        self.symtable = symtable
        self._interrupt = None
        self.error = []
        self.error_msg = None
        self.expr = None
        self.retval = None
        self.lineno = 0
        self.start_time = time.time()
        self.use_numpy = HAS_NUMPY and use_numpy

        symtable['print'] = self._printer
        self.no_print = no_print or minimal

        nodes = ALL_NODES[:]

        if minimal or no_if:
            nodes.remove('if')
        if minimal or no_for:
            nodes.remove('for')
        if minimal or no_while:
            nodes.remove('while')
        if minimal or no_try:
            nodes.remove('try')
        if minimal or no_functiondef:
            nodes.remove('functiondef')