MCPcopy Index your code
hub / github.com/python/cpython / poll

Function poll

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

Source from the content-addressed store, hash-verified

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

Callers 2

test_connectionMethod · 0.85
__init__Method · 0.85

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.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…