parameters: (cbs_metadata, molecule)
return_statement: return (metadata)
docstring: A helper function which validates the ``cbs_metadata`` format,
      expands basis sets, and provides sensible defaults for optional arguments.
  
      Parameters
      ----------
      cbs_metadata : list
          List of dicts containing CBS stage keywords.
      molecule : qcdb.molecule or psi4.core.Molecule
          Molecule to be passed to _expand_bracketed_basis()
  
      Returns
      -------
      list
          Validated list of dictionaries, with each item consisting of an extrapolation
          stage. All validation takes place here.
docstring_summary: A helper function which validates the ``cbs_metadata`` format,
      expands basis sets, and provides sensible defaults for optional arguments.
docstring_tokens: A helper function which validates the cbs_metadata format expands basis sets and provides sensible defaults for optional arguments .
function: def _validate_cbs_inputs(cbs_metadata, molecule):
      """ A helper function which validates the ``cbs_metadata`` format,
      expands basis sets, and provides sensible defaults for optional arguments.
  
      Parameters
      ----------
      cbs_metadata : list
          List of dicts containing CBS stage keywords.
      molecule : qcdb.molecule or psi4.core.Molecule
          Molecule to be passed to _expand_bracketed_basis()
  
      Returns
      -------
      list
          Validated list of dictionaries, with each item consisting of an extrapolation
          stage. All validation takes place here.
      """
  
      metadata = []
      for iitem, item in enumerate(cbs_metadata):
          # 1a) all items must have wfn
          if "wfn" not in item:
              raise ValidationError(f"Stage {iitem} doesn't have defined level of theory!")
      # 1b) all items must have basis set
          if "basis" not in item:
              raise ValidationError(f"Stage {iitem} doesn't have defined basis sets!")
      # 2a) process required stage parameters and assign defaults
          stage = {}
          stage["wfn"] = item["wfn"].lower()
          stage["basis"] = _expand_bracketed_basis(item["basis"].lower(), molecule)
          # 2b) if first item is not HF, generate it
          if len(metadata) == 0 and stage["wfn"] not in ["hf", "c4-hf", "scf", "c4-scf"]:
              scf = {}
              if stage["wfn"].startswith("c4"):
                  scf["wfn"] = "c4-hf"
              else:
                  scf["wfn"] = "hf"
              scf["basis"] = ([stage["basis"][0][-1]], [stage["basis"][1][-1]])
              scf["treatment"] = "scf"
              scf["stage"] = "scf"
              scf["scheme"] = _get_default_xtpl(len(scf["basis"][1]), scf["treatment"])
              scf["alpha"] = None
              scf["options"] = False
              scf["options_lo"] = False
              metadata.append(scf)
      # 2c) keep processing current stage
          stage["treatment"] = item.get("treatment", "scf" if len(metadata) == 0 else "corl")
          stage["stage"] = item.get("stage", False)
          if not stage["stage"]:
              if len(metadata) == 0:
                  stage["stage"] = "scf"
              elif len(metadata) == 1:
                  stage["stage"] = "corl"
              else:
                  stage["stage"] = f"delta{len(metadata) - 1}"
          stage["scheme"] = item.get("scheme", _get_default_xtpl(len(stage["basis"][1]), stage["treatment"]))
          if len(metadata) > 0:
              stage["wfn_lo"] = item.get("wfn_lo", metadata[-1].get("wfn")).lower()
              stage["basis_lo"] = _expand_bracketed_basis(item.get("basis_lo", item["basis"]).lower(), molecule)
              if len(stage["basis"][0]) != len(stage["basis_lo"][0]):
                  raise ValidationError("""Number of basis sets inconsistent
                                              between high ({}) and low ({}) levels.""".format(
                      len(stage["basis"][0]), len(stage["basis_lo"][0])))
          stage["alpha"] = item.get("alpha", None)
          stage["options"] = item.get("options", False)
          stage["options_lo"] = item.get("options_lo", False)
          metadata.append(stage)
      return (metadata)
function_tokens: def _validate_cbs_inputs ( cbs_metadata , molecule ) : metadata = [ ] for iitem , item in enumerate ( cbs_metadata ) : # 1a) all items must have wfn if "wfn" not in item : raise ValidationError ( f"Stage {iitem} doesn't have defined level of theory!" ) # 1b) all items must have basis set if "basis" not in item : raise ValidationError ( f"Stage {iitem} doesn't have defined basis sets!" ) # 2a) process required stage parameters and assign defaults stage = { } stage [ "wfn" ] = item [ "wfn" ] . lower ( ) stage [ "basis" ] = _expand_bracketed_basis ( item [ "basis" ] . lower ( ) , molecule ) # 2b) if first item is not HF, generate it if len ( metadata ) == 0 and stage [ "wfn" ] not in [ "hf" , "c4-hf" , "scf" , "c4-scf" ] : scf = { } if stage [ "wfn" ] . startswith ( "c4" ) : scf [ "wfn" ] = "c4-hf" else : scf [ "wfn" ] = "hf" scf [ "basis" ] = ( [ stage [ "basis" ] [ 0 ] [ - 1 ] ] , [ stage [ "basis" ] [ 1 ] [ - 1 ] ] ) scf [ "treatment" ] = "scf" scf [ "stage" ] = "scf" scf [ "scheme" ] = _get_default_xtpl ( len ( scf [ "basis" ] [ 1 ] ) , scf [ "treatment" ] ) scf [ "alpha" ] = None scf [ "options" ] = False scf [ "options_lo" ] = False metadata . append ( scf ) # 2c) keep processing current stage stage [ "treatment" ] = item . get ( "treatment" , "scf" if len ( metadata ) == 0 else "corl" ) stage [ "stage" ] = item . get ( "stage" , False ) if not stage [ "stage" ] : if len ( metadata ) == 0 : stage [ "stage" ] = "scf" elif len ( metadata ) == 1 : stage [ "stage" ] = "corl" else : stage [ "stage" ] = f"delta{len(metadata) - 1}" stage [ "scheme" ] = item . get ( "scheme" , _get_default_xtpl ( len ( stage [ "basis" ] [ 1 ] ) , stage [ "treatment" ] ) ) if len ( metadata ) > 0 : stage [ "wfn_lo" ] = item . get ( "wfn_lo" , metadata [ - 1 ] . get ( "wfn" ) ) . lower ( ) stage [ "basis_lo" ] = _expand_bracketed_basis ( item . get ( "basis_lo" , item [ "basis" ] ) . lower ( ) , molecule ) if len ( stage [ "basis" ] [ 0 ] ) != len ( stage [ "basis_lo" ] [ 0 ] ) : raise ValidationError ( """Number of basis sets inconsistent
                                              between high ({}) and low ({}) levels.""" . format ( len ( stage [ "basis" ] [ 0 ] ) , len ( stage [ "basis_lo" ] [ 0 ] ) ) ) stage [ "alpha" ] = item . get ( "alpha" , None ) stage [ "options" ] = item . get ( "options" , False ) stage [ "options_lo" ] = item . get ( "options_lo" , False ) metadata . append ( stage ) return ( metadata )