punchbowl.data.history#

Classes#

HistoryEntry

History

Representation of the history of edits done to a PUNCH data object.

Module Contents#

class punchbowl.data.history.HistoryEntry#

Bases: tuple

datetime#
source#
comment#
class punchbowl.data.history.History[source]#

Representation of the history of edits done to a PUNCH data object.

_entries: list[HistoryEntry] = []#
add_entry(entry: HistoryEntry) None[source]#

Add an entry to the History log.

Parameters:

entry (HistoryEntry) – A HistoryEntry object to add to the History log

Return type:

None

add_now(source: str, comment: str) None[source]#

Add a new history entry at the current time.

Parameters:
  • source (str) – what module of the code the history entry originates from

  • comment (str) – a note of what the history comment means

Return type:

None

clear() None[source]#

Clear all the history entries so the History is blank.

Return type:

None

clear_entries_from_source(source: str) None[source]#

Clear all history entries from a given source.

__getitem__(index: int) HistoryEntry[source]#

Given an index, return the requested HistoryEntry.

Parameters:

index (int) – numerical index of the history entry, increasing number typically indicates an older entry

Returns:

history at specified index

Return type:

HistoryEntry

most_recent() HistoryEntry[source]#

Get the most recent HistoryEntry, i.e. the youngest.

Returns:

returns HistoryEntry that is the youngest

Return type:

HistoryEntry

__len__() int[source]#

Get length.

__str__() str[source]#

Format a string combining all the history entries.

Returns:

a combined record of the history entries

Return type:

str

__iter__() History[source]#

Iterate.

__hash__() int[source]#

Hash a history object.

__next__() HistoryEntry[source]#

Get next.

__eq__(other: History) bool[source]#

Check equality of two History objects.

classmethod from_fits_header(head: astropy.io.fits.Header) History[source]#

Construct a history from a FITS header.

Parameters:

head (Header) – a FITS header to read from

Returns:

the history derived from a given FITS header

Return type:

History