parameters: (lines)
return_statement: return np.vstack(lines).astype("f4"), np.concatenate(indices).astype("i4")
docstring: Prepare the buffers for multi-polyline rendering. Closed polyline must have their
      last point identical to their first point.
docstring_summary: Prepare the buffers for multi-polyline rendering. Closed polyline must have their
      last point identical to their first point.
docstring_tokens: Prepare the buffers for multi - polyline rendering . Closed polyline must have their last point identical to their first point .
function: def build_buffers(lines):
      """Prepare the buffers for multi-polyline rendering. Closed polyline must have their
      last point identical to their first point."""
  
      lines = [np.array(line, dtype="f4") for line in lines]
  
      indices = []
      reset_index = [-1]
      start_index = 0
      for line in lines:
          if np.all(line[0] == line[-1]):  # closed path
              idx = np.arange(len(line) + 3) - 1
              idx[0], idx[-2], idx[-1] = len(line) - 1, 0, 1
          else:
              idx = np.arange(len(line) + 2) - 1
              idx[0], idx[-1] = 0, len(line) - 1
  
          indices.append(idx + start_index)
          start_index += len(line)
          indices.append(reset_index)
  
      return np.vstack(lines).astype("f4"), np.concatenate(indices).astype("i4")
function_tokens: def build_buffers ( lines ) : lines = [ np . array ( line , dtype = "f4" ) for line in lines ] indices = [ ] reset_index = [ - 1 ] start_index = 0 for line in lines : if np . all ( line [ 0 ] == line [ - 1 ] ) : # closed path idx = np . arange ( len ( line ) + 3 ) - 1 idx [ 0 ] , idx [ - 2 ] , idx [ - 1 ] = len ( line ) - 1 , 0 , 1 else : idx = np . arange ( len ( line ) + 2 ) - 1 idx [ 0 ] , idx [ - 1 ] = 0 , len ( line ) - 1 indices . append ( idx + start_index ) start_index += len ( line ) indices . append ( reset_index ) return np . vstack ( lines ) . astype ( "f4" ) , np . concatenate ( indices ) . astype ( "i4" )