예제 #1
0
파일: main.py 프로젝트: gazzlab/neuropost
def as_json(w):
  '''
  Return the current state of the World object w as a JSON string.
  Functions are converted to JS objects containing the functions' names.
  '''
  stack, dictionary = w.getCurrentState()
  dictionary = list(name for name, function in items(dictionary))
  return json.dumps((stack, dictionary), default=_p, indent=2)
예제 #2
0
파일: shim.py 프로젝트: calroc/aum-gravity
def as_json(w=W):
  stack, dictionary = w.getCurrentState()
  dictionary = list(name for name, function in items(dictionary))
  return json.dumps((stack, dictionary), default=p, indent=2)