diff --git a/mp_api/client/core/client.py b/mp_api/client/core/client.py index ba6f0ad9..94183081 100644 --- a/mp_api/client/core/client.py +++ b/mp_api/client/core/client.py @@ -2,6 +2,7 @@ API v3 to enable the creation of data structures and pymatgen objects using Materials Project data. """ + from __future__ import annotations import itertools @@ -21,6 +22,7 @@ from urllib.parse import quote, urljoin import requests +from bson import json_util from emmet.core.utils import jsanitize from monty.json import MontyDecoder from pydantic import BaseModel, create_model @@ -494,7 +496,7 @@ def _query_resource( ) suffix = suffix.replace("_", "-") - # Paginate over all entried in the bucket. + # Paginate over all entries in the bucket. # This will have to change for when a subset of entries from # the DB is needed. is_tasks = "tasks" in suffix @@ -516,7 +518,9 @@ def _query_resource( if key: keys.append(key) - decoder = MontyDecoder().decode if self.monty_decode else json.loads + decoder = ( + MontyDecoder().decode if self.monty_decode else json_util.loads + ) # Multithreaded function inputs s3_params_list = { diff --git a/mp_api/client/mprester.py b/mp_api/client/mprester.py index 53324145..3ccf7645 100644 --- a/mp_api/client/mprester.py +++ b/mp_api/client/mprester.py @@ -1378,7 +1378,9 @@ def get_charge_density_from_material_id( if self.use_document_model else x["last_updated"], # type: ignore ) - task_id = latest_doc.task_id if self.use_document_model else latest_doc["task_id"] + task_id = ( + latest_doc.task_id if self.use_document_model else latest_doc["task_id"] + ) return self.get_charge_density_from_task_id(task_id, inc_task_doc) def get_download_info(self, material_ids, calc_types=None, file_patterns=None):