Skip to content

Commit 175f5a3

Browse files
committed
lots of shuffling files around to organize better and remove cruft
1 parent b7c04fb commit 175f5a3

173 files changed

Lines changed: 60 additions & 8369 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎v4-cokapi/cokapi.js‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ var util = require('util');
5252
// spawn a shell
5353
// http://nodejs.org/api/child_process.html#child_process_child_process_execfile_file_args_options_callback
5454

55-
var NODE_BIN = '/usr/local/bin/node';
56-
var PYTHON2_BIN = '/usr/bin/python';
57-
var PYTHON3_BIN = '/usr/local/bin/python3.3';
58-
5955
var TIMEOUT_SECS = 10;
6056
var JAVA_TIMEOUT_SECS = 15; // the Java backend is SUPER SLOW :/
6157
var CPP_TIMEOUT_SECS = 15; // the C/C++ backend is also SUPER SLOW :/

‎v5-unity/README.txt‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ legacy code (hopefully)
1414

1515
---
1616

17+
to start the development environment using npm, run:
18+
19+
npm start
20+
npm run webpack
21+
22+
---
23+
1724
Requires these global installations:
1825
- Node.js / npm
1926
- webpack: http://webpack.github.io/ and webpack-dev-server
@@ -32,12 +39,6 @@ webpack --watch
3239
and run the server with Bottle:
3340
python bottle_server.py
3441

35-
36-
to start using npm:
37-
38-
npm start
39-
npm run webpack
40-
4142
---
4243
Ported the code base over to TypeScript for enhanced static checking
4344

@@ -73,4 +74,3 @@ TODO: always do webpack -p for deploy to production, and add a unique hash
7374

7475
TODO: consider code splitting to split out common parts (e.g., libraries
7576
and unchanging parts) from the specific frontends
76-

‎v5-unity/bottle_server.py‎

Lines changed: 14 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Lightweight OPT server that works on both Python 2 and 3
22

3+
# NOTE that this is meant only for testing and not deployment, since
4+
# there is no sandboxing
5+
36
# to invoke, run 'python bottle_server.py'
47
# and visit http://localhost:8080/index.html
58
#
@@ -8,16 +11,13 @@
811
# easy_install pip
912
# pip install bottle
1013

11-
# From an OPT user: A couple notes: to get bottle_server.py running,
12-
# I had to replace cStringIO with io and urllib2 with urllib, for
13-
# compatibility from 2.x to 3.x Ii was running from /v3/).
14-
1514
from bottle import route, get, request, run, template, static_file
16-
import StringIO # NB: don't use cStringIO since it doesn't support unicode!!!
15+
try:
16+
import StringIO # NB: don't use cStringIO since it doesn't support unicode!!!
17+
except:
18+
import io as StringIO # py3
1719
import json
1820
import pg_logger
19-
import urllib
20-
import urllib2
2121

2222
# dummy routes for testing only
2323
@route('/web_exec_<name:re:.+>.py')
@@ -28,14 +28,17 @@ def web_exec(name):
2828
def live_exec(name):
2929
return 'OK'
3030

31+
@route('/viz_interaction.py')
32+
def viz_interaction():
33+
return 'OK'
3134

3235
@route('/<filepath:path>')
3336
def index(filepath):
34-
# special-case for testing name_lookup.py ...
35-
if 'name_lookup.py' in filepath:
36-
return json.dumps(dict(name='TEST NAME', email='TEST EMAIL'))
3737
return static_file(filepath, root='.')
3838

39+
40+
# Note that this will run either Python 2 or 3, depending on which
41+
# version of Python you used to start the server.
3942
@get('/exec')
4043
def get_exec():
4144
out_s = StringIO.StringIO()
@@ -55,63 +58,5 @@ def json_finalizer(input_code, output_trace):
5558

5659
return out_s.getvalue()
5760

58-
59-
@get('/load_matrix_problem.py')
60-
def load_matrix_problem():
61-
prob_name = request.query.problem_name
62-
assert type(prob_name) in (str, unicode)
63-
64-
# whitelist
65-
assert prob_name in ('python_comprehension-1',)
66-
67-
fn = 'matrix-demo/' + prob_name + '.py'
68-
f = open(fn)
69-
cod = f.read()
70-
f.close()
71-
72-
import doctest
73-
import sys
74-
p = doctest.DocTestParser()
75-
examples = p.get_examples(cod)
76-
if len(examples):
77-
first_ex = examples[0]
78-
#print >> sys.stderr, 'Source:', `first_ex.source`
79-
testCod = 'result = ' + first_ex.source
80-
81-
return json.dumps(dict(code=cod, test=testCod))
82-
83-
84-
@get('/submit_matrix_problem.py')
85-
def submit_matrix_problem():
86-
user_code = request.query.submitted_code
87-
prob_name = request.query.problem_name
88-
assert type(prob_name) in (str, unicode)
89-
90-
# whitelist
91-
assert prob_name in ('python_comprehension-1',)
92-
93-
test_fn = 'matrix-demo/' + prob_name + '.test.py'
94-
test_cod = open(test_fn).read()
95-
96-
# concatenate!
97-
script = test_cod + '\n' + user_code + \
98-
'''
99-
import doctest
100-
(n_fail, n_tests) = doctest.testmod(verbose=False)
101-
if n_fail == 0:
102-
print("All %d tests passed!" % n_tests)
103-
'''
104-
105-
url = 'http://ec2-107-20-94-197.compute-1.amazonaws.com/cgi-bin/run_code.py'
106-
values = {'user_script' : script}
107-
108-
data = urllib.urlencode(values)
109-
req = urllib2.Request(url, data)
110-
response = urllib2.urlopen(req)
111-
the_page = response.read()
112-
return the_page
113-
114-
11561
if __name__ == "__main__":
116-
#run(host='localhost', port=8080, reloader=True)
117-
run(host='0.0.0.0', port=8003, reloader=True) # make it externally visible - DANGER this is very insecure since there's no sandboxing!
62+
run(host='localhost', port=8003, reloader=True)

0 commit comments

Comments
 (0)