Bläddra i källkod

auto commit

master
jfinn 2 år sedan
förälder
incheckning
8560d882e0
1 ändrade filer med 65 tillägg och 65 borttagningar
  1. 65
    65
      wsps/tasks_loop.py

+ 65
- 65
wsps/tasks_loop.py Visa fil

@@ -63,59 +63,59 @@ def callable_helper(fn):
63 63
 
64 64
 verbose = print
65 65
 class DbgMixin:
66
-    async def ws_rec(self,text_data,*a,**kw):
67
-        # if "dbg" in 
68
-        text_data_json = json.loads(text_data)
69
-        if not 'dbg' in text_data_json:
70
-            return
71
-        p("DBG!")
72
-        exec(text_data_json["dbg"])
66
+	async def ws_rec(self,text_data,*a,**kw):
67
+		# if "dbg" in 
68
+		text_data_json = json.loads(text_data)
69
+		if not 'dbg' in text_data_json:
70
+			return
71
+		p("DBG!")
72
+		exec(text_data_json["dbg"])
73 73
 class AconMixin(DbgMixin):
74 74
 # class AconMixin:
75
-    async def connect(self):
76
-        # print("-----------CONNECTING async def connect")
77
-        p("ACON!!!!!!!!!!!!!!!!!!!!!!!!!!!")
78
-        p(flush=True)
79
-        await self.accept()
80
-        verbose("<MRO")
81
-
82
-        verbose(type(self))
83
-        await self.call_all_mro("ws_conn0")
84
-        await self.call_all_mro("ws_conn")
85
-        await self.call_all_mro("ws_conn2")
86
-        verbose("/MRO>")
87
-        # await self.ws_conn_once(event)        
88
-        await self.ws_conn_once()       
89
-    async def ws_conn_once(self, *a,**kw):pass
90
-    async def ws_disconn_once(self, *a,**kw):pass
91
-    async def ws_rec_once(self, *a,**kw):pass
92
-    async def receive(self, *a,**kw):
93
-        print("REC")
94
-        print("",end="",flush=True)
95
-        # print("-----------REC")
96
-        await self.call_all_mro("ws_rec",*a,**kw)
97
-        await self.ws_rec_once(*a,**kw)
98
-
99
-    async def call_all_mro(self,mthd_name,*args,**kwargs):
100
-        called = set([None])
101
-        for cls_obj in self.__class__.__mro__:
102
-            mthd = getattr(cls_obj,mthd_name,None)
103
-            # print("~",cls_obj,mthd)
104
-            if not mthd in called:
105
-                # print(cls_obj,mthd)
106
-                called.add(mthd)
107
-                await mthd(self,*args,**kwargs) 
108
-    async def disconnect(self, close_code):
109
-        await self.call_all_mro("ws_disconn",close_code)
110
-        await self.ws_disconn_once(close_code)      
111
-    async def websocket_connect_x(self, event):
112
-        await super().websocket_connect(event)
113
-        print("<MRO")
114
-        print(type(self))
115
-        await self.call_all_mro("ws_conn",event)
116
-        await self.call_all_mro("ws_conn2",event)
117
-        print("/MRO>")
118
-        await self.ws_conn_once(event)
75
+	async def connect(self):
76
+		# print("-----------CONNECTING async def connect")
77
+		p("ACON!!!!!!!!!!!!!!!!!!!!!!!!!!!")
78
+		p(flush=True)
79
+		await self.accept()
80
+		verbose("<MRO")
81
+
82
+		verbose(type(self))
83
+		await self.call_all_mro("ws_conn0")
84
+		await self.call_all_mro("ws_conn")
85
+		await self.call_all_mro("ws_conn2")
86
+		verbose("/MRO>")
87
+		# await self.ws_conn_once(event)		
88
+		await self.ws_conn_once()	   
89
+	async def ws_conn_once(self, *a,**kw):pass
90
+	async def ws_disconn_once(self, *a,**kw):pass
91
+	async def ws_rec_once(self, *a,**kw):pass
92
+	async def receive(self, *a,**kw):
93
+		print("REC")
94
+		print("",end="",flush=True)
95
+		# print("-----------REC")
96
+		await self.call_all_mro("ws_rec",*a,**kw)
97
+		await self.ws_rec_once(*a,**kw)
98
+
99
+	async def call_all_mro(self,mthd_name,*args,**kwargs):
100
+		called = set([None])
101
+		for cls_obj in self.__class__.__mro__:
102
+			mthd = getattr(cls_obj,mthd_name,None)
103
+			# print("~",cls_obj,mthd)
104
+			if not mthd in called:
105
+				# print(cls_obj,mthd)
106
+				called.add(mthd)
107
+				await mthd(self,*args,**kwargs) 
108
+	async def disconnect(self, close_code):
109
+		await self.call_all_mro("ws_disconn",close_code)
110
+		await self.ws_disconn_once(close_code)	  
111
+	async def websocket_connect_x(self, event):
112
+		await super().websocket_connect(event)
113
+		print("<MRO")
114
+		print(type(self))
115
+		await self.call_all_mro("ws_conn",event)
116
+		await self.call_all_mro("ws_conn2",event)
117
+		print("/MRO>")
118
+		await self.ws_conn_once(event)
119 119
 
120 120
 class AclTaskMixin:
121 121
 	async def ws_conn0(self):
@@ -387,20 +387,20 @@ redis_info()
387 387
 r"""
388 388
 
389 389
 def atexit_fn():
390
-    pass
391
-    # rconn.flushall()
392
-    print("ATEXIT FN")
393
-    rinfo_len()
394
-    keys = rconn.keys()
395
-    print(keys)
396
-    print(len(keys))
397
-    print("t 000")
398
-    # time.sleep(10)
399
-    print("t 010")
400
-    # time.sleep(20)
401
-    print("t 020")
402
-    print("ATEXIT FN...")
403
-    rconn.flushall()
390
+	pass
391
+	# rconn.flushall()
392
+	print("ATEXIT FN")
393
+	rinfo_len()
394
+	keys = rconn.keys()
395
+	print(keys)
396
+	print(len(keys))
397
+	print("t 000")
398
+	# time.sleep(10)
399
+	print("t 010")
400
+	# time.sleep(20)
401
+	print("t 020")
402
+	print("ATEXIT FN...")
403
+	rconn.flushall()
404 404
 atexit.register(atexit_fn)
405 405
 
406 406
 

Laddar…
Avbryt
Spara