Beispiel #1
0
def run(*task_dicts):
    """Runs all Runners.

    Dynamic imports are used to ensure that the logger is initialized globally.

    Args:
        task_dicts: Either (new_task,) or (new_task, old_task).
    """
    log.init_logger()
    logger = log.getLogger()

    for T in task_dicts:
        logger.vdebug('Task Dictionary: %s', T)

    from hooks.runners import active
    from hooks.runners import github
    from hooks.runners import repeats
    from hooks.runners import tags
    from hooks.runners import validate

    new_task = task_dicts[0]
    new_task = tags.run(new_task, *task_dicts[1:])
    new_task = validate.run(new_task, *task_dicts[1:])
    new_task = github.run(new_task, *task_dicts[1:])
    new_task = active.run(new_task, *task_dicts[1:])
    new_task = repeats.run(new_task, *task_dicts[1:])

    return new_task
Beispiel #2
0
"""Custom Field Classes

Attributes:
    msg_fmt (str): Format string used to output messages to user.
"""

from abc import ABCMeta, abstractmethod

import gutils
from hooks.utils import log

logger = log.getLogger()
msg_fmt = "+{tag} => {field}{sep}{val}\n"


class FieldError(RuntimeError):
    """Generic exception raised by custom Field objects"""


class Field(metaclass=ABCMeta):
    """Abstract Field Class

    Attributes:
        msg (str): This message will be appended to the output displayed to the user after
            custom tag actions have been completed.
    """
    def __init__(self):
        self.msg = ''

    @abstractmethod
    def add(self, task, tag, field):