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)

Has an objected 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.

  • obj (func) – Function, or any callable, to be called when the corresponding event is triggered.

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]

Has an objected been marked?

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

static utility(class_obj)[source]

Mark the class as a Utility class