nodes: 0, module; 1, function_definition; 2, function_name:get_entries; 3, parameters; 4, block; 5, identifier:self; 6, identifier:chemsys_formula_id_criteria; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, comment:# TODO: This is a very hackish way of doing this. It should be fixed; 14, comment:# on the REST end.; 15, expression_statement; 16, expression_statement; 17, if_statement; 18, if_statement; 19, if_statement; 20, if_statement; 21, expression_statement; 22, expression_statement; 23, for_statement; 24, if_statement; 25, if_statement; 26, return_statement; 27, identifier:compatible_only; 28, True; 29, identifier:inc_structure; 30, None; 31, identifier:property_data; 32, None; 33, identifier:conventional_unit_cell; 34, False; 35, identifier:sort_by_e_above_hull; 36, False; 37, comment:"""
          Get a list of ComputedEntries or ComputedStructureEntries corresponding
          to a chemical system, formula, or materials_id or full criteria.
  
          Args:
              chemsys_formula_id_criteria (str/dict): A chemical system
                  (e.g., Li-Fe-O), or formula (e.g., Fe2O3) or materials_id
                  (e.g., mp-1234) or full Mongo-style dict criteria.
              compatible_only (bool): Whether to return only "compatible"
                  entries. Compatible entries are entries that have been
                  processed using the MaterialsProjectCompatibility class,
                  which performs adjustments to allow mixing of GGA and GGA+U
                  calculations for more accurate phase diagrams and reaction
                  energies.
              inc_structure (str): If None, entries returned are
                  ComputedEntries. If inc_structure="initial",
                  ComputedStructureEntries with initial structures are returned.
                  Otherwise, ComputedStructureEntries with final structures
                  are returned.
              property_data (list): Specify additional properties to include in
                  entry.data. If None, no data. Should be a subset of
                  supported_properties.
              conventional_unit_cell (bool): Whether to get the standard
                  conventional unit cell
              sort_by_e_above_hull (bool): Whether to sort the list of entries by
                  e_above_hull (will query e_above_hull as a property_data if True).
  
          Returns:
              List of ComputedEntry or ComputedStructureEntry objects.
          """; 38, assignment; 39, assignment; 40, identifier:sort_by_e_above_hull; 41, block; 42, identifier:property_data; 43, block; 44, identifier:inc_structure; 45, block; 46, not_operator; 47, block; 48, else_clause; 49, assignment; 50, assignment; 51, identifier:d; 52, identifier:data; 53, block; 54, identifier:compatible_only; 55, block; 56, identifier:sort_by_e_above_hull; 57, block; 58, identifier:entries; 59, identifier:params; 60, list; 61, identifier:props; 62, binary_operator:["energy", "unit_cell_formula", "task_id"] + params; 63, if_statement; 64, expression_statement; 65, if_statement; 66, call; 67, expression_statement; 68, block; 69, identifier:data; 70, call; 71, identifier:entries; 72, list; 73, expression_statement; 74, expression_statement; 75, if_statement; 76, if_statement; 77, expression_statement; 78, import_from_statement; 79, expression_statement; 80, expression_statement; 81, string:"run_type"; 82, string:"is_hubbard"; 83, string:"pseudo_potential"; 84, string:"hubbards"; 85, string:"potcar_symbols"; 86, string:"oxide_type"; 87, list; 88, identifier:params; 89, boolean_operator; 90, block; 91, elif_clause; 92, augmented_assignment; 93, comparison_operator:inc_structure == "initial"; 94, block; 95, else_clause; 96, identifier:isinstance; 97, argument_list; 98, assignment; 99, expression_statement; 100, attribute; 101, argument_list; 102, assignment; 103, assignment; 104, identifier:property_data; 105, block; 106, not_operator; 107, block; 108, else_clause; 109, call; 110, dotted_name; 111, line_continuation:\; 112, dotted_name; 113, assignment; 114, assignment; 115, string:"energy"; 116, string:"unit_cell_formula"; 117, string:"task_id"; 118, identifier:property_data; 119, comparison_operator:"e_above_hull" not in property_data; 120, expression_statement; 121, not_operator; 122, block; 123, identifier:props; 124, identifier:property_data; 125, identifier:inc_structure; 126, string:"initial"; 127, expression_statement; 128, block; 129, identifier:chemsys_formula_id_criteria; 130, identifier:dict; 131, identifier:criteria; 132, call; 133, assignment; 134, identifier:self; 135, identifier:query; 136, identifier:criteria; 137, identifier:props; 138, subscript; 139, list_comprehension; 140, identifier:data; 141, dictionary; 142, expression_statement; 143, identifier:inc_structure; 144, expression_statement; 145, block; 146, attribute; 147, argument_list; 148, identifier:pymatgen; 149, identifier:entries; 150, identifier:compatibility; 151, identifier:MaterialsProjectCompatibility; 152, identifier:entries; 153, call; 154, identifier:entries; 155, call; 156, string:"e_above_hull"; 157, identifier:property_data; 158, call; 159, identifier:property_data; 160, expression_statement; 161, call; 162, expression_statement; 163, attribute; 164, argument_list; 165, identifier:criteria; 166, identifier:chemsys_formula_id_criteria; 167, identifier:d; 168, string:"potcar_symbols"; 169, binary_operator:"%s %s" % (d["pseudo_potential"]["functional"], l); 170, for_in_clause; 171, pair; 172, call; 173, assignment; 174, expression_statement; 175, if_statement; 176, expression_statement; 177, identifier:entries; 178, identifier:append; 179, identifier:e; 180, attribute; 181, argument_list; 182, identifier:sorted; 183, argument_list; 184, attribute; 185, argument_list; 186, assignment; 187, attribute; 188, argument_list; 189, call; 190, identifier:MPRester; 191, identifier:parse_criteria; 192, identifier:chemsys_formula_id_criteria; 193, string:"%s %s"; 194, tuple; 195, identifier:l; 196, subscript; 197, string:"oxide_type"; 198, subscript; 199, attribute; 200, argument_list; 201, identifier:e; 202, call; 203, assignment; 204, identifier:conventional_unit_cell; 205, block; 206, else_clause; 207, assignment; 208, call; 209, identifier:process_entries; 210, identifier:entries; 211, identifier:entries; 212, keyword_argument; 213, identifier:property_data; 214, identifier:append; 215, string:"e_above_hull"; 216, identifier:property_data; 217, list; 218, identifier:props; 219, identifier:append; 220, string:"initial_structure"; 221, attribute; 222, argument_list; 223, subscript; 224, identifier:l; 225, subscript; 226, string:"labels"; 227, identifier:d; 228, string:"oxide_type"; 229, identifier:data; 230, identifier:update; 231, dictionary_comprehension; 232, identifier:ComputedEntry; 233, argument_list; 234, identifier:prim; 235, conditional_expression:d["initial_structure"] if inc_structure == "initial" \
                      else d["structure"]; 236, expression_statement; 237, expression_statement; 238, block; 239, identifier:e; 240, call; 241, identifier:MaterialsProjectCompatibility; 242, argument_list; 243, identifier:key; 244, lambda; 245, string:"e_above_hull"; 246, identifier:props; 247, identifier:append; 248, string:"structure"; 249, subscript; 250, string:"functional"; 251, identifier:d; 252, string:"pseudo_potential"; 253, pair; 254, for_in_clause; 255, subscript; 256, subscript; 257, keyword_argument; 258, keyword_argument; 259, keyword_argument; 260, subscript; 261, comparison_operator:inc_structure == "initial"; 262, line_continuation:\; 263, subscript; 264, assignment; 265, assignment; 266, expression_statement; 267, expression_statement; 268, identifier:ComputedStructureEntry; 269, argument_list; 270, lambda_parameters; 271, subscript; 272, identifier:d; 273, string:"pseudo_potential"; 274, identifier:k; 275, subscript; 276, identifier:k; 277, identifier:property_data; 278, identifier:d; 279, string:"unit_cell_formula"; 280, identifier:d; 281, string:"energy"; 282, identifier:parameters; 283, dictionary_comprehension; 284, identifier:data; 285, identifier:data; 286, identifier:entry_id; 287, subscript; 288, identifier:d; 289, string:"initial_structure"; 290, identifier:inc_structure; 291, string:"initial"; 292, identifier:d; 293, string:"structure"; 294, identifier:s; 295, call; 296, identifier:energy; 297, binary_operator:d["energy"] * (len(s) / len(prim)); 298, assignment; 299, assignment; 300, identifier:s; 301, identifier:energy; 302, keyword_argument; 303, keyword_argument; 304, keyword_argument; 305, identifier:entry; 306, attribute; 307, string:"e_above_hull"; 308, identifier:d; 309, identifier:k; 310, pair; 311, for_in_clause; 312, identifier:d; 313, string:"task_id"; 314, attribute; 315, argument_list; 316, subscript; 317, parenthesized_expression; 318, identifier:s; 319, call; 320, identifier:energy; 321, subscript; 322, identifier:parameters; 323, dictionary_comprehension; 324, identifier:data; 325, identifier:data; 326, identifier:entry_id; 327, subscript; 328, identifier:entry; 329, identifier:data; 330, identifier:k; 331, subscript; 332, identifier:k; 333, identifier:params; 334, call; 335, identifier:get_conventional_standard_structure; 336, identifier:d; 337, string:"energy"; 338, binary_operator:len(s) / len(prim); 339, attribute; 340, argument_list; 341, identifier:d; 342, string:"energy"; 343, pair; 344, for_in_clause; 345, identifier:d; 346, string:"task_id"; 347, identifier:d; 348, identifier:k; 349, identifier:SpacegroupAnalyzer; 350, argument_list; 351, call; 352, call; 353, identifier:prim; 354, identifier:copy; 355, identifier:k; 356, subscript; 357, identifier:k; 358, identifier:params; 359, identifier:prim; 360, identifier:len; 361, argument_list; 362, identifier:len; 363, argument_list; 364, identifier:d; 365, identifier:k; 366, identifier:s; 367, identifier:prim
code: def get_entries(self, chemsys_formula_id_criteria, compatible_only=True,
                      inc_structure=None, property_data=None,
                      conventional_unit_cell=False, sort_by_e_above_hull=False):
          """
          Get a list of ComputedEntries or ComputedStructureEntries corresponding
          to a chemical system, formula, or materials_id or full criteria.
  
          Args:
              chemsys_formula_id_criteria (str/dict): A chemical system
                  (e.g., Li-Fe-O), or formula (e.g., Fe2O3) or materials_id
                  (e.g., mp-1234) or full Mongo-style dict criteria.
              compatible_only (bool): Whether to return only "compatible"
                  entries. Compatible entries are entries that have been
                  processed using the MaterialsProjectCompatibility class,
                  which performs adjustments to allow mixing of GGA and GGA+U
                  calculations for more accurate phase diagrams and reaction
                  energies.
              inc_structure (str): If None, entries returned are
                  ComputedEntries. If inc_structure="initial",
                  ComputedStructureEntries with initial structures are returned.
                  Otherwise, ComputedStructureEntries with final structures
                  are returned.
              property_data (list): Specify additional properties to include in
                  entry.data. If None, no data. Should be a subset of
                  supported_properties.
              conventional_unit_cell (bool): Whether to get the standard
                  conventional unit cell
              sort_by_e_above_hull (bool): Whether to sort the list of entries by
                  e_above_hull (will query e_above_hull as a property_data if True).
  
          Returns:
              List of ComputedEntry or ComputedStructureEntry objects.
          """
          # TODO: This is a very hackish way of doing this. It should be fixed
          # on the REST end.
          params = ["run_type", "is_hubbard", "pseudo_potential", "hubbards",
                    "potcar_symbols", "oxide_type"]
          props = ["energy", "unit_cell_formula", "task_id"] + params
          if sort_by_e_above_hull:
              if property_data and "e_above_hull" not in property_data:
                  property_data.append("e_above_hull")
              elif not property_data:
                  property_data = ["e_above_hull"]
          if property_data:
              props += property_data
          if inc_structure:
              if inc_structure == "initial":
                  props.append("initial_structure")
              else:
                  props.append("structure")
  
          if not isinstance(chemsys_formula_id_criteria, dict):
              criteria = MPRester.parse_criteria(chemsys_formula_id_criteria)
          else:
              criteria = chemsys_formula_id_criteria
          data = self.query(criteria, props)
          
          entries = []
          for d in data:
              d["potcar_symbols"] = [
                  "%s %s" % (d["pseudo_potential"]["functional"], l)
                  for l in d["pseudo_potential"]["labels"]]
              data = {"oxide_type": d["oxide_type"]}
              if property_data:
                  data.update({k: d[k] for k in property_data})
              if not inc_structure:
                  e = ComputedEntry(d["unit_cell_formula"], d["energy"],
                                    parameters={k: d[k] for k in params},
                                    data=data,
                                    entry_id=d["task_id"])
  
              else:
                  prim = d["initial_structure"] if inc_structure == "initial" \
                      else d["structure"]
                  if conventional_unit_cell:
                      s = SpacegroupAnalyzer(prim).get_conventional_standard_structure()
                      energy = d["energy"] * (len(s) / len(prim))
                  else:
                      s = prim.copy()
                      energy = d["energy"]
                  e = ComputedStructureEntry(
                      s, energy,
                      parameters={k: d[k] for k in params},
                      data=data,
                      entry_id=d["task_id"])
              entries.append(e)
          if compatible_only:
              from pymatgen.entries.compatibility import \
                  MaterialsProjectCompatibility
              entries = MaterialsProjectCompatibility().process_entries(entries)
          if sort_by_e_above_hull:
              entries = sorted(entries, key=lambda entry: entry.data["e_above_hull"])
          return entries