lifecycle.py

The LifeCycle is a core component for the internal workings of Markata. It sets fourth the hooks available, the methods to run them on the Markata instance, and the order they run in.

Usage

from markata import Lifecycle

step = Lifecycle.glob

LifeCycle class

LifeCycle currently supports the following steps.

LifeCycle source
class LifeCycle(Enum):
    """
    LifeCycle currently supports the following steps.

    * configure - load and fix configuration
    * glob - find files
    * load - load files
    * pre_render - clean up files/metadata before render
    * render - render content
    * post_render - clean up rendered content
    * save - store results to disk

    """

    configure = auto()
    glob = auto()
    load = auto()
    pre_render = auto()
    render = auto()
    post_render = auto()
    save = auto()
    teardown = auto()

    def __lt__(self, other: object) -> bool:
        """
        Determine whether other is less than this instance.
        """
        if isinstance(other, LifeCycle):
            return self.value < other.value
        if isinstance(other, int):
            return self.value < other
        return NotImplemented

    def __eq__(self, other: object) -> bool:
        """
        Determine whether other is equal to this instance.
        """
        if isinstance(other, LifeCycle):
            return self.value == other.value
        if isinstance(other, int):
            return self.value == other
        return NotImplemented

lt method

Determine whether other is less than this instance.

lt source
def __lt__(self, other: object) -> bool:
        """
        Determine whether other is less than this instance.
        """
        if isinstance(other, LifeCycle):
            return self.value < other.value
        if isinstance(other, int):
            return self.value < other
        return NotImplemented

eq method

Determine whether other is equal to this instance.

eq source
def __eq__(self, other: object) -> bool:
        """
        Determine whether other is equal to this instance.
        """
        if isinstance(other, LifeCycle):
            return self.value == other.value
        if isinstance(other, int):
            return self.value == other
        return NotImplemented