def read(self):
        """Read the state of the GPIO.

        Returns:
            bool: ``True`` for high state, ``False`` for low state.

        Raises:
            GPIOError: if an I/O or OS error occurs.

        """
        # Read value
        try:
            buf = os.read(self._fd, 2)
        except OSError as e:
            raise GPIOError(e.errno, "Reading GPIO: " + e.strerror)

        # Rewind
        try:
            os.lseek(self._fd, 0, os.SEEK_SET)
        except OSError as e:
            raise GPIOError(e.errno, "Rewinding GPIO: " + e.strerror)

        if buf[0] == b"0"[0]:
            return False
        elif buf[0] == b"1"[0]:
            return True

        raise GPIOError(None, "Unknown GPIO value: \"%s\"" % buf[0])
def read ( self ) : try : buf = os . read ( self . _fd , 2 ) except OSError as e : raise GPIOError ( e . errno , "Reading GPIO: " + e . strerror ) try : os . lseek ( self . _fd , 0 , os . SEEK_SET ) except OSError as e : raise GPIOError ( e . errno , "Rewinding GPIO: " + e . strerror ) if buf [ 0 ] == b"0" [ 0 ] : return False elif buf [ 0 ] == b"1" [ 0 ] : return True raise GPIOError ( None , "Unknown GPIO value: \"%s\"" % buf [ 0 ] )
Read the state of the GPIO.

        Returns:
            bool: ``True`` for high state, ``False`` for low state.

        Raises:
            GPIOError: if an I/O or OS error occurs.