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

Method select

Lib/selectors.py:540–561  ·  view source on GitHub ↗
(self, timeout=None)

Source from the content-addressed store, hash-verified

538 return key
539
540 def select(self, timeout=None):
541 timeout = None if timeout is None else max(timeout, 0)
542 # If max_ev is 0, kqueue will ignore the timeout. For consistent
543 # behavior with the other selector classes, we prevent that here
544 # (using max). See https://bugs.python.org/issue29255
545 max_ev = self._max_events or 1
546 ready = []
547 try:
548 kev_list = self._selector.control(None, max_ev, timeout)
549 except InterruptedError:
550 return ready
551
552 fd_to_key_get = self._fd_to_key.get
553 for kev in kev_list:
554 fd = kev.ident
555 flag = kev.filter
556 key = fd_to_key_get(fd)
557 if key:
558 events = ((flag == select.KQ_FILTER_READ and EVENT_READ)
559 | (flag == select.KQ_FILTER_WRITE and EVENT_WRITE))
560 ready.append((key, events & key.events))
561 return ready
562
563 def close(self):
564 self._selector.close()

Callers

nothing calls this directly

Calls 2

maxFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected