123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- # /usr/games/repos/ign4/dcc/r1.py
- import json
- from channels.exceptions import (
- AcceptConnection,
- DenyConnection,
- InvalidChannelLayerError,
- StopConsumer,
- )
-
-
- print("a2")
-
-
-
-
- def rfo(l,g):
- pass
- print("l",l.keys())
- print("g",g.keys())
- # print("l2",locals().keys())
- # print("g2",globals().keys())
-
-
- rfo(locals(),globals())
-
- def class_edit(klass,_klass):
- print("\n")
- print(klass,_klass)
- for en in dir(_klass):
- if en[:2]=="__":continue
- attr = getattr(_klass,en,"NO ATTR")
- print("\t",en)
- setattr(klass,en,attr)
-
- def class_reset(klass):
- print("\n")
- # print(klass,_klass)
- print("class reset:", klass)
- for en in dir(klass):
- if en[:2]=="__":continue
- attr = getattr(klass,en,"NO ATTR")
- # print("\t",en,attr)
- # setattr(klass,en,attr)
- delattr(klass,en)
-
- def class_info(klass):
- print("\n")
- # print(klass,_klass)
- print(klass)
- for en in dir(klass):
- if en[:2]=="__":continue
- attr = getattr(klass,en,"NO ATTR")
- print("\t",en,attr)
- # setattr(klass,en,attr)
- # delattr(klass,en,attr)
-
-
-
-
- class rldDevMixin:
- pass
- async def ws_conn(self):
- #
- # r'''
- await self.channel_layer.group_add(
- # self.room_group_name,
- "rld_dev",
- self.channel_name
- )
-
- async def gs2(self,*a,**kw):
- p("gs2",self,a,kw)
- p(end="",flush=True)
- async def gs1(self,*a,**kw):
- #
- # r'''
-
-
- await self.channel_layer.group_send(
- "rld_dev",
- # "all",
- # r'''
- {
- 'type': 'rjsend_dev',
- # 'type': 'txt_send',
- # 'type': 'gs2',
- 'message': "message",
- # 'm2': message,
- }
- # '''
- )
-
-
- # '''
- pass
- async def d1(self,*a,**kw):
- print("d1",self,*a,**kw)
- async def xr2(self,*a,**kw):
- file_name="/usr/games/repos/ign4/dcc/r2.py"
- try:
- pass
- f = open(file_name,"r")
- ftxt = f.read()
- f.close()
-
- exec(ftxt,globals(),locals())
- except Exception as e:
- # raise
- print("EXCEPT",e)
- else:
- pass
- finally:
- print(end="",flush=True)
- pass
- async def rjsend_dev(self, event,*a,**kw):
- p("rjsend_dev",self,event,a,kw,flush=True)
- # p(self.send)
- p(end="",flush=True)
- await self.send(text_data=json.dumps({"a":1}))
- return
- obj = event['obj']
- # p(end="",flush=True)
- await self.send(text_data=json.dumps(obj))
-
- async def dm(self,*a,**kw):
- cn = ['specific.4d1895f69485401ea104a79fb97fc4ed!14a5b515b29b4a559cf40da9fd33ac02', 'specific.4d1895f69485401ea104a79fb97fc4ed!fcf274e2246545f9917b8a214a1129d6']
- # p("DM",self.channel_name,self,a,kw)
- p("DM",self.channel_name,a,kw)
-
- p(end="",flush=True)
-
- await self.channel_layer.send(
- cn[1],
- # "all",
- # r'''
- {
- # 'type': 'rjsend_dev',
- 'type': 'dm3',
- # 'type': 'txt_send',
- # 'type': 'gs2',
- 'message': "message",
- # 'm2': message,
- }
- # '''
- )
-
- pass
- async def dm2(self,*a,**kw):
- p("DM2",self.channel_name,a,kw)
- # p("DM2",self,a,kw)
- p(end="",flush=True)
- async def err(self,*a,**kw):
- p("ERR",self.channel_name,a,kw)
- # p("DM2",self,a,kw)
-
- p(end="",flush=True)
- # raise StopConsumer()
- print("ERR...")
- raise "StopConsumer()"
- # raise StopConsumer()
-
- async def err2(self,*a,**kw):
- p("ERR",self.channel_name,a,kw)
- # p("DM2",self,a,kw)
-
- p(end="",flush=True)
- raise "StopConsumer"
- async def info(self,*a,**kw):
- # p("ERR",self.channel_name,a,kw)
- # p("DM2",self,a,kw)
- oinfo(self)
- p(self.websocket_disconnect)
- p(self.groups)
-
- p(end="",flush=True)
- # raise ""
-
-
- async def ws_disconn(self,*a,**kw):
- print("WS_DISCONN:",self,*a,**kw)
- p(end="",flush=True)
- # raise "z"
-
-
-
-
- # soidj
-
-
-
-
-
-
-
- def force_list(obj):
- if type(obj) == type([]):
- return obj
- else:
- return [obj]
-
- def red_info():
- p("red_info")
- p(glob_cl.rconn.keys())
-
- def gkeys(patrn):
- keys = r.keys(patrn)
- get_(keys)
- def get_(keys):
- keys = force_list(keys)
- for en in keys:
- keytype = r.type(en)
- print(en,keytype)
- if keytype == "string":
- print(en,r.get(en))
- elif keytype == "list":
- print(en,r.lrange(en,0,-1))
-
- elif keytype == "hash":
- print(en,r.hgetall(en))
-
- elif keytype == "set":
- print(en,r.smembers(en))
-
- elif keytype == "zset":
- print(en,r.zrange(en,0,-1))
-
- p()
-
- # oinfo(glob_cl.acl)
- # p(type(glob_cl.acl))
- # oinfo(type(glob_cl.acl))
- # oinfo(glob_cl.acl.group_send)
-
- p(glob_cl.acl.group_send)
- p(glob_cl.acl.group_add)
- p(glob_cl.acl.connection)
- p(glob_cl.acl.consistent_hash)
- # p(glob_cl.rman.add_file("/usr/games/repos/ign4/dcc/r1_.py"))
- # p(glob_cl.rman.add_file("/usr/games/repos/ign4/dcc/group_send_mod.py"))
- # p(glob_cl.rman.add_file("/usr/games/repos/ign4/dcc/mthd_info.py"))
- # p(glob_cl.rman.add_file("/usr/games/repos/ign4/dcc/r4.py"))
-
-
- def dt():
- c=0
- d={"c":1,"z":1}
- # del d["z"]
- for k in d:
- p(k,c)
- d["b"]=2
- del d["z"]
- p("...")
-
-
- p()
- # dt()
- # oinfo(glob_cl)
-
- oinfo(glob_cl.acl)
- # p(glob_cl.acl.group_send)
- # p(dir(glob_cl.acl.group_send))
- # p(dir(glob_cl.acl.group_send.__code__))
- # p(glob_cl.acl.group_send.__code__)
- # p(oinfo(glob_cl.acl.group_send.__code__))
- # p(glob_cl.acl.group_send.__code__)
- # p(dir(glob_cl.acl.group_send.__func__))
- # p((glob_cl.acl.group_send.__func__))
- def read_file_dev():
- f=open("/usr/games/envs/dj/lib/python3.8/site-packages/channels_redis/core.py","r")
- ftxt = f.read()
- f.close()
- p(ftxt)
- # read_file_dev()
- global r
- r = glob_cl.rconn
- r'''
- p("")
- red_info()
-
- # p("")
- get_(r.keys())
- p("........")
- p(dir(glob_cl.acl))
- '''
- get_(r.keys())
- # def oinfo
- # glob_cl'
-
- p(";")
-
- # class_reset(DevMixin)
- class_reset(DevMixin)
- class_edit(DevMixin,rldDevMixin)
- # class_info(DevMixin)
- # class_info
- p()
-
-
-
|