RegistryMarker

class jwst.associations.RegistryMarker[source]

Bases: object

Mark rules, callbacks, and module

Methods Summary

callback(event) Mark object as a callback for an event
is_marked(obj)
mark(obj) Mark that 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.
  • Modifies
  • --------
  • _asnreg_role ('callback') – Attributed added to object and set to rule
  • _asnreg_events ([event[, ..]]) – The events this callable object is a callback for.
  • _asnreg_mark (True) – Attributed added to object and set to True
Returns:

obj – Return object to enable use as a decorator.

Return type:

object

static is_marked(obj)[source]
static mark(obj)[source]

Mark that object should be part of the registry

Parameters:
  • obj (object) – The object to mark
  • Modifies
  • --------
  • _asnreg_mark (True) – Attribute added to object and is set to True
  • _asnreg_role (str or None) – Attribute added to object indicating role this object plays. If None, no particular role is indicated.
Returns:

obj – Return object to enable use as a decorator.

Return type:

object

static rule(obj)[source]

Mark object as rule

Parameters:
  • obj (object) – The object that should be treated as a rule
  • Modifies
  • --------
  • _asnreg_role ('rule') – Attributed added to object and set to rule
  • _asnreg_mark (True) – Attributed added to object and set to True
Returns:

obj – Return object to enable use as a decorator.

Return type:

object

static schema(filename)[source]

Mark a file as a schema source

static utility(class_obj)[source]

Mark the class as a Utility class