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

Method get_event

Lib/_pyrepl/unix_console.py:390–417  ·  view source on GitHub ↗

Get an event from the console event queue. Parameters: - block (bool): Whether to block until an event is available. Returns: - Event: Event object from the event queue.

(self, block: bool = True)

Source from the content-addressed store, hash-verified

388 self.event_queue.push(char)
389
390 def get_event(self, block: bool = True) -> Event | None:
391 """
392 Get an event from the console event queue.
393
394 Parameters:
395 - block (bool): Whether to block until an event is available.
396
397 Returns:
398 - Event: Event object from the event queue.
399 """
400 if not block and not self.wait(timeout=0):
401 return None
402
403 while self.event_queue.empty():
404 while True:
405 try:
406 self.push_char(self.__read(1))
407 except OSError as err:
408 if err.errno == errno.EINTR:
409 if not self.event_queue.empty():
410 return self.event_queue.get()
411 else:
412 continue
413 else:
414 raise
415 else:
416 break
417 return self.event_queue.get()
418
419 def wait(self, timeout: float | None = None) -> bool:
420 """

Callers

nothing calls this directly

Calls 5

waitMethod · 0.95
push_charMethod · 0.95
__readMethod · 0.95
emptyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected