original_docstring: Read data from the buffer.
  
          :param int size: The bytes to read. -1 means the entire buffer (default)
          :param int offset: Byte read offset
          :rtype: bytes
          
docstring: Read data from the buffer.
docstring_tokens: Read data from the buffer .
code: def read(self, size: int = -1, offset: int = 0) -> bytes:
          """Read data from the buffer.
  
          :param int size: The bytes to read. -1 means the entire buffer (default)
          :param int offset: Byte read offset
          :rtype: bytes
          """
          if size == -1:
              size = self._size - offset
  
          # Catch this before confusing INVALID_OPERATION is raised
          if size < 1:
              raise ValueError(
                  "Attempting to read 0 or less bytes from buffer: "
                  f"buffer size={self._size} | params: size={size}, offset={offset}"
              )
  
          # Manually detect this so it doesn't raise a confusing INVALID_VALUE error
          if size + offset > self._size:
              raise ValueError(
                  (
                      "Attempting to read outside the buffer. "
                      f"Buffer size: {self._size} "
                      f"Reading from {offset} to {size + offset}"
                  )
              )
  
          gl.glBindBuffer(gl.GL_ARRAY_BUFFER, self._glo)
          ptr = gl.glMapBufferRange(gl.GL_ARRAY_BUFFER, offset, size, gl.GL_MAP_READ_BIT)
          data = string_at(ptr, size=size)
          gl.glUnmapBuffer(gl.GL_ARRAY_BUFFER)
          return data
code_tokens: def read ( self , size : int = - 1 , offset : int = 0 ) -> bytes : if size == - 1 : size = self . _size - offset if size < 1 : raise ValueError ( "Attempting to read 0 or less bytes from buffer: " f"buffer size={self._size} | params: size={size}, offset={offset}" ) if size + offset > self . _size : raise ValueError ( ( "Attempting to read outside the buffer. " f"Buffer size: {self._size} " f"Reading from {offset} to {size + offset}" ) ) gl . glBindBuffer ( gl . GL_ARRAY_BUFFER , self . _glo ) ptr = gl . glMapBufferRange ( gl . GL_ARRAY_BUFFER , offset , size , gl . GL_MAP_READ_BIT ) data = string_at ( ptr , size = size ) gl . glUnmapBuffer ( gl . GL_ARRAY_BUFFER ) return data
short_docstring: Read data from the buffer.
short_docstring_tokens: Read data from the buffer .
comment: """Read data from the buffer.
  
          :param int size: The bytes to read. -1 means the entire buffer (default)
          :param int offset: Byte read offset
          :rtype: bytes
          """$SEP$# Catch this before confusing INVALID_OPERATION is raised$SEP$# Manually detect this so it doesn't raise a confusing INVALID_VALUE error