MCPcopy Index your code
hub / github.com/RustPython/RustPython / poll

Function poll

Lib/test/support/asyncore.py:141–178  ·  view source on GitHub ↗
(timeout=0.0, map=None)

Source from the content-addressed store, hash-verified

139 obj.handle_error()
140
141def poll(timeout=0.0, map=None):
142 if map is None:
143 map = socket_map
144 if map:
145 r = []; w = []; e = []
146 for fd, obj in list(map.items()):
147 is_r = obj.readable()
148 is_w = obj.writable()
149 if is_r:
150 r.append(fd)
151 # accepting sockets should not be writable
152 if is_w and not obj.accepting:
153 w.append(fd)
154 if is_r or is_w:
155 e.append(fd)
156 if [] == r == w == e:
157 time.sleep(timeout)
158 return
159
160 r, w, e = select.select(r, w, e, timeout)
161
162 for fd in r:
163 obj = map.get(fd)
164 if obj is None:
165 continue
166 read(obj)
167
168 for fd in w:
169 obj = map.get(fd)
170 if obj is None:
171 continue
172 write(obj)
173
174 for fd in e:
175 obj = map.get(fd)
176 if obj is None:
177 continue
178 _exception(obj)
179
180def poll2(timeout=0.0, map=None):
181 # Use the poll() support added to the select module in Python 2.0

Callers 2

test_connectionMethod · 0.50
__init__Method · 0.50

Calls 11

listClass · 0.85
_exceptionFunction · 0.85
readFunction · 0.70
writeFunction · 0.70
itemsMethod · 0.45
readableMethod · 0.45
writableMethod · 0.45
appendMethod · 0.45
sleepMethod · 0.45
selectMethod · 0.45
getMethod · 0.45

Tested by 1

test_connectionMethod · 0.40