How to use the ipycanvas.py2js.Py2JSNameError function in ipycanvas

To help you get started, we’ve selected a few ipycanvas 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 martinRenou / ipycanvas / ipycanvas / py2js.py View on Github external
def __init__(self, message):
        error_msg = message + ', note that only a subset of Python is supported'
        super(Py2JSNameError, self).__init__(error_msg)
github martinRenou / ipycanvas / ipycanvas / py2js.py View on Github external
def visit_NameConstant(self, node):
        """Turn a Python nameconstant expression into JavaScript code."""
        if node.value is False:
            return 'false'
        if node.value is True:
            return 'true'
        if node.value is None:
            return 'null'
        raise Py2JSNameError('name \'{}\' is not defined'.format(str(node.value)))