# 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
    for path in profile_name_paths:
        with open(path) as f:
            if f.read().strip() == profile_name:
                break
    else:
        assert 0, ("I can't find an apparmor profile named %s\n"
                   "If this is a development environment, the VM provisioner should have set up "
                   "the 'ob2docker' apparmor profile for you.\n"
                   "Check out /sys/kernel/security/apparmor/policy/profiles/*/name for available "
                   "profiles.") % repr(profile_name)


def validate_config():
    if config.inst_account_enabled:
        assert config.mailer_enabled, \
            "The inst account forms plugin will not work without the mailer"
        assert config.inst_account_forms_path, \
            "The inst account forms plugin requires inst_account_forms_path"

    if config.groups_enabled:
        assert 1 <= config.group_min_size <= config.group_max_size
    else:
        assert not any([assignment.is_group for assignment in config.assignments]), \
            "Group assignments will not work if groups are not enabled."

    if config.dockergrader_apparmor_profile:
        _validate_apparmor_config(config.dockergrader_apparmor_profile)

    for assignment in config.assignments:
        if not assignment.manual_grading:

# 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

    for path in profile_name_paths:
        with open(path) as f:
            if f.read().strip() == profile_name:
                break
    else:
        assert 0, ("I can't find an apparmor profile named %s\n"
                   "If this is a development environment, the VM provisioner should have set up "
                   "the 'ob2docker' apparmor profile for you.\n"
                   "Check out /sys/kernel/security/apparmor/policy/profiles/*/name for available "
                   "profiles.") % repr(profile_name)


def validate_config():
    if config.inst_account_enabled:
        assert config.mailer_enabled, \
            "The inst account forms plugin will not work without the mailer"
        assert config.inst_account_forms_path, \
            "The inst account forms plugin requires inst_account_forms_path"

    if config.groups_enabled:
        assert 1 <= config.group_min_size <= config.group_max_size
    else:
        assert not any([assignment.is_group for assignment in config.assignments]), \
            "Group assignments will not work if groups are not enabled."

    if config.dockergrader_apparmor_profile:
        _validate_apparmor_config(config.dockergrader_apparmor_profile)

    for assignment in config.assignments:
        if not assignment.manual_grading:

            assert get_job(assignment.name), "No job found for %s" % assignment.name