cobra.util.context Module Contents

class cobra.util.context.HistoryManager[source]

Record a list of actions to be taken at a later time. Used to implement context managers that allow temporary changes to a Model.


Add the corresponding method to the history stack.

Parameters:operation (function) – A function to be called at a later time

Trigger executions for all items in the stack in reverse order


Search for a context manager


A decorator to simplify the context management of simple object attributes. Gets the value of the attribute prior to setting it, and stores a function to set the value to the old value in the HistoryManager.