Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
esoteric-ephemera authored and tsmathis committed Jun 20, 2024
1 parent 39444c0 commit 8098704
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions emmet-core/emmet/core/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
Field,
field_validator,
model_validator,
PrivateAttr,
)
from pymatgen.analysis.structure_analyzer import oxide_type
from pymatgen.core.structure import Structure
Expand Down Expand Up @@ -383,12 +382,11 @@ class TaskDoc(StructureMetadata, extra="allow"):
run_type: Optional[RunType] = Field(
None, description="The functional used in the calculation."
)

calc_type: Optional[CalcType] = Field(
None, description="The functional and task type used in the calculation."
)


task_id: Optional[Union[MPID, str]] = Field(
None,
description="The (task) ID of this calculation, used as a universal reference across property documents."
Expand Down Expand Up @@ -464,10 +462,9 @@ class TaskDoc(StructureMetadata, extra="allow"):
# can't find them, throws an AttributeError. It does this before looking to see if the
# class has that attr defined on it.

#_structure_entry: Optional[ComputedStructureEntry] = PrivateAttr(None)
# _structure_entry: Optional[ComputedStructureEntry] = PrivateAttr(None)

def model_post_init(self, __context: Any) -> None:

# Always refresh task_type, calc_type, run_type
# See, e.g. https://github.com/materialsproject/emmet/issues/960
# where run_type's were set incorrectly in older versions of TaskDoc
Expand Down Expand Up @@ -739,21 +736,27 @@ def get_entry(
return ComputedEntry.from_dict(entry_dict)

@staticmethod
def _get_calc_type(calcs_reversed : list[Calculation], orig_inputs : OrigInputs) -> CalcType:
def _get_calc_type(
calcs_reversed: list[Calculation], orig_inputs: OrigInputs
) -> CalcType:
"""Get the calc type from calcs_reversed.
Returns
--------
CalcType
The type of calculation.
"""
inputs = calcs_reversed[0].input.model_dump() if len(calcs_reversed) > 0 else orig_inputs
inputs = (
calcs_reversed[0].input.model_dump()
if len(calcs_reversed) > 0
else orig_inputs
)
params = calcs_reversed[0].input.parameters
incar = calcs_reversed[0].input.incar
return calc_type(inputs, {**params, **incar})

@staticmethod
def _get_run_type(calcs_reversed : list[Calculation]) -> RunType:
def _get_run_type(calcs_reversed: list[Calculation]) -> RunType:
"""Get the run type from calcs_reversed.
Returns
Expand Down Expand Up @@ -786,6 +789,7 @@ def structure_entry(self) -> ComputedStructureEntry:
entry_id=self.entry.entry_id,
)


class TrajectoryDoc(BaseModel):
"""Model for task trajectory data."""

Expand Down

0 comments on commit 8098704

Please sign in to comment.