|
9 | 9 | import os
|
10 | 10 | import select
|
11 | 11 | import socket
|
| 12 | +import random |
12 | 13 | import sys
|
13 | 14 | import time
|
14 | 15 | import warnings
|
|
19 | 20 | )
|
20 | 21 | from threading import current_thread
|
21 | 22 |
|
22 |
| -import helper_random |
23 | 23 |
|
24 | 24 | try:
|
25 | 25 | from errno import WSAEWOULDBLOCK
|
@@ -233,13 +233,13 @@ def select_poller(timeout=0.0, map=None):
|
233 | 233 | if err.args[0] in (WSAENOTSOCK, ):
|
234 | 234 | return
|
235 | 235 |
|
236 |
| - for fd in helper_random.randomsample(r, len(r)): |
| 236 | + for fd in random.sample(r, len(r)): |
237 | 237 | obj = map.get(fd)
|
238 | 238 | if obj is None:
|
239 | 239 | continue
|
240 | 240 | read(obj)
|
241 | 241 |
|
242 |
| - for fd in helper_random.randomsample(w, len(w)): |
| 242 | + for fd in random.sample(w, len(w)): |
243 | 243 | obj = map.get(fd)
|
244 | 244 | if obj is None:
|
245 | 245 | continue
|
@@ -297,7 +297,7 @@ def poll_poller(timeout=0.0, map=None):
|
297 | 297 | except socket.error as err:
|
298 | 298 | if err.args[0] in (EBADF, WSAENOTSOCK, EINTR):
|
299 | 299 | return
|
300 |
| - for fd, flags in helper_random.randomsample(r, len(r)): |
| 300 | + for fd, flags in random.sample(r, len(r)): |
301 | 301 | obj = map.get(fd)
|
302 | 302 | if obj is None:
|
303 | 303 | continue
|
@@ -357,7 +357,7 @@ def epoll_poller(timeout=0.0, map=None):
|
357 | 357 | if err.args[0] != EINTR:
|
358 | 358 | raise
|
359 | 359 | r = []
|
360 |
| - for fd, flags in helper_random.randomsample(r, len(r)): |
| 360 | + for fd, flags in random.sample(r, len(r)): |
361 | 361 | obj = map.get(fd)
|
362 | 362 | if obj is None:
|
363 | 363 | continue
|
@@ -420,7 +420,7 @@ def kqueue_poller(timeout=0.0, map=None):
|
420 | 420 |
|
421 | 421 | events = kqueue_poller.pollster.control(updates, selectables, timeout)
|
422 | 422 | if len(events) > 1:
|
423 |
| - events = helper_random.randomsample(events, len(events)) |
| 423 | + events = random.sample(events, len(events)) |
424 | 424 |
|
425 | 425 | for event in events:
|
426 | 426 | fd = event.ident
|
|
0 commit comments