Beispiel #1
0
    def __init__(self):
        """Create an instance of this class.

        """
        self._url_map = Map([Rule("/", methods=["GET"], endpoint="get")],
                            encoding_errors="strict")

        self._task_types = plugin_list("cms.grading.tasktypes", "tasktypes")
Beispiel #2
0
def _load_languages():
    """Load the available languages and fills all other data structures."""
    if len(LANGUAGES) > 0:
        return

    for cls in plugin_list("cms.grading.languages"):
        language = cls()
        LANGUAGES.append(language)
        _BY_NAME[language.name] = language
        HEADER_EXTS.update(language.header_extensions)
        OBJECT_EXTS.update(language.object_extensions)
        SOURCE_EXTS.update(language.source_extensions)
Beispiel #3
0
def _load_languages():
    """Load the available languages and fills all other data structures."""
    if len(LANGUAGES) > 0:
        return

    LANGUAGES.extend(language() for language in plugin_list(
        "cms.grading.languages", "languages"))
    _BY_NAME.update((language.name, language) for language in LANGUAGES)
    for lang in LANGUAGES:
        HEADER_EXTS.update(lang.header_extensions)
        OBJECT_EXTS.update(lang.object_extensions)
        SOURCE_EXTS.update(lang.source_extensions)
Beispiel #4
0
def _load_languages():
    """Load the available languages and fills all other data structures."""
    if len(LANGUAGES) > 0:
        return

    LANGUAGES.extend(
        language()
        for language in plugin_list("cms.grading.languages", "languages"))
    _BY_NAME.update((language.name, language) for language in LANGUAGES)
    for lang in LANGUAGES:
        HEADER_EXTS.update(lang.header_extensions)
        OBJECT_EXTS.update(lang.object_extensions)
        SOURCE_EXTS.update(lang.source_extensions)
Beispiel #5
0
def _load_languages():
    """Load the available languages and fills all other data structures."""
    global LANGUAGES, _BY_NAME, HEADER_EXTS, OBJECT_EXTS, SOURCE_EXTS
    if LANGUAGES != []:
        return

    LANGUAGES = [
        language()
        for language in plugin_list("cms.grading.languages", "languages")
    ]
    _BY_NAME = dict((language.name, language) for language in LANGUAGES)
    for lang in LANGUAGES:
        HEADER_EXTS |= set(lang.header_extensions)
        OBJECT_EXTS |= set(lang.object_extensions)
        SOURCE_EXTS |= set(lang.source_extensions)
Beispiel #6
0
def _load_languages():
    """Load the available languages and fills all other data structures."""
    global LANGUAGES, _BY_NAME, HEADER_EXTS, OBJECT_EXTS, SOURCE_EXTS
    if LANGUAGES != []:
        return

    LANGUAGES = [
        language()
        for language in plugin_list("cms.grading.languages", "languages")
    ]
    _BY_NAME = dict(
        (language.name, language) for language in LANGUAGES)
    for lang in LANGUAGES:
        HEADER_EXTS |= set(lang.header_extensions)
        OBJECT_EXTS |= set(lang.object_extensions)
        SOURCE_EXTS |= set(lang.source_extensions)
Beispiel #7
0
    "get_task_type",
    # abc
    "TaskType",
    # util
    "create_sandbox",
    "delete_sandbox",
    "is_manager_for_compilation",
    "set_configuration_error",
    "check_executables_number",
    "check_files_number",
    "check_manager_present",
    "eval_output",
]

TASK_TYPES = dict(
    (cls.__name__, cls) for cls in plugin_list("cms.grading.tasktypes"))


def get_task_type_class(name):
    """Load the TaskType class given as parameter."""
    return TASK_TYPES[name]


def get_task_type(name, parameters):
    """Construct the TaskType specified by parameters.

    Load the TaskType class named "name" and instantiate it with the
    data structure obtained by JSON-decoding "parameters".

    name (str): the name of the TaskType class.
    parameters (object): the parameters.
Beispiel #8
0
from cms import plugin_list
from .abc import ScoreType, ScoreTypeAlone, ScoreTypeGroup


logger = logging.getLogger(__name__)


__all__ = [
    "SCORE_TYPES", "get_score_type", "get_score_type_class",
    # abc
    "ScoreType", "ScoreTypeAlone", "ScoreTypeGroup",
]


SCORE_TYPES = dict((cls.__name__, cls)
                   for cls in plugin_list("cms.grading.scoretypes"))


def get_score_type_class(name):
    """Load the ScoreType class given as parameter."""
    return SCORE_TYPES[name]


def get_score_type(name, parameters, public_testcases):
    """Construct the ScoreType specified by parameters.

    Load the ScoreType class named "name" and instantiate it with the
    data structure obtained by JSON-decoding "parameters" and with the
    dict "public_testcases".

    name (str): the name of the ScoreType class.
Beispiel #9
0

__all__ = [
    "TASK_TYPES", "get_task_type_class", "get_task_type",
    # abc
    "TaskType",
    # util
    "create_sandbox", "delete_sandbox",
    "is_manager_for_compilation", "set_configuration_error",
    "check_executables_number", "check_files_number", "check_manager_present",
    "eval_output",
]


TASK_TYPES = dict((cls.__name__, cls)
                  for cls in plugin_list("cms.grading.tasktypes"))


def get_task_type_class(name):
    """Load the TaskType class given as parameter."""
    return TASK_TYPES[name]


def get_task_type(name, parameters):
    """Construct the TaskType specified by parameters.

    Load the TaskType class named "name" and instantiate it with the
    data structure obtained by JSON-decoding "parameters".

    name (str): the name of the TaskType class.
    parameters (object): the parameters.