Skip to content

Commit 1845d1e

Browse files
author
Jason
committed
2 parents f58511d + 9a971c2 commit 1845d1e

25 files changed

Lines changed: 3859 additions & 915 deletions

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@ ci:
66

77
repos:
88
- repo: https://github.com/astral-sh/ruff-pre-commit
9-
rev: v0.0.284
9+
rev: v0.0.292
1010
hooks:
1111
- id: ruff
1212
args: [--fix, --show-fixes]
1313

1414
- repo: https://github.com/psf/black
15-
rev: 23.7.0
15+
rev: 23.9.1
1616
hooks:
1717
- id: black
1818

1919
- repo: https://github.com/asottile/blacken-docs
20-
rev: "1.15.0"
20+
rev: "1.16.0"
2121
hooks:
2222
- id: blacken-docs
2323
additional_dependencies: [black>=23.7.0]
2424

2525
- repo: https://github.com/pre-commit/pre-commit-hooks
26-
rev: v4.4.0
26+
rev: v4.5.0
2727
hooks:
2828
- id: check-case-conflict
2929
- id: check-symlinks
@@ -34,7 +34,7 @@ repos:
3434
- id: trailing-whitespace
3535

3636
- repo: https://github.com/codespell-project/codespell
37-
rev: v2.2.4
37+
rev: v2.2.6
3838
hooks:
3939
- id: codespell
4040
stages: [commit, commit-msg]

mp_api/client/core/client.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ def _submit_request_and_process(
842842
data_model(
843843
**{
844844
field: value
845-
for field, value in raw_doc.model_dump().items()
845+
for field, value in dict(raw_doc).items()
846846
if field in set_fields
847847
}
848848
)
@@ -876,9 +876,8 @@ def _submit_request_and_process(
876876
)
877877

878878
def _generate_returned_model(self, doc):
879-
set_fields = [
880-
field for field, _ in doc if field in doc.model_dump(exclude_unset=True)
881-
]
879+
set_fields = doc.model_fields_set
880+
882881
unset_fields = [field for field in doc.model_fields if field not in set_fields]
883882

884883
data_model = create_model(

mp_api/client/mprester.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from packaging import version
1616
from pymatgen.analysis.phase_diagram import PhaseDiagram
1717
from pymatgen.analysis.pourbaix_diagram import IonEntry
18-
from pymatgen.core import Element, Structure
18+
from pymatgen.core import SETTINGS, Element, Structure
1919
from pymatgen.core.ion import Ion
2020
from pymatgen.entries.computed_entries import ComputedStructureEntry
2121
from pymatgen.io.vasp import Chgcar
@@ -165,14 +165,17 @@ def __init__(
165165
headers (dict): Custom headers for localhost connections.
166166
mute_progress_bars (bool): Whether to mute progress bars.
167167
"""
168+
# SETTINGS tries to read API key from ~/.config/.pmgrc.yaml
169+
api_key = api_key or DEFAULT_API_KEY or SETTINGS.get("PMG_MAPI_KEY")
170+
168171
if api_key and len(api_key) != 32:
169172
raise ValueError(
170173
"Please use a new API key from https://materialsproject.org/api "
171174
"Keys for the new API are 32 characters, whereas keys for the legacy "
172175
"API are 16 characters."
173176
)
174177

175-
self.api_key = api_key or DEFAULT_API_KEY
178+
self.api_key = api_key
176179
self.endpoint = endpoint
177180
self.headers = headers or {}
178181
self.session = session or BaseRester._create_session(

mp_api/client/routes/_user_settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ def patch_user_settings(self, consumer_id, settings): # pragma: no cover
4646
"sector",
4747
"job_role",
4848
"is_email_subscribed",
49+
"agreed_terms",
4950
]:
5051
raise ValueError(
5152
f"Invalid setting key {key}. Must be one of"
52-
"institution, sector, job_role, is_email_subscribed"
53+
"institution, sector, job_role, is_email_subscribed, agreed_terms"
5354
)
5455
body[f"settings.{key}"] = settings[key]
5556

mp_api/client/routes/materials/substrates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def search(
4242
"""Query equations of state docs using a variety of search criteria.
4343
4444
Arguments:
45-
area (Tuple[float,float]): Minimum and maximum volume in Ų to consider for the minimim coincident
45+
area (Tuple[float,float]): Minimum and maximum volume in Ų to consider for the minimum coincident
4646
interface area range.
4747
energy (Tuple[float,float]): Minimum and maximum energy in meV to consider for the elastic energy range.
4848
film_id (str): Materials Project ID of the film material.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ classifiers = [
2222
dependencies = [
2323
"setuptools",
2424
"msgpack",
25-
"maggma",
25+
"maggma>=0.57.1",
2626
"pymatgen>=2022.3.7",
2727
"typing-extensions>=3.7.4.1",
2828
"requests>=2.23.0",

0 commit comments

Comments
 (0)