Skip to content

Commit

Permalink
More linting
Browse files Browse the repository at this point in the history
  • Loading branch information
munrojm authored and tschaume committed Mar 26, 2021
1 parent 2afe3e2 commit cf2316b
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 43 deletions.
53 changes: 36 additions & 17 deletions src/mp_api/search/models.py
@@ -1,4 +1,4 @@
from typing import List, Tuple, Optional
from typing import List, Optional
from pymatgen.core.periodic_table import Element

from mp_api.materials.models import Structure, Composition
Expand All @@ -14,23 +14,42 @@ class SearchStats(BaseModel):
Statistics about a specified SearchDoc field.
"""

field: str = Field(None, title="Field", description="Field name corresponding to a field in SearchDoc")
num_samples: Optional[int] = Field(None, title="Sample",
description="The number of documents sampled to generate statistics. "
"If unspecified, statistics will be from entire database.")
min: float = Field(None, title="Minimum", description="The minimum value "
"of the specified field used to "
"generate statistics.")
max: float = Field(None, title="Maximum", description="The maximum value "
"of the specified field used to "
"generate statistics.")
median: float = Field(None, title="Median", description="The median of the field values.")
field: str = Field(
None,
title="Field",
description="Field name corresponding to a field in SearchDoc",
)
num_samples: Optional[int] = Field(
None,
title="Sample",
description="The number of documents sampled to generate statistics. "
"If unspecified, statistics will be from entire database.",
)
min: float = Field(
None,
title="Minimum",
description="The minimum value "
"of the specified field used to "
"generate statistics.",
)
max: float = Field(
None,
title="Maximum",
description="The maximum value "
"of the specified field used to "
"generate statistics.",
)
median: float = Field(
None, title="Median", description="The median of the field values."
)
mean: float = Field(None, title="Mean", description="The mean of the field values.")
distribution: List[float] = Field(None,
title="Distribution",
description="List of floats specifying a kernel density "
"estimator of the distribution, equally spaced "
"between specified minimum and maximum values.")
distribution: List[float] = Field(
None,
title="Distribution",
description="List of floats specifying a kernel density "
"estimator of the distribution, equally spaced "
"between specified minimum and maximum values.",
)


class XASSearchData(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion src/mp_api/thermo/client.py
@@ -1,7 +1,7 @@
from typing import List, Optional, Tuple
from collections import defaultdict

from mp_api.core.client import BaseRester, MPRestError
from mp_api.core.client import BaseRester
from mp_api.thermo.models import ThermoDoc

import warnings
Expand Down
38 changes: 13 additions & 25 deletions src/mp_api/thermo/models.py
@@ -1,4 +1,4 @@
from typing import Dict, List
from typing import List
from pydantic import BaseModel, Field, validator
from datetime import datetime
from monty.json import MontyDecoder
Expand Down Expand Up @@ -32,48 +32,39 @@ class ThermoData(BaseModel):
"""

energy: float = Field(
None,
description="Total DFT energy in eV.",
None, description="Total DFT energy in eV.",
)

energy_per_atom: float = Field(
None,
description="Total DFT energy in eV/atom.",
None, description="Total DFT energy in eV/atom.",
)

formation_energy_per_atom: float = Field(
None,
description="Formation energy in eV/atom.",
None, description="Formation energy in eV/atom.",
)

e_above_hull: float = Field(
None,
description="Energy above the hull in eV/atom.",
None, description="Energy above the hull in eV/atom.",
)

is_stable: bool = Field(
None,
description="Whether the material is stable.",
None, description="Whether the material is stable.",
)

eq_reaction_e: float = Field(
None,
description="Equilibrium reaction energy in eV/atom.",
None, description="Equilibrium reaction energy in eV/atom.",
)

entry: ComputedEntry = Field(
None,
description="Computed entry for the material.",
None, description="Computed entry for the material.",
)

explanation: ExplanationDoc = Field(
None,
description="Thermo entry explanation data.",
None, description="Thermo entry explanation data.",
)

decomposes_to: List[dict] = Field(
None,
description="List of decomposition materials data.",
None, description="List of decomposition materials data.",
)


Expand All @@ -88,18 +79,15 @@ class ThermoDoc(BaseModel):
)

thermo: ThermoData = Field(
None,
description="Thermo data for the material.",
None, description="Thermo data for the material.",
)

chemsys: str = Field(
None,
description="Dash-delimited string of elements in the material.",
None, description="Dash-delimited string of elements in the material.",
)

nelements: int = Field(
None,
description="Number of elements in the material.",
None, description="Number of elements in the material.",
)

elements: List[Element] = Field(
Expand Down

0 comments on commit cf2316b

Please sign in to comment.