class_docstr: A list-like structure to specify the order of items in a dictionary.
  The main characteristics are:
      - Append and insert only. Cannot remove elements. This is not strictly required
          by the use-case but probably good practice.
      - Elements must be unique. Inserting an element which is already in the list
          will throw an error.
  
  Primarily useful for specifying the order in which UI elements
  should be shown in Wave.
docstr: Insert one or more keys. Either `before` or `after`, but not both, must be set
  to determine position.
  
  Args:
      keys: One more keys to insert.
      after: A key immediately after which the `keys` will be inserted.
      before: A key immediately before which the `keys` are inserted.
  
  Raises:
      - `ValueError` if one or more key is already in the list.
      - `ValueError` if `before` / `after` does not exist in the list.
      - `ValueError` if an invalid combination of arguments is set.
docstr_tok: ["Insert","one","or","more","keys",".","Either","`","before","`","or","`","after","`",",","but","not","both",",","must","be","set","to","determine","position",".","Args",":","keys",":","One","more","keys","to","insert",".","after",":","A","key","immediately","after","which","the","`","keys","`","will","be","inserted",".","before",":","A","key","immediately","before","which","the","`","keys","`","are","inserted",".","Raises",":","-","`","ValueError","`","if","one","or","more","key","is","already","in","the","list",".","-","`","ValueError","`","if","`","before","`","\/","`","after","`","does","not","exist","in","the","list",".","-","`","ValueError","`","if","an","invalid","combination","of","arguments","is","set","."]
code: def insert(
      self,
      *keys: str,
      before: Optional[str] = None,
      after: Optional[str] = None,
  ):
      """
      Insert one or more keys. Either `before` or `after`, but not both, must be set
      to determine position.
  
      Args:
          keys: One more keys to insert.
          after: A key immediately after which the `keys` will be inserted.
          before: A key immediately before which the `keys` are inserted.
  
      Raises:
          - `ValueError` if one or more key is already in the list.
          - `ValueError` if `before` / `after` does not exist in the list.
          - `ValueError` if an invalid combination of arguments is set.
      """
  
      self._unique_guard(*keys)
  
      if before is not None:
          for key in keys[::-1]:
              self._list.insert(self._list.index(before), key)
  
          if after is not None:
              raise ValueError(
                  "`after` must be None if `before` is set."
              )
  
      if after is not None:
          for key in keys[::-1]:
              self._list.insert(self._list.index(after) + 1, key)
  
          if before is not None:
              raise ValueError(
                  "`before` must be None if `after` is set."
              )
  
      if before is None and after is None:
          raise ValueError("Either `before` or `after` must be set.")
  
file_path: h2o-llmstudio/llm_studio/src/order.py
imports: from typing import Iterable, List, Optional
label_desc: Use image node_id 5 for calling the Order obj's underlying member method code with example usage: obj.insert() without return types