Skip to content

Commit

Permalink
Rename get_summary to summary_search to mirror mp-api.
Browse files Browse the repository at this point in the history
  • Loading branch information
shyuep committed Sep 28, 2023
1 parent f758c60 commit 63a4c07
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pymatgen/ext/matproj.py
Original file line number Diff line number Diff line change
Expand Up @@ -1755,7 +1755,7 @@ def request(self, sub_url, payload=None, method="GET", mp_decode=True):
raise MPRestError(msg)
return all_data

def get_summary(self, criteria: dict, fields: list | None = None) -> list[dict]:
def summary_search(self, criteria: dict, fields: list | None = None) -> list[dict]:
"""
Get a data corresponding to a criteria.
Expand Down Expand Up @@ -1795,7 +1795,7 @@ def get_material_ids(self, formula):
Returns:
([str]) List of all materials ids.
"""
return [d["material_id"] for d in self.get_summary({"formula": formula}, fields=["material_id"])]
return [d["material_id"] for d in self.summary_search({"formula": formula}, fields=["material_id"])]

# For backwards compatibility and poor spelling.
get_materials_ids = get_material_ids
Expand Down
4 changes: 2 additions & 2 deletions tests/ext/test_matproj.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def test_attr_error(self):
_ = self.rester.summary

def test_get_summary(self):
docs = self.rester.get_summary({"formula": "Fe2O3"})
docs = self.rester.summary_search({"formula": "Fe2O3"})
assert len(docs) > 3

doc = self.rester.get_summary_by_material_id(docs[0]["material_id"])
Expand Down Expand Up @@ -890,7 +890,7 @@ def test_parity_with_mp_api(self):
mpr_mpapi = MPResterMPAPI(PMG_MAPI_KEY)
# Test summary
mp_data = mpr_mpapi.summary.search(formula="Al2O3")
pmg_data = self.rester.get_summary({"formula": "Al2O3"})
pmg_data = self.rester.summary_search({"formula": "Al2O3"})
assert len(mp_data) == len(pmg_data)

# Test get_entries
Expand Down

0 comments on commit 63a4c07

Please sign in to comment.