@@ -111,12 +111,12 @@ def maybeAddStem(self, connection, invQueue):
111111 with self .lock :
112112 if len (self .stem ) < MAX_STEMS :
113113 self .stem .append (connection )
114- for k in (k for k , v in self .nodeMap .iteritems () if v is None ):
114+ for k in (k for k , v in self .nodeMap .items () if v is None ):
115115 self .nodeMap [k ] = connection
116116 for k , v in {
117- k : v for k , v in self .hashMap .iteritems ()
117+ k : v for k , v in self .hashMap .items ()
118118 if v .child is None
119- }.iteritems ():
119+ }.items ():
120120 self .hashMap [k ] = Stem (
121121 connection , v .stream , self .poissonTimeout ())
122122 invQueue .put ((v .stream , k , v .child ))
@@ -132,14 +132,14 @@ def maybeRemoveStem(self, connection):
132132 self .stem .remove (connection )
133133 # active mappings to pointing to the removed node
134134 for k in (
135- k for k , v in self .nodeMap .iteritems ()
135+ k for k , v in self .nodeMap .items ()
136136 if v == connection
137137 ):
138138 self .nodeMap [k ] = None
139139 for k , v in {
140- k : v for k , v in self .hashMap .iteritems ()
140+ k : v for k , v in self .hashMap .items ()
141141 if v .child == connection
142- }.iteritems ():
142+ }.items ():
143143 self .hashMap [k ] = Stem (
144144 None , v .stream , self .poissonTimeout ())
145145
@@ -180,7 +180,7 @@ def expire(self, invQueue):
180180 with self .lock :
181181 deadline = time ()
182182 toDelete = [
183- [v .stream , k , v .child ] for k , v in self .hashMap .iteritems ()
183+ [v .stream , k , v .child ] for k , v in self .hashMap .items ()
184184 if v .timeout < deadline
185185 ]
186186
@@ -199,10 +199,10 @@ def reRandomiseStems(self):
199199 try :
200200 # random two connections
201201 self .stem = sample ( # nosec B311
202- self .pool .outboundConnections .values (), MAX_STEMS )
202+ list ( self .pool .outboundConnections .values () ), MAX_STEMS )
203203 # not enough stems available
204204 except ValueError :
205- self .stem = self .pool .outboundConnections .values ()
205+ self .stem = list ( self .pool .outboundConnections .values () )
206206 self .nodeMap = {}
207207 # hashMap stays to cater for pending stems
208208 self .refresh = time () + REASSIGN_INTERVAL
0 commit comments