forked from Linux249/visiexp-server
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpythonAdapter.py
More file actions
Latest commit
37 lines (27 loc) · 886 Bytes
/
Copy pathpythonAdapter.py
File metadata and controls
37 lines (27 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## compute_input.py
importsys, json
fromembedding_dummyimportprint_graph
defformat_string(graph):
s=str(graph)
s=s.replace("'", '"').replace(': ', ':').replace('False', 'false').replace('True', 'true')\
.replace(', ', ',').replace(':u"', ':"')
returns
#Read data from stdin
defread_in():
lines=sys.stdin.readlines()
#Since our input would only be having one line, parse our JSON data from that
returnjson.loads(lines[0])
defmain():
#get our data as an array from read_in()
#lines = read_in()
#create a numpy array
#np_lines = np.array(lines)
#use numpys sum method to find sum of all elements in the array
#lines_sum = np.sum(np_lines)
lines=print_graph()
#return the sum to the output stream
#print str(lines) #lines_sum
print(lines)
#start process
if__name__=='__main__':
main()