@@ -55,14 +55,14 @@ def __create_routing_table(x, y, partitions_in_table, routing_info):
55
55
table = UnCompressedMulticastRoutingTable (x , y )
56
56
iterator = _IteratorWithNext (partitions_in_table .items ())
57
57
while iterator .has_next :
58
- (vertex , part_id ), entry = iterator .next
58
+ (vertex , part_id ), entry = iterator .pop ()
59
59
r_info = routing_info .get_routing_info_from_pre_vertex (vertex , part_id )
60
60
if r_info is None :
61
61
raise Exception (
62
62
f"Missing Routing information for { vertex } , { part_id } " )
63
63
entries = [(vertex , part_id , entry , r_info )]
64
64
while __match (iterator , vertex , part_id , r_info , entry , routing_info ):
65
- (vertex , part_id ), entry = iterator .next
65
+ (vertex , part_id ), entry = iterator .pop ()
66
66
r_info = routing_info .get_routing_info_from_pre_vertex (
67
67
vertex , part_id )
68
68
entries .append ((vertex , part_id , entry , r_info ))
@@ -71,9 +71,6 @@ def __create_routing_table(x, y, partitions_in_table, routing_info):
71
71
for entry in __merged_keys_and_masks (entries , routing_info ):
72
72
table .add_multicast_routing_entry (entry )
73
73
74
- for source_vertex , partition_id in partitions_in_table :
75
- entry = partitions_in_table [source_vertex , partition_id ]
76
-
77
74
return table
78
75
79
76
@@ -82,7 +79,7 @@ def __match(iterator, vertex, part_id, r_info, entry, routing_info):
82
79
return False
83
80
if isinstance (vertex , ApplicationVertex ):
84
81
return False
85
- (next_vertex , next_part_id ), next_entry = iterator .peek
82
+ (next_vertex , next_part_id ), next_entry = iterator .peek ()
86
83
if isinstance (next_vertex , ApplicationVertex ):
87
84
return False
88
85
if part_id != next_part_id :
@@ -128,18 +125,6 @@ def __merged_keys_and_masks(entries, routing_info):
128
125
yield from app_r_info .merge_machine_entries (entries )
129
126
130
127
131
- def __create_entry (key_and_mask , entry ):
132
- """
133
- :param BaseKeyAndMask key_and_mask:
134
- :param MulticastRoutingTableByPartitionEntry entry:
135
- :rtype: MulticastRoutingEntry
136
- """
137
- return MulticastRoutingEntry (
138
- routing_entry_key = key_and_mask .key_combo ,
139
- defaultable = entry .defaultable , mask = key_and_mask .mask ,
140
- link_ids = entry .link_ids , processor_ids = entry .processor_ids )
141
-
142
-
143
128
class _IteratorWithNext (object ):
144
129
145
130
def __init__ (self , iterable ):
@@ -151,16 +136,14 @@ def __init__(self, iterable):
151
136
self .__next = None
152
137
self .__has_next = False
153
138
154
- @property
155
139
def peek (self ):
156
140
return self .__next
157
141
158
142
@property
159
143
def has_next (self ):
160
144
return self .__has_next
161
145
162
- @property
163
- def next (self ):
146
+ def pop (self ):
164
147
if not self .__has_next :
165
148
raise StopIteration
166
149
nxt = self .__next
0 commit comments