Browse Source

cleanup pylint unused_var, fix:cursesDummy

micha 2 days ago
parent
commit
f0bb8a4b6c
1 changed files with 16 additions and 19 deletions
  1. 16 19
      ArtNetProcessor.py

+ 16 - 19
ArtNetProcessor.py

@@ -94,7 +94,7 @@ def memcachd_index_clear():
 
 memcachd_index_clear()
 
-def update_memcachd_index(key,val="",active=-1):
+def update_memcachd_index(key,active=-1): # val=""
     try:
         _index =  mc.get("index")
         #print("A",_index)
@@ -115,7 +115,8 @@ def update_memcachd_index(key,val="",active=-1):
 if mc:
     INDEX="index-artpoll"
     mc.set(INDEX ,{})
-def update_mc_artpoll_index(key,val=""):
+
+def update_mc_artpoll_index(key): #,val=""):
     try:
         INDEX="index-artpoll"
         _index =  mc.get(INDEX)
@@ -136,7 +137,7 @@ def update_mc_artpoll_index(key,val=""):
 
 def count_active_dmx_ch(dmx):
     active = 0
-    for i,v in enumerate(dmx):
+    for _,v in enumerate(dmx):
         if type(v) is int and v>=1:
             if active < 0:
                 active = 0
@@ -170,6 +171,8 @@ class CursesDummy():
     def inp(self):
         return ""
         pass
+    def loop(self,**args):
+        pass
     def read(self):
         pass
     def clear(self):
@@ -246,8 +249,6 @@ class Window():
         self.clear()
         curses.beep()
 
-        frame = 10
-        i = 0
     def addstr(self,x,y,txt):
         self.myscreen.addstr(x, y, txt ) #zeile,spalte,text
     
@@ -493,7 +494,7 @@ class Window():
                 host=""
                 univ2=""
                 info=self.ohost.info()
-                jinfo = ""
+
                 for i in info:
                     xl = json.dumps(i) + "=======X " # live
                     lines.append( xl )
@@ -524,7 +525,7 @@ class Window():
             lines.insert(0,tmp)
 
             tmp = ""
-            sel_univ_data = self.sel_univ.data
+            #sel_univ_data = self.sel_univ.data
             #sel_univ_data.sort()
             tmp += " univ:"+ (str(self.sel_univ.data))#.ljust(20," "))
             tmp += " list:"+ (str(self.sel_host.data))#.ljust(20," "))
@@ -545,7 +546,7 @@ class UniversBuffer():
         self.__universes_flag = {}
         self.__universes_x_frames = {}
         self.__universes_x_time = {}
-        self.__universes_count = {}
+        #self.__universes_count = {}
         self.__universes_timer = {} 
         self.__universes_matrix = ["."]*512 
         self.__universes_info = {}
@@ -643,7 +644,7 @@ class UniversBuffer():
                 v = self.__universes_dmx[host][i]
                 dmx[i] = v
         return dmx
-    def get_mtx(self,host=""):
+    def get_mtx(self):#,host=""):
         return self.__universes_matrix
     def info(self):
         return self.__universes_info
@@ -658,7 +659,7 @@ class HostBuffer():
     def __init__(self):
         """buffer hosts and route data into universes
         """
-        self.__hosts = [] # LTP order
+        #self.__hosts = [] # LTP order
         self.__universes = OrderedDict() # {} # 192.168.0.1 = [0]*512
         #self.update(host="localhost",univ=0,dmxframe=[6]*512)
         dmxframe = [0]*512
@@ -716,7 +717,6 @@ x = os.popen("ip netns identify $$")
 xx = x.read()
 if xx:
     netns = xx.strip()
-import errno
 import fcntl  # socket control
 
 
@@ -748,7 +748,7 @@ def ArtPollCheck(data,addr):
          try:
                k = "{}:{}".format(addr[0],opcode[0])
                mc.set(k, data)
-               update_mc_artpoll_index(k,val="")
+               update_mc_artpoll_index(k) #,val="")
          except Exception as e:
                print("ArtPollCheck err:",e)
 
@@ -846,7 +846,7 @@ class IN_Socket():
                 self.univ = -1
                 try:
                     self.head = struct.unpack("!8sHBBBBHBB" , head )
-                except Exception as e:
+                except: # Exception as e:
                     pass#print( "======E09823" , e)
 
 
@@ -862,6 +862,7 @@ class IN_Socket():
                 elif not options.recive:
                     self.__poll = 1
                     return 1
+
                 elif self.host.startswith(options.recive): 
                     self.__poll = 1
                     return 1
@@ -886,7 +887,7 @@ class IN_Socket():
                     print('recv timed out, retry later')
                 else:
                     print(e)
-            except socket.error as e:
+            except: # socket.error as e:
                 pass
     
     def recive(self):
@@ -905,7 +906,6 @@ class IN_Socket():
 # ============================================================   
 
 
-import random
 import socket
 import struct
 import time
@@ -1125,6 +1125,7 @@ class Main():
         ohost = HostBuffer()
         
         screen=Window()
+        #screen=CursesDummy()
         screen.exit()
         screen.ohost = ohost
                 
@@ -1140,7 +1141,6 @@ class Main():
         #ysocket = Socket(bind='127.0.0.1' ,port=6555)
         in_socket = IN_Socket()
 
-        xt = time.time()
         ohost_buf = {}
         ohost_timer = Timer(1/30.,start=0) # 0.03333
         send_timer = Timer(1/30.) # 0.03333
@@ -1153,7 +1153,6 @@ class Main():
                 #artnet_out._test_frame()
                 #if in_socket.poll():
                 while in_socket.poll():
-                    xt = time.time()
                     poll_flag = 1
                     x = in_socket.recive()
                     if x["host"] == options.recive:
@@ -1203,13 +1202,11 @@ class Main():
 
                     #x=ohost.get(univ=univ2)
                     info=ohost.info()
-                    jinfo = ""
 
                     for i in info:
                         univ = i
                         if str(univ) == "54":
                             break
-                        xl = json.dumps(univ) + "======= " #XX
                         ltp=ohost.get(univ=i)
                         
                         try: