# Path: ob2/util/hooks.py
# def apply_filters(name, value, *args):
#     """
#     Applies all filters registered under NAME to VALUE.
# 
#     """
#     for _, hook in _HOOKS_FILTERS[name]:
#         value = hook(value, *args)
#     return value
# 
# def get_job(name):
#     """
#     Returns the job handler registered for NAME. If no job handler is registered, raises KeyError.
#     This function should only be used by ob2.dockergrader.worker.
# 
#     """
#     return _HOOKS_JOBS[name]


import re
import ob2.config as config
from glob import glob
from ob2.util.hooks import apply_filters, get_job


_assignment_by_name = None


def get_assignment_by_name(name, default=None):
    global _assignment_by_name
    if _assignment_by_name is None:
        _assignment_by_name = {assignment.name: assignment
                               for assignment in config.assignments}

# Path: ob2/util/hooks.py
# def apply_filters(name, value, *args):
#     """
#     Applies all filters registered under NAME to VALUE.
# 
#     """
#     for _, hook in _HOOKS_FILTERS[name]:
#         value = hook(value, *args)
#     return value
# 
# def get_job(name):
#     """
#     Returns the job handler registered for NAME. If no job handler is registered, raises KeyError.
#     This function should only be used by ob2.dockergrader.worker.
# 
#     """
#     return _HOOKS_JOBS[name]


# Path: ob2/util/config_data.py
import re
import ob2.config as config
from glob import glob
from ob2.util.hooks import apply_filters, get_job



_assignment_by_name = None


def get_assignment_by_name(name, default=None):
    global _assignment_by_name
    if _assignment_by_name is None:
        _assignment_by_name = {assignment.name: assignment
                               for assignment in config.assignments}

    return _assignment_by_name[name]