|
29 | 29 | # of all in-scope data structures after each executed instruction. |
30 | 30 |
|
31 | 31 |
|
| 32 | +import json |
| 33 | +import random |
| 34 | +from .pg_encoder import is_class, is_instance, ObjectEncoder, create_lambda_line_number |
32 | 35 | import sys |
33 | 36 | import bdb # the KEY import here! |
34 | 37 | import re |
|
45 | 48 | else: |
46 | 49 | import StringIO |
47 | 50 |
|
48 | | -from .pg_encoder import is_class, is_instance, ObjectEncoder, create_lambda_line_number |
49 | 51 |
|
50 | 52 | # TODO: not threadsafe: |
51 | 53 |
|
@@ -149,16 +151,16 @@ def setJS(jsStr): |
149 | 151 | # especially getting setHTML, setCSS, and setJS to work in the imported |
150 | 152 | # modules.) |
151 | 153 | CUSTOM_MODULE_IMPORTS = ( |
152 | | - "runestone.codelens.callback_module", |
153 | | - "runestone.codelens.ttt_module", |
154 | | - "runestone.codelens.html_module", |
155 | | - "runestone.codelens.htmlexample_module", |
156 | | - # ignore these troublesome imports for now |
157 | | - # 'watch_module', # 'import sys' might be troublesome |
158 | | - # 'bintree_module', |
159 | | - # 'GChartWrapper', |
160 | | - "runestone.codelens.matrix", |
161 | | - "runestone.codelens.htmlFrame", |
| 154 | + # "runestone.codelens.callback_module", |
| 155 | + # "runestone.codelens.ttt_module", |
| 156 | + # "runestone.codelens.html_module", |
| 157 | + # "runestone.codelens.htmlexample_module", |
| 158 | + # # ignore these troublesome imports for now |
| 159 | + # # 'watch_module', # 'import sys' might be troublesome |
| 160 | + # # 'bintree_module', |
| 161 | + # # 'GChartWrapper', |
| 162 | + # "runestone.codelens.matrix", |
| 163 | + # "runestone.codelens.htmlFrame", |
162 | 164 | ) |
163 | 165 |
|
164 | 166 |
|
@@ -218,7 +220,6 @@ def __restricted_import__(*args): |
218 | 220 | # Note that this is mad inefficient, but is simple to implement! |
219 | 221 |
|
220 | 222 | # VERY IMPORTANT -- set random seed to 0 to ensure deterministic execution: |
221 | | -import random |
222 | 223 |
|
223 | 224 | random.seed(0) |
224 | 225 |
|
@@ -398,6 +399,8 @@ def get_user_stdout(frame): |
398 | 399 | """ |
399 | 400 |
|
400 | 401 | # at_global_scope should be true only if 'frame' represents the global scope |
| 402 | + |
| 403 | + |
401 | 404 | def get_user_globals(frame, at_global_scope=False): |
402 | 405 | d = filter_var_dict(frame.f_globals) |
403 | 406 |
|
@@ -1506,9 +1509,8 @@ def finalize(self): |
1506 | 1509 | return self.finalizer_func(self.executed_script, self.trace) |
1507 | 1510 |
|
1508 | 1511 |
|
1509 | | -import json |
1510 | | - |
1511 | 1512 | # the MAIN meaty function!!! |
| 1513 | + |
1512 | 1514 | def exec_script_str(script_str, raw_input_lst_json, options_json, finalizer_func): |
1513 | 1515 | options = json.loads(options_json) |
1514 | 1516 |
|
|
0 commit comments