How to use the asteval.astutils.ReturnedNone 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 / View on Github external
def on_return(self, node):  # ('value',)
        """Return statement: look for None, return special sentinal."""
        self.retval =
        if self.retval is None:
            self.retval = ReturnedNone
github newville / asteval / asteval / View on Github external
self.raise_exc(None, msg=msg, lineno=self.lineno)

        save_symtable = self.__asteval__.symtable.copy()
        self.__asteval__.retval = None
        retval = None

        # evaluate script of function
        for node in self.body:
  , expr='<>', lineno=self.lineno)
            if len(self.__asteval__.error) > 0:
            if self.__asteval__.retval is not None:
                retval = self.__asteval__.retval
                self.__asteval__.retval = None
                if retval is ReturnedNone:
                    retval = None

        self.__asteval__.symtable = save_symtable
        symlocals = None
        return retval