15.1.1.7.1.2. cobra.util.context

15.1.1.7.1.2.1. 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.

__init__()[source]
__call__(operation)[source]

Add the corresponding method to the history stack.

Parameters:operation (function) – A function to be called at a later time
reset()[source]

Trigger executions for all items in the stack in reverse order

cobra.util.context.get_context(obj)[source]

Search for a context manager

cobra.util.context.resettable(f)[source]

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.