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:
- eventstr
Event this is a callback for.
- Returns:
- func
Function to use as a decorator for the object to be marked.
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:
- bool
Whether or not the object has been marked.
- static mark(obj)[source]
Mark that an object should be part of the registry.
- Parameters:
- objobject
The object to mark.
- Returns:
- obj
Object that has been marked. Returned to enable use as a decorator.
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:
- objobject
The object that should be treated as a rule.
- Returns:
- objobject
Return object to enable use as a decorator.
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.