Commits

Benoit Boissinot committed 53630ea

cleanup

  • Participants
  • Parent commits 3cb0dbf

Comments (0)

Files changed (1)

src/discovery_tonfa.py

 import random
 from testing import DiscoveryTests, assertnodes
 
-
-def constskipfn(skip):
-    def skipfn():
-        return skip
-    return skipfn
+MAX_SAMPLE = 200
 
 class Config(object):
 
     return i
 
 def clever_sample(dag, nodes, stop):
-    if len(nodes) < 200:
+    if len(nodes) < MAX_SAMPLE:
         return set(nodes)
     heads = dag.headsof(nodes)
     sample = set()
 
     assert sample
     sample.difference_update(heads)
-    if len(sample)+len(heads) > 200:
-        sample = set(random.sample(sample, 200-len(heads)))
+    if len(sample)+len(heads) > MAX_SAMPLE:
+        sample = set(random.sample(sample, MAX_SAMPLE-len(heads)))
     sample.update(heads)
     return sample
 
         allcommon = self.dag.nodeset(list(common))
         allremain = nodes - allcommon
         self.writer.show("server remaining: %i" % len(allremain))
-        remain = len(allremain) < 200 and allremain or set()
+        remain = len(allremain) < MAX_SAMPLE and allremain or set()
 
         return common, remain
 
 
         self.writer.section("traffic", quiesce=notraffic)
         actual = c.common(s)
-        print "common:", len(actual)
         self.writer.unindent()
         assertnodes(self.expected, actual)