123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- import asyncio
- import time
-
- import redis
-
- import os
- import copy
- import json
-
- import traceback
- import inspect
-
-
- '''
- umod
- # '''
-
- p=print
-
- async def anop(*a,**kw):pass
- def nop(*a,**kw):pass
-
- def connect_redis():
- return redis.Redis(host='localhost', port=6379, db=0,charset="utf-8", decode_responses=True, encoding_errors="backslashreplace")
-
-
- '''
- # '''
-
-
- class AclTaskMixin:
- async def ws_conn0(self):
- glob_cl.init_gcl(self)
- print("++++++++++++++++++++++++++")
- # oinfo(glob_cl)
- async def ws_conn_once(self,*a,**kw):
- print("\t\tws_conn_once:","AclTaskMixin")
-
-
-
-
- # GCLMixin
- class globCL():
- def __init__(self,*a,**kw):
- # for now we are not going to do any weird class stuff
- self.r = connect_redis()
- pass
- async def persistent_loop(self,*a,**kw):
- pass
- def run_persistent_loop(self,*a,**kw):
- pass
-
- # RldManMixin
- class RldMan():
- def __init__(self,*a,**kw):
- base_path = "/usr/games/repos/ign4/py_rld/djc/rdir1/"
- self.files = [
- base_path+"",
- ]
- def add_files(self,files):
- for file in files:
- if type(file)==str:
- self.add_file(file)
- elif type(file)==list:
- self.add_file(*file)
- else:
- p("add files???",file)
- def add_file(self,file_name,fnx={}):
- self.files[file_name] = {"ftxt":"",**fnx}
-
-
-
- glob_cl = globCL()
-
-
-
-
-
-
-
- # print("..",end="\n",flush=True)
-
- def redis_info():
- rconn = glob_cl.r
- keys = rconn.keys()
- for k in keys:
- p(":",k)
-
- p("len(keys)",len(keys))
- print("",end="",flush=True)
- # rconn.flushall()
- redis_info()
- r"""
-
- def atexit_fn():
- pass
- # rconn.flushall()
- print("ATEXIT FN")
- rinfo_len()
- keys = rconn.keys()
- print(keys)
- print(len(keys))
- print("t 000")
- # time.sleep(10)
- print("t 010")
- # time.sleep(20)
- print("t 020")
- print("ATEXIT FN...")
- rconn.flushall()
- atexit.register(atexit_fn)
-
-
-
- # """
|