Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def createError(self, line, pos, description):
self.log_err_case()
from js2py.base import ERRORS, Js, JsToPyException
error = ERRORS['SyntaxError']('Line ' + unicode(line) + ': ' + unicode(description))
error.put('index', Js(pos))
error.put('lineNumber', Js(line))
error.put('column', Js(pos - (self.lineStart if self.scanning else self.lastLineStart) + 1))
error.put('description', Js(description))
return JsToPyException(error)
def createError(self, line, pos, description):
self.log_err_case()
from js2py.base import ERRORS, Js, JsToPyException
error = ERRORS['SyntaxError']('Line ' + unicode(line) + ': ' + unicode(description))
error.put('index', Js(pos))
error.put('lineNumber', Js(line))
error.put('column', Js(pos - (self.lineStart if self.scanning else self.lastLineStart) + 1))
error.put('description', Js(description))
return JsToPyException(error)
def createError(self, line, pos, description):
if ENABLE_JS2PY_ERRORS:
self.log_err_case()
try:
from js2py.base import ERRORS, Js, JsToPyException
except:
raise Exception("ENABLE_JS2PY_ERRORS was set to True, but Js2Py was not found!")
error = ERRORS['SyntaxError']('Line ' + unicode(line) + ': ' + unicode(description))
error.put('index', Js(pos))
error.put('lineNumber', Js(line))
error.put('column', Js(pos - (self.lineStart if self.scanning else self.lastLineStart) + 1))
error.put('description', Js(description))
return JsToPyException(error)
else:
return JsSyntaxError('Line ' + unicode(line) + ': ' + unicode(description))
def createError(self, line, pos, description):
global ENABLE_PYIMPORT
if ENABLE_JS2PY_ERRORS:
old_pyimport = ENABLE_PYIMPORT # ENABLE_PYIMPORT will be affected by js2py import
self.log_err_case()
try:
from js2py.base import ERRORS, Js, JsToPyException
except:
raise Exception("ENABLE_JS2PY_ERRORS was set to True, but Js2Py was not found!")
ENABLE_PYIMPORT = old_pyimport
error = ERRORS['SyntaxError']('Line ' + unicode(line) + ': ' + unicode(description))
error.put('index', Js(pos))
error.put('lineNumber', Js(line))
error.put('column', Js(pos - (self.lineStart if self.scanning else self.lastLineStart) + 1))
error.put('description', Js(description))
return JsToPyException(error)
else:
return JsSyntaxError('Line ' + unicode(line) + ': ' + unicode(description))
def createError(self, line, pos, description):
self.log_err_case()
from js2py.base import ERRORS, Js, JsToPyException
error = ERRORS['SyntaxError']('Line ' + unicode(line) + ': ' + unicode(description))
error.put('index', Js(pos))
error.put('lineNumber', Js(line))
error.put('column', Js(pos - (self.lineStart if self.scanning else self.lastLineStart) + 1))
error.put('description', Js(description))
return JsToPyException(error)
def createError(self, line, pos, description):
self.log_err_case()
from js2py.base import ERRORS, Js, JsToPyException
error = ERRORS['SyntaxError']('Line ' + unicode(line) + ': ' + unicode(description))
error.put('index', Js(pos))
error.put('lineNumber', Js(line))
error.put('column', Js(pos - (self.lineStart if self.scanning else self.lastLineStart) + 1))
error.put('description', Js(description))
return JsToPyException(error)
def createError(self, line, pos, description):
global ENABLE_PYIMPORT
if ENABLE_JS2PY_ERRORS:
old_pyimport = ENABLE_PYIMPORT # ENABLE_PYIMPORT will be affected by js2py import
self.log_err_case()
try:
from js2py.base import ERRORS, Js, JsToPyException
except:
raise Exception("ENABLE_JS2PY_ERRORS was set to True, but Js2Py was not found!")
ENABLE_PYIMPORT = old_pyimport
error = ERRORS['SyntaxError']('Line ' + unicode(line) + ': ' + unicode(description))
error.put('index', Js(pos))
error.put('lineNumber', Js(line))
error.put('column', Js(pos - (self.lineStart if self.scanning else self.lastLineStart) + 1))
error.put('description', Js(description))
return JsToPyException(error)
else:
return JsSyntaxError('Line ' + unicode(line) + ': ' + unicode(description))
def createError(self, line, pos, description):
global ENABLE_PYIMPORT
if ENABLE_JS2PY_ERRORS:
old_pyimport = ENABLE_PYIMPORT # ENABLE_PYIMPORT will be affected by js2py import
self.log_err_case()
try:
from js2py.base import ERRORS, Js, JsToPyException
except:
raise Exception("ENABLE_JS2PY_ERRORS was set to True, but Js2Py was not found!")
ENABLE_PYIMPORT = old_pyimport
error = ERRORS['SyntaxError']('Line ' + unicode(line) + ': ' + unicode(description))
error.put('index', Js(pos))
error.put('lineNumber', Js(line))
error.put('column', Js(pos - (self.lineStart if self.scanning else self.lastLineStart) + 1))
error.put('description', Js(description))
return JsToPyException(error)
else:
return JsSyntaxError('Line ' + unicode(line) + ': ' + unicode(description))
def createError(self, line, pos, description):
self.log_err_case()
from js2py.base import ERRORS, Js, JsToPyException
error = ERRORS['SyntaxError']('Line ' + unicode(line) + ': ' + unicode(description))
error.put('index', Js(pos))
error.put('lineNumber', Js(line))
error.put('column', Js(pos - (self.lineStart if self.scanning else self.lastLineStart) + 1))
error.put('description', Js(description))
return JsToPyException(error)
val.put(key, new_element)
return reviver.call(holder, (name, val))
JSON = Js({})
JSON.define_own_property('parse', {'value': Js(parse),
'enumerable': False,
'writable': True,
'configurable': True})
JSON.define_own_property('stringify', {'value': Js(stringify),
'enumerable': False,
'writable': True,
'configurable': True})