RegistryMarker

class jwst.associations.RegistryMarker[source]

Bases: object

Mark rules, callbacks, and modules for inclusion into a registry.

Methods Summary

callback(event)

Mark object as a callback for an event.

is_marked(obj)

Check to see if object has been marked.

mark(obj)

Mark that an object should be part of the registry.

rule(obj)

Mark object as rule.

schema(filename)

Mark a file as a schema source.

utility(class_obj)

Mark the class as a Utility class.

Methods Documentation

static callback(event)[source]

Mark object as a callback for an event.

Parameters:

event (str) – Event this is a callback for.

Returns:

Function to use as a decorator for the object to be marked.

Return type:

func

Notes

The following attributes are added to the object:

  • asnreg_role‘callback’

    The role the object as been assigned.

  • asnreg_events[event[, …]]

    The events this callable object is a callback for.

  • asnreg_markTrue

    Indicated that the object has been marked.

static is_marked(obj)[source]

Check to see if object has been marked.

Returns:

Whether or not the object has been marked.

Return type:

bool

static mark(obj)[source]

Mark that an object should be part of the registry.

Parameters:

obj (object) – The object to mark.

Returns:

Object that has been marked. Returned to enable use as a decorator.

Return type:

obj

Notes

The following attributes are added to the object:

  • asnreg_markTrue

    Attribute added to object and is set to True.

  • asnreg_rolestr or None

    If not already assigned, the role is left unspecified using None.

static rule(obj)[source]

Mark object as rule.

Parameters:

obj (object) – The object that should be treated as a rule.

Returns:

obj – Return object to enable use as a decorator.

Return type:

object

Notes

The following attributes are added to the object:

  • asnreg_role‘rule’

    Attributed added to object and set to rule.

  • asnreg_markTrue

    Attributed added to object and set to True.

static schema(filename)[source]

Mark a file as a schema source.

Returns:

The schema object.

Return type:

schema

static utility(class_obj)[source]

Mark the class as a Utility class.

Returns:

The marked object.

Return type:

object