File: common.py

package info (click to toggle)
python-emmet-core 0.84.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 77,220 kB
  • sloc: python: 16,355; makefile: 30
file content (20 lines) | stat: -rw-r--r-- 422 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from emmet.core.utils import ValueEnum
from datetime import datetime
from monty.json import MontyDecoder


def convert_datetime(cls, v):
    if isinstance(v, dict):
        if v.get("$date"):
            return datetime.fromisoformat(v["$date"])

    return MontyDecoder().process_decoded(v)


class Status(ValueEnum):
    """
    State of a calculation/analysis.
    """

    SUCCESS = "successful"
    FAILED = "failed"