[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Fix typos and clean up as suggested by pychecker.



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv2093/lib/mixminion

Modified Files:
	ClientDirectory.py ServerInfo.py ClientMain.py 
Log Message:
Fix typos and clean up as suggested by pychecker.

Index: ClientDirectory.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientDirectory.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ClientDirectory.py	9 Oct 2003 15:26:15 -0000	1.4
+++ ClientDirectory.py	13 Oct 2003 17:30:24 -0000	1.5
@@ -365,7 +365,6 @@
 
         for info, where in self.serverList:
             nn = info.getNickname().lower()
-            keyid = info.getKeyID()
             lists = [ self.allServers, self.byNickname.setdefault(nn, []),
                       self.byKeyID.setdefault(info.getKeyID(), []) ]
             for c in info.getCaps():
@@ -434,7 +433,7 @@
         return u.values()
 
     def getNicknameByKeyID(self, keyid):
-        s = self.bykeyID.get(keyid)
+        s = self.byKeyID.get(keyid)
         if not s:
             return None
         r = []
@@ -444,14 +443,11 @@
         return "/".join(r)
 
     def getNameByRelay(self, routingType, routingInfo):
-        assert routingType in (mixminion.Packet.FWD_IPV4_TYPE,
-                               mixminion.Packet.SWAP_FWD_IPV4_TYPE)
-        if type(routingInfo) == types.StringType:
-            routingInfo = mixminion.Packet.parseIPV4Info(routingInfo)
-        assert isinstance(routingInfo, mixminion.Packet.IPV4Info)
-        nn = self.getNicknameByKeyID(self, routingInfo.keyinfo)
+        routingInfo = mixminion.Packet.parseRelayInfoByType(
+            routingType, routingInfo)
+        nn = self.getNicknameByKeyID(routingInfo.keyinfo)
         if nn is None:
-            return "%s:%s"%(routingInfo.ip, routingInfo.port)
+            return routingInfo.format()
         else:
             return nn
 
@@ -619,16 +615,6 @@
            The path selection algorithm perfers to choose without
            replacement it it can.
         """
-        def setSub(s1, s2):
-            """Helper function. Given two lists of serverinfo, returns all
-               members of s1 that are not members of s2.  ServerInfos are
-               considered equivalent if their nicknames are the same,
-               ignoring case.
-            """
-            n = [ inf.getNickname().lower() for inf in s2 if inf is not None ]
-            return [ inf for inf in s1 
-                     if inf is not None and inf.getNickname().lower() not in n]
-
         # Fill in startAt, endAt, prng if not provided
         if startAt is None:
             startAt = time.time()

Index: ServerInfo.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ServerInfo.py,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- ServerInfo.py	9 Oct 2003 15:26:16 -0000	1.57
+++ ServerInfo.py	13 Oct 2003 17:30:24 -0000	1.58
@@ -292,7 +292,7 @@
             rt = mixminion.Packet.SWAP_FWD_IPV4_TYPE
         else:
             rt = mixminion.Packet.FWD_IPV4_TYPE
-        ri = other.getRoutingInfo().pack()
+        ri = otherDesc.getRoutingInfo().pack()
         return rt, ri
         
     def getCaps(self):

Index: ClientMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientMain.py,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- ClientMain.py	9 Oct 2003 15:26:15 -0000	1.119
+++ ClientMain.py	13 Oct 2003 17:30:24 -0000	1.120
@@ -11,7 +11,6 @@
 
 import getopt
 import os
-import socket
 import sys
 import time
 from types import ListType