MCPcopy Index your code
hub / github.com/pyload/pyload / eval

Method eval

module/common/JsEngine.py:117–173  ·  view source on GitHub ↗
(self, script)

Source from the content-addressed store, hash-verified

115 return False if not ENGINE else True
116
117 def eval(self, script):
118 if not self.init:
119 if ENGINE == "pyv8" or (DEBUG and PYV8):
120 import PyV8
121 global PyV8
122
123 self.init = True
124
125 if type(script) == unicode:
126 script = script.encode("utf8")
127
128 if not ENGINE:
129 raise Exception("No JS Engine")
130
131 if not DEBUG:
132 if ENGINE == "pyv8":
133 return self.eval_pyv8(script)
134 elif ENGINE == "js2py":
135 return self.eval_js2py(script)
136 elif ENGINE == "js":
137 return self.eval_js(script)
138 elif ENGINE == "node":
139 return self.eval_node(script)
140 elif ENGINE == "rhino":
141 return self.eval_rhino(script)
142 else:
143 results = []
144 if PYV8:
145 res = self.eval_pyv8(script)
146 print "PyV8:", res
147 results.append(res)
148 if JS2PY:
149 res = self.eval_js2py(script)
150 print "js2py:", res
151 results.append(res)
152 if JS:
153 res = self.eval_js(script)
154 print "JS:", res
155 results.append(res)
156 if NODE:
157 res = self.eval_node(script)
158 print "NODE:", res
159 results.append(res)
160 if RHINO:
161 res = self.eval_rhino(script)
162 print "Rhino:", res
163 results.append(res)
164
165 warning = False
166 for x in results:
167 for y in results:
168 if x != y:
169 warning = True
170
171 if warning: print "### WARNING ###: Different results"
172
173 return results[0]
174

Callers 15

handle_freeMethod · 0.95
addcrypted2Method · 0.80
addcrypted2Method · 0.80
eval_pyv8Method · 0.80
JsEngine.pyFile · 0.80
handle_web_linksMethod · 0.80
_get_linksMethod · 0.80
handle_javascriptMethod · 0.80
_get_linksMethod · 0.80
handle_freeMethod · 0.80
handle_freeMethod · 0.80
get_linkMethod · 0.80

Calls 7

eval_pyv8Method · 0.95
eval_js2pyMethod · 0.95
eval_jsMethod · 0.95
eval_nodeMethod · 0.95
eval_rhinoMethod · 0.95
encodeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected