in asfyaml/asfyaml.py [0:0]
def __init_subclass__(cls, name: str, env: str = "production", priority: int = DEFAULT_PRIORITY, **kwargs):
"""Instantiates a new sub-class of ASFYamlFeature. The :attr:`name` argument should be the
top dict keyword for this feature in .asf.yaml, for instance :kbd:`github` or :kbd:`pelican`.
The :attr:`env` variable can be used to denote which environment this .asf.yaml feature will
be available in. The default environment is :kbd:`production`, but this can be any name.
If a priority other than the default (5) is set, the feature will be run based on
that priority level (0 is highest, 10 lowest)m otherwise it will be run in order of
appearance in the YAML with the rest of the default priority features.
Example sub-class definition::
# Create a new feature that runs after most other features (priority 9)
class ASFTestFeature(ASFYamlFeature, name="test", priority=9):
schema = ... # If you want to supply a YAML schema, you can do so here. Otherwise, leave it out.
def run(self): # This is where your magic happens
pass
"""
cls.name = name
cls.env = env
cls.features.append(cls)
cls.priority = priority
super().__init_subclass__(**kwargs)