sense_hat/stick.py
def _read(self):
        """
        Reads a single event from the joystick, blocking until one is
        available. Returns `None` if a non-key event was read, or an
        `InputEvent` tuple describing the event otherwise.
        """
        event = self._stick_file.read(self.EVENT_SIZE)
        (tv_sec, tv_usec, type, code, value) = struct.unpack(self.EVENT_FORMAT, event)
        if type == self.EV_KEY:
            return InputEvent(
                timestamp=tv_sec + (tv_usec / 1000000),
                direction={
                    self.KEY_UP:    DIRECTION_UP,
                    self.KEY_DOWN:  DIRECTION_DOWN,
                    self.KEY_LEFT:  DIRECTION_LEFT,
                    self.KEY_RIGHT: DIRECTION_RIGHT,
                    self.KEY_ENTER: DIRECTION_MIDDLE,
                    }[code],
                action={
                    self.STATE_PRESS:   ACTION_PRESSED,
                    self.STATE_RELEASE: ACTION_RELEASED,
                    self.STATE_HOLD:    ACTION_HELD,
                    }[value])
        else:
            return None

        Reads a single event from the joystick, blocking until one is
        available. Returns `None` if a non-key event was read, or an
        `InputEvent` tuple describing the event otherwise.
        
Reads a single event from the joystick, blocking until one is
available. Returns `None` if a non-key event was read, or an
`InputEvent` tuple describing the event otherwise.
Reads a single event from the joystick blocking until one is available . Returns ` None ` if a non - key event was read or an ` InputEvent ` tuple describing the event otherwise .
def _read(self):
        event = self._stick_file.read(self.EVENT_SIZE)
        (tv_sec, tv_usec, type, code, value) = struct.unpack(self.EVENT_FORMAT, event)
        if type == self.EV_KEY:
            return InputEvent(
                timestamp=tv_sec + (tv_usec / 1000000),
                direction={
                    self.KEY_UP:    DIRECTION_UP,
                    self.KEY_DOWN:  DIRECTION_DOWN,
                    self.KEY_LEFT:  DIRECTION_LEFT,
                    self.KEY_RIGHT: DIRECTION_RIGHT,
                    self.KEY_ENTER: DIRECTION_MIDDLE,
                    }[code],
                action={
                    self.STATE_PRESS:   ACTION_PRESSED,
                    self.STATE_RELEASE: ACTION_RELEASED,
                    self.STATE_HOLD:    ACTION_HELD,
                    }[value])
        else:
            return None
def _read ( self ) : event = self . _stick_file . read ( self . EVENT_SIZE ) ( tv_sec , tv_usec , type , code , value ) = struct . unpack ( self . EVENT_FORMAT , event ) if type == self . EV_KEY : return InputEvent ( timestamp = tv_sec + ( tv_usec / 1000000 ) , direction = { self . KEY_UP : DIRECTION_UP , self . KEY_DOWN : DIRECTION_DOWN , self . KEY_LEFT : DIRECTION_LEFT , self . KEY_RIGHT : DIRECTION_RIGHT , self . KEY_ENTER : DIRECTION_MIDDLE , } [ code ] , action = { self . STATE_PRESS : ACTION_PRESSED , self . STATE_RELEASE : ACTION_RELEASED , self . STATE_HOLD : ACTION_HELD , } [ value ] ) else : return None
Reads a single event from the joystick, blocking until one is
available.
Reads a single event from the joystick blocking until one is available .
"""
        Reads a single event from the joystick, blocking until one is
        available. Returns `None` if a non-key event was read, or an
        `InputEvent` tuple describing the event otherwise.
        """
self