disable_undo

sunpy.database.disable_undo(database)[source] [edit on github]

A context manager to disable saving the used commands in the undo history. This may be useful when it’s important to save memory because a big number of entries in the undo history may occupy a lot of memory space.

Examples

>>> from sunpy.database import disable_undo, Database
>>> from sunpy.database.tables import DatabaseEntry
>>> database = Database('sqlite:///:memory:')
>>> entry = DatabaseEntry()
>>> with disable_undo(database) as db:
...     db.add(entry)

# This will raise an EmptyCommandStackError >>> database.undo() # doctest: +SKIP