handle more fixmes, add make_dict

This commit is contained in:
Dima Gerasimov 2020-03-24 20:12:44 +00:00
parent 3365f979ed
commit c3812fc2e7
7 changed files with 24 additions and 11 deletions

View file

@ -8,7 +8,7 @@ from pathlib import Path
from typing import Dict, List, Optional, Iterator
from datetime import datetime
from .common import LazyLogger, get_files, group_by_key, cproperty
from .common import LazyLogger, get_files, group_by_key, cproperty, make_dict
from .kython.kompress import open as kopen
from mycfg import rtm as config
@ -90,9 +90,7 @@ class DAL:
def get_todos_by_uid(self) -> Dict[str, MyTodo]:
todos = self.all_todos()
# TODO use make_dict?
res = {todo.uid: todo for todo in todos}
return res
return make_dict(todos, key=lambda t: t.uid)
def get_todos_by_title(self) -> Dict[str, List[MyTodo]]:
todos = self.all_todos()