TagSet

class astrodata.TagSet(add=None, remove=None, blocked_by=None, blocks=None, if_present=None)[source]

Bases: TagSet

A named tuple of sets of tag strings.

Named tuple that is used by tag methods to return which actions should be performed on a tag set.

All the attributes are optional, and any combination of them can be used, allowing to create complex tag structures. Read the documentation on the tag-generating algorithm if you want to better understand the interactions.

The simplest TagSet, though, tends to just add tags to the global set.

It can be initialized by position, like any other tuple (the order of the arguments is the one in which the attributes are listed below). It can also be initialized by name.

add

Tags to be added to the global set

Type:

set of str, optional

remove

Tags to be removed from the global set

Type:

set of str, optional

blocked_by

Tags that will prevent this TagSet from being applied

Type:

set of str, optional

blocks

Other TagSets containing these won’t be applied

Type:

set of str, optional

if_present

This TagSet will be applied only all of these tags are present

Type:

set of str, optional

Examples

>>> TagSet()  
TagSet(
    add=set(),
    remove=set(),
    blocked_by=set(),
    blocks=set(),
    if_present=set()
)
>>> TagSet({'BIAS', 'CAL'})  
TagSet(
    add={'BIAS', 'CAL'}, # These tags are added to the global set
    remove=set(),
    blocked_by=set(),
    blocks=set(),
    if_present=set()
)
>>> TagSet(remove={'BIAS', 'CAL'}) 
TagSet(
    add=set(),
    remove={'BIAS', 'CAL'}, # These tags are removed from the global set
    blocked_by=set(),
    blocks=set(),
    if_present=set()
)

Notes

If arguments are not provided, the default is an empty set.

These arguments are not applied within the object, instead they are used when tags are being applied to an AstroData object.

Instantiate a new TagSet object.