Przeglądaj źródła

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

master
Pete Shadbolt 9 lat temu
rodzic
commit
682e630353
6 zmienionych plików z 8 dodań i 8 usunięć
  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 Wyświetl plik


+ 4
- 4
abp/server.py Wyświetl plik

@@ -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 Wyświetl plik

@@ -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 Wyświetl plik

@@ -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 Wyświetl plik

@@ -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 Wyświetl plik

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






Ładowanie…
Anuluj
Zapisz