• Bram Schoenmakers's avatar
    Load dependency information on demand · 61253864
    Bram Schoenmakers authored
    Not all commands always need dependencies (pri, depri, ls -x), but all
    administration is still built up every time a TodoList is instantiated.
    Now, as soon as something dependency related is requested from the
    TodoList, the dependency graph and caches are initialized.
    
    A decorator is used to mark methods in TodoList that require an
    initialized graph.
    
    This change impacts the calculation of the average importance (based on
    the todo's ancestors). Importance doesn't have a notion of TodoList (and
    I would like to keep it that way), so the calculation needs access to
    the parents somehow. This was done with a parents attribute stored with
    each Todo item, carefully kept up to date by the TodoList. This is
    cumbersome, instead, now a Todo item gets a parents() method that
    obtains the parents from the TodoList that keeps the todo item.
    61253864
TodoList.py 9.52 KB