Skip to content

Commit

Permalink
ensure enums saved as values
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamd committed Oct 22, 2020
1 parent ad3b8d6 commit 8de0c00
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions emmet-core/emmet/core/provenance.py
Expand Up @@ -76,6 +76,9 @@ class Provenance(PropertyDoc):
description="List of history nodes specifying the transformations or orignation of this material",
)

class Config:
use_enum_values = True

@validator("authors")
def remove_duplicate_authors(cls, authors):
authors_dict = {entry.name.lower(): entry for entry in authors}
Expand Down
3 changes: 3 additions & 0 deletions emmet-core/emmet/core/symmetry.py
Expand Up @@ -55,6 +55,9 @@ class SymmetryData(BaseModel):

version: str = Field(None, title="SPGLib version")

class Config:
use_enum_values = True

@classmethod
def from_structure(cls, structure: Structure) -> "SymmetryData":
symprec = SETTINGS.SYMPREC
Expand Down
3 changes: 3 additions & 0 deletions emmet-core/emmet/core/vasp/task.py
Expand Up @@ -124,6 +124,9 @@ class TaskDocument(StructureMetadata):
None, description="List of sandboxes this task document is allowed in"
)

class Config:
use_enum_values = True

@property
def run_type(self) -> RunType:
return run_type(self.input.parameters)
Expand Down
1 change: 1 addition & 0 deletions emmet-core/emmet/core/vasp/validation.py
Expand Up @@ -36,6 +36,7 @@ class ValidationDoc(BaseModel):

class Config:
extra = "allow"
use_enum_values = True

@classmethod
def from_task_doc(
Expand Down
3 changes: 3 additions & 0 deletions emmet-core/emmet/core/xas.py
Expand Up @@ -29,6 +29,9 @@ class XASDoc(SpectrumDoc):
..., title="Absorption Edge", description="The interaction edge for XAS"
)

class Config:
use_enum_values = True

@classmethod
def from_spectrum(
cls,
Expand Down

0 comments on commit 8de0c00

Please sign in to comment.