How to use the asteval.astutils.make_symbol_table 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
def __init__(self, symtable=None, usersyms=None, writer=None,
                 err_writer=None, use_numpy=True, minimal=False,
                 no_if=False, no_for=False, no_while=False, no_try=False,
                 no_functiondef=False, no_ifexp=False, no_listcomp=False,
                 no_augassign=False, no_assert=False, no_delete=False,
                 no_raise=False, no_print=False, max_time=None,
                 readonly_symbols=None, builtins_readonly=False):

        self.writer = writer or stdout
        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[:]