From a73acb9b474ce77af4bc54657d32bd2714ce53ec Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 28 Jun 2021 12:22:48 +0200 Subject: Cleanup binaries --- i3/bin/cloogle_stats.py | 50 ------------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100755 i3/bin/cloogle_stats.py (limited to 'i3/bin/cloogle_stats.py') diff --git a/i3/bin/cloogle_stats.py b/i3/bin/cloogle_stats.py deleted file mode 100755 index a572207..0000000 --- a/i3/bin/cloogle_stats.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python3 -import json -import ssl -import sys -import time -import websocket - -def print_and_flush(s): - print(s) - sys.stdout.flush() - -def format_query(query): - if 'className' in query: - return 'class ' + query['className'] - elif 'typeName' in query: - return 'type ' + query['typeName'] - elif 'unify' in query: - if 'name' in query and query['name'] != '': - return query['name'] + ' :: ' + query['unify'] - else: - return ':: ' + query['unify'] - else: - return query['name'] - -def on_message(ws, msg): - try: - print_and_flush(format_query(json.loads(msg))) - except: - pass - -def on_open(ws): - print_and_flush('Opened connection.') - -def on_error(ws, err): - print_and_flush(err) - -def on_close(ws): - print_and_flush('Lost connection.') - time.sleep(3) - start() - -def start(): - ws = websocket.WebSocketApp('wss://cloogle.org:31216', - subprotocols=['cloogle-stats'], - on_message=on_message, - on_open=on_open, on_error=on_error, on_close=on_close) - ws.run_forever(sslopt={'cert_reqs': ssl.CERT_NONE}) - -if __name__ == '__main__': - start() -- cgit v1.2.3