Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions js2py/translators/friendly_nodes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import binascii

from pyjsparser import PyJsParser
from js2py import pyjs
import six
if six.PY3:
basestring = str
Expand All @@ -10,6 +11,7 @@

REGEXP_CONVERTER = PyJsParser()

RESERVED_INTERNAL = set(pyjs.__all__ + ["Js", "Scope"])

def to_hex(s):
return binascii.hexlify(s.encode('utf8')).decode(
Expand Down Expand Up @@ -49,6 +51,8 @@ def get_break_label(label):


def is_valid_py_name(name):
if name in RESERVED_INTERNAL:
return False
try:
compile(name + ' = 11', 'a', 'exec')
except:
Expand Down