Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 0 additions & 99 deletions .github/workflows/codeql.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/ios.yml

This file was deleted.

29 changes: 17 additions & 12 deletions simple_seismic_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,22 @@
"crystallization_status": "CRYSTALLINE"
}

STATIC_ROOT_RESPONSE = json.dumps({
"service": "Genesis Seismic Log",
"version": "1.0.0",
"status": "operational",
"protocol": "S-ToT (Seismic Tree-of-Thoughts)",
"endpoints": {
"live": "/api/bench/live",
"health": "/api/health",
"seismic": "/api/seismic/status"
}
}, separators=(',', ':')).encode()

class SeismicHandler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == "/":
self.send_json({
"service": "Genesis Seismic Log",
"version": "1.0.0",
"status": "operational",
"protocol": "S-ToT (Seismic Tree-of-Thoughts)",
"endpoints": {
"live": "/api/bench/live",
"health": "/api/health",
"seismic": "/api/seismic/status"
}
})
self.send_json(STATIC_ROOT_RESPONSE)
elif self.path == "/api/health":
self.send_json({
"status": "healthy",
Expand Down Expand Up @@ -112,7 +114,10 @@ def send_json(self, data):
self.send_header('Content-Type', 'application/json')
self.send_header('Access-Control-Allow-Origin', '*')
self.end_headers()
self.wfile.write(json.dumps(data, separators=(',', ':')).encode())
if isinstance(data, bytes):
self.wfile.write(data)
else:
self.wfile.write(json.dumps(data, separators=(',', ':')).encode())
Comment on lines +117 to +120

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic in send_json can be simplified to avoid repeating the self.wfile.write() call. By first ensuring the data variable is in bytes format, you can have a single, unconditional write call at the end. This makes the method's control flow more linear and easier to follow.

        if not isinstance(data, bytes):
            data = json.dumps(data, separators=(',', ':')).encode()
        self.wfile.write(data)


def log_message(self, format, *args):
"""Override to customize logging"""
Expand Down
Loading