@@ -28,11 +28,12 @@ def random_path_to_exit(exit_relay, relays):
2828 return candidate_relays [0 :2 ] + [exit_relay ]
2929
3030
31+ # pylint: disable=no-member
3132class CircuitGenerator (object ):
3233 def __init__ (self , state ):
3334 self .state = state
3435 # FIXME: don't we want to remove the exits from the list of relays?
35- self .relays = list (set (r for r in state .routers .values () if r ))
36+ self .relays = list (set (r for r in list ( state .routers .values () ) if r ))
3637 self .exits = [relay for relay in self .relays if is_valid_exit (relay )]
3738
3839 def __iter__ (self ):
@@ -41,7 +42,11 @@ def __iter__(self):
4142 def next (self ):
4243 raise NotImplementedError
4344
45+ def __next__ (self ):
46+ return self .next ()
4447
48+
49+ # pylint: disable=no-member
4550class TwoHop (CircuitGenerator ):
4651 """
4752 Select two hop circuits with the relay to be measured and a random exit
@@ -63,7 +68,7 @@ def circuit_generator():
6368 choose an exit relay of similar bandwidth for the circuit
6469 """
6570 num_relays = len (self .relays )
66- relay_subset = range (this_partition - 1 , num_relays , partitions )
71+ relay_subset = list ( range (this_partition - 1 , num_relays , partitions ) )
6772 log .info ("Performing a measurement scan with {count} relays." , count = len (relay_subset ))
6873
6974 # Choose relays in a random order fromm the relays in this partition set.
@@ -108,3 +113,6 @@ def exit_by_bw(self, relay):
108113
109114 def next (self ):
110115 return self ._circgen .next ()
116+
117+ def __next__ (self ):
118+ return self .next ()
0 commit comments