소스 검색

Oh my god sys.path[0] is so good

master
Pete Shadbolt 9 년 전
부모
커밋
682e630353
6개의 변경된 파일8개의 추가작업 그리고 8개의 파일을 삭제
  1. +0
    -0
      abp/graphstate.py
  2. +4
    -4
      abp/server.py
  3. +1
    -1
      abp/viz.py
  4. +1
    -1
      tests/test_graph.py
  5. +1
    -1
      tests/test_json.py
  6. +1
    -1
      tests/test_viz.py

abp/graph.py → abp/graphstate.py 파일 보기


+ 4
- 4
abp/server.py 파일 보기

@@ -7,7 +7,7 @@ import json
import threading import threading
import time import time
import os import os
from graph import GraphState
from graphstate import GraphState




class VizHandler(SimpleHTTPRequestHandler): class VizHandler(SimpleHTTPRequestHandler):
@@ -18,7 +18,7 @@ class VizHandler(SimpleHTTPRequestHandler):
SimpleHTTPRequestHandler.__init__(self, *args, **kwargs) SimpleHTTPRequestHandler.__init__(self, *args, **kwargs)


def get_state(self): def get_state(self):
""" Get the current graph state """
""" Get the current graphstate state """
self.send_response(200) self.send_response(200)
self.send_header('Content-Type', 'application/json') self.send_header('Content-Type', 'application/json')
self.end_headers() self.end_headers()
@@ -77,13 +77,13 @@ def demograph():




if __name__ == '__main__': if __name__ == '__main__':
os.chdir("/home/pete/physics/abp/static")
where = os.path.join(sys.path[0], "../static")
os.chdir(where)
server = Server() server = Server()
server.start() server.start()


g = demograph() g = demograph()



while True: while True:
server.update(g) server.update(g)
time.sleep(1) time.sleep(1)


+ 1
- 1
abp/viz.py 파일 보기

@@ -2,7 +2,7 @@ import networkx as nx
from matplotlib import pyplot as plt from matplotlib import pyplot as plt
import clifford import clifford
import numpy as np import numpy as np
from graph import GraphState
from graphstate import GraphState


VOP_COLORS = ["red", "green", "blue", "orange", "yellow", "purple", "black", "white"] VOP_COLORS = ["red", "green", "blue", "orange", "yellow", "purple", "black", "white"]




+ 1
- 1
tests/test_graph.py 파일 보기

@@ -1,4 +1,4 @@
from abp.graph import GraphState, DiffedGraphState
from abp.graphstate import GraphState, DiffedGraphState
from abp import clifford from abp import clifford
import time import time




+ 1
- 1
tests/test_json.py 파일 보기

@@ -1,4 +1,4 @@
from abp.graph import GraphState, DiffedGraphState
from abp.graphstate import GraphState, DiffedGraphState
from abp import clifford from abp import clifford
import time import time
import json import json


+ 1
- 1
tests/test_viz.py 파일 보기

@@ -1,4 +1,4 @@
from abp.graph import GraphState
from abp.graphstate import GraphState
from abp import viz from abp import viz






불러오는 중...
취소
저장