def read_actions():
 while True:
  key = get_key()
  if (key in (const.KEY_UP, 'k')):
   (yield const.ACTION_PREVIOUS)
  elif (key in (const.KEY_DOWN, 'j')):
   (yield const.ACTION_NEXT)
  elif (key in (const.KEY_CTRL_C, 'q')):
   (yield const.ACTION_ABORT)
  elif (key in ('\n', '\r')):
   (yield const.ACTION_SELECT)

def read_actions ( ) : while True : key = get_key ( ) if ( key in ( const . KEY_UP , 'k' ) ) : ( yield const . ACTION_PREVIOUS ) elif ( key in ( const . KEY_DOWN , 'j' ) ) : ( yield const . ACTION_NEXT ) elif ( key in ( const . KEY_CTRL_C , 'q' ) ) : ( yield const . ACTION_ABORT ) elif ( key in ( '\n' , '\r' ) ) : ( yield const . ACTION_SELECT )
yields actions for pressed keys .