diff options
author | Joris | 2020-06-06 17:44:26 +0200 |
---|---|---|
committer | Joris | 2020-06-06 19:54:03 +0200 |
commit | 1595e0de940a86a7810df0e02e43838d97c0d846 (patch) | |
tree | 9701eeec0d98baa9f6044b1911df68e4c8539819 /todo/model/status.py | |
parent | 6b9195000eb5404c247288b384d7ca2bacc1ab23 (diff) | |
download | todo-1595e0de940a86a7810df0e02e43838d97c0d846.tar.gz todo-1595e0de940a86a7810df0e02e43838d97c0d846.tar.bz2 todo-1595e0de940a86a7810df0e02e43838d97c0d846.zip |
Provide nix build
Diffstat (limited to 'todo/model/status.py')
-rw-r--r-- | todo/model/status.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/todo/model/status.py b/todo/model/status.py new file mode 100644 index 0000000..6881e0a --- /dev/null +++ b/todo/model/status.py @@ -0,0 +1,30 @@ +from enum import IntEnum +from typing import Optional + +class Status(IntEnum): + READY = 0 + WAITING = 1 + MAYBE = 2 + +values = [ + Status.READY, + Status.WAITING, + Status.MAYBE] + +def format(status: Status) -> str: + if status == Status.READY: + return "Ready" + elif status == Status.WAITING: + return "Waiting" + elif status == Status.MAYBE: + return "Maybe" + +def parse(string: str) -> Optional[Status]: + if string == "Ready": + return Status.READY + elif string == "Waiting": + return Status.WAITING + elif string == "Maybe": + return Status.MAYBE + else: + return None |