repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
UCL-INGI/INGInious
inginious/frontend/submission_manager.py
WebAppSubmissionManager._handle_ssh_callback
def _handle_ssh_callback(self, submission_id, host, port, password): """ Handles the creation of a remote ssh server """ if host is not None: # ignore late calls (a bit hacky, but...) obj = { "ssh_host": host, "ssh_port": port, "ssh_password":...
python
def _handle_ssh_callback(self, submission_id, host, port, password): """ Handles the creation of a remote ssh server """ if host is not None: # ignore late calls (a bit hacky, but...) obj = { "ssh_host": host, "ssh_port": port, "ssh_password":...
[ "def", "_handle_ssh_callback", "(", "self", ",", "submission_id", ",", "host", ",", "port", ",", "password", ")", ":", "if", "host", "is", "not", "None", ":", "obj", "=", "{", "\"ssh_host\"", ":", "host", ",", "\"ssh_port\"", ":", "port", ",", "\"ssh_pas...
Handles the creation of a remote ssh server
[ "Handles", "the", "creation", "of", "a", "remote", "ssh", "server" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/submission_manager.py#L569-L577
train
UCL-INGI/INGInious
inginious/common/entrypoints.py
filesystem_from_config_dict
def filesystem_from_config_dict(config_fs): """ Given a dict containing an entry "module" which contains a FSProvider identifier, parse the configuration and returns a fs_provider. Exits if there is an error. """ if "module" not in config_fs: print("Key 'module' should be defined for the fil...
python
def filesystem_from_config_dict(config_fs): """ Given a dict containing an entry "module" which contains a FSProvider identifier, parse the configuration and returns a fs_provider. Exits if there is an error. """ if "module" not in config_fs: print("Key 'module' should be defined for the fil...
[ "def", "filesystem_from_config_dict", "(", "config_fs", ")", ":", "if", "\"module\"", "not", "in", "config_fs", ":", "print", "(", "\"Key 'module' should be defined for the filesystem provider ('fs' configuration option)\"", ",", "file", "=", "sys", ".", "stderr", ")", "e...
Given a dict containing an entry "module" which contains a FSProvider identifier, parse the configuration and returns a fs_provider. Exits if there is an error.
[ "Given", "a", "dict", "containing", "an", "entry", "module", "which", "contains", "a", "FSProvider", "identifier", "parse", "the", "configuration", "and", "returns", "a", "fs_provider", ".", "Exits", "if", "there", "is", "an", "error", "." ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/common/entrypoints.py#L20-L48
train
UCL-INGI/INGInious
inginious/agent/docker_agent/_timeout_watcher.py
TimeoutWatcher._kill_it_with_fire
async def _kill_it_with_fire(self, container_id): """ Kill a container, with fire. """ if container_id in self._watching: self._watching.remove(container_id) self._container_had_error.add(container_id) try: await self._docker_interface....
python
async def _kill_it_with_fire(self, container_id): """ Kill a container, with fire. """ if container_id in self._watching: self._watching.remove(container_id) self._container_had_error.add(container_id) try: await self._docker_interface....
[ "async", "def", "_kill_it_with_fire", "(", "self", ",", "container_id", ")", ":", "if", "container_id", "in", "self", ".", "_watching", ":", "self", ".", "_watching", ".", "remove", "(", "container_id", ")", "self", ".", "_container_had_error", ".", "add", "...
Kill a container, with fire.
[ "Kill", "a", "container", "with", "fire", "." ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/agent/docker_agent/_timeout_watcher.py#L95-L105
train
UCL-INGI/INGInious
inginious/frontend/cookieless_app.py
CookieLessCompatibleSession._cleanup
def _cleanup(self): """Cleanup the stored sessions""" current_time = time.time() timeout = self._config.timeout if current_time - self._last_cleanup_time > timeout: self.store.cleanup(timeout) self._last_cleanup_time = current_time
python
def _cleanup(self): """Cleanup the stored sessions""" current_time = time.time() timeout = self._config.timeout if current_time - self._last_cleanup_time > timeout: self.store.cleanup(timeout) self._last_cleanup_time = current_time
[ "def", "_cleanup", "(", "self", ")", ":", "current_time", "=", "time", ".", "time", "(", ")", "timeout", "=", "self", ".", "_config", ".", "timeout", "if", "current_time", "-", "self", ".", "_last_cleanup_time", ">", "timeout", ":", "self", ".", "store",...
Cleanup the stored sessions
[ "Cleanup", "the", "stored", "sessions" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/cookieless_app.py#L255-L261
train
UCL-INGI/INGInious
inginious/frontend/cookieless_app.py
CookieLessCompatibleSession.expired
def expired(self): """Called when an expired session is atime""" self._data["_killed"] = True self.save() raise SessionExpired(self._config.expired_message)
python
def expired(self): """Called when an expired session is atime""" self._data["_killed"] = True self.save() raise SessionExpired(self._config.expired_message)
[ "def", "expired", "(", "self", ")", ":", "self", ".", "_data", "[", "\"_killed\"", "]", "=", "True", "self", ".", "save", "(", ")", "raise", "SessionExpired", "(", "self", ".", "_config", ".", "expired_message", ")" ]
Called when an expired session is atime
[ "Called", "when", "an", "expired", "session", "is", "atime" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/cookieless_app.py#L263-L267
train
UCL-INGI/INGInious
inginious/frontend/pages/preferences/delete.py
DeletePage.delete_account
def delete_account(self, data): """ Delete account from DB """ error = False msg = "" username = self.user_manager.session_username() # Check input format result = self.database.users.find_one_and_delete({"username": username, ...
python
def delete_account(self, data): """ Delete account from DB """ error = False msg = "" username = self.user_manager.session_username() # Check input format result = self.database.users.find_one_and_delete({"username": username, ...
[ "def", "delete_account", "(", "self", ",", "data", ")", ":", "error", "=", "False", "msg", "=", "\"\"", "username", "=", "self", ".", "user_manager", ".", "session_username", "(", ")", "result", "=", "self", ".", "database", ".", "users", ".", "find_one_...
Delete account from DB
[ "Delete", "account", "from", "DB" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/preferences/delete.py#L15-L41
train
UCL-INGI/INGInious
inginious/common/custom_yaml.py
dump
def dump(data, stream=None, **kwds): """ Serialize a Python object into a YAML stream. If stream is None, return the produced string instead. Dict keys are produced in the order in which they appear in OrderedDicts. Safe version. If objects are not "conventional" objects, t...
python
def dump(data, stream=None, **kwds): """ Serialize a Python object into a YAML stream. If stream is None, return the produced string instead. Dict keys are produced in the order in which they appear in OrderedDicts. Safe version. If objects are not "conventional" objects, t...
[ "def", "dump", "(", "data", ",", "stream", "=", "None", ",", "**", "kwds", ")", ":", "class", "OrderedDumper", "(", "SafeDumper", ")", ":", "pass", "def", "_dict_representer", "(", "dumper", ",", "data", ")", ":", "return", "dumper", ".", "represent_mapp...
Serialize a Python object into a YAML stream. If stream is None, return the produced string instead. Dict keys are produced in the order in which they appear in OrderedDicts. Safe version. If objects are not "conventional" objects, they will be dumped converted to string with the str()...
[ "Serialize", "a", "Python", "object", "into", "a", "YAML", "stream", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", ".", "Dict", "keys", "are", "produced", "in", "the", "order", "in", "which", "they", "appear", "in", ...
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/common/custom_yaml.py#L40-L87
train
UCL-INGI/INGInious
inginious/frontend/pages/api/tasks.py
APITasks._check_for_parsable_text
def _check_for_parsable_text(self, val): """ Util to remove parsable text from a dict, recursively """ if isinstance(val, ParsableText): return val.original_content() if isinstance(val, list): for key, val2 in enumerate(val): val[key] = self._check_for_par...
python
def _check_for_parsable_text(self, val): """ Util to remove parsable text from a dict, recursively """ if isinstance(val, ParsableText): return val.original_content() if isinstance(val, list): for key, val2 in enumerate(val): val[key] = self._check_for_par...
[ "def", "_check_for_parsable_text", "(", "self", ",", "val", ")", ":", "if", "isinstance", "(", "val", ",", "ParsableText", ")", ":", "return", "val", ".", "original_content", "(", ")", "if", "isinstance", "(", "val", ",", "list", ")", ":", "for", "key", ...
Util to remove parsable text from a dict, recursively
[ "Util", "to", "remove", "parsable", "text", "from", "a", "dict", "recursively" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/api/tasks.py#L17-L28
train
UCL-INGI/INGInious
inginious/frontend/pages/api/tasks.py
APITasks.API_GET
def API_GET(self, courseid, taskid=None): # pylint: disable=arguments-differ """ List tasks available to the connected client. Returns a dict in the form :: { "taskid1": { "name": "Name of the course", ...
python
def API_GET(self, courseid, taskid=None): # pylint: disable=arguments-differ """ List tasks available to the connected client. Returns a dict in the form :: { "taskid1": { "name": "Name of the course", ...
[ "def", "API_GET", "(", "self", ",", "courseid", ",", "taskid", "=", "None", ")", ":", "try", ":", "course", "=", "self", ".", "course_factory", ".", "get_course", "(", "courseid", ")", "except", ":", "raise", "APINotFound", "(", "\"Course not found\"", ")"...
List tasks available to the connected client. Returns a dict in the form :: { "taskid1": { "name": "Name of the course", #the name of the course "authors": [], "deadline": ""...
[ "List", "tasks", "available", "to", "the", "connected", "client", ".", "Returns", "a", "dict", "in", "the", "form" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/api/tasks.py#L30-L103
train
UCL-INGI/INGInious
base-containers/base/inginious/input.py
load_input
def load_input(): """ Open existing input file """ file = open(_input_file, 'r') result = json.loads(file.read().strip('\0').strip()) file.close() return result
python
def load_input(): """ Open existing input file """ file = open(_input_file, 'r') result = json.loads(file.read().strip('\0').strip()) file.close() return result
[ "def", "load_input", "(", ")", ":", "file", "=", "open", "(", "_input_file", ",", "'r'", ")", "result", "=", "json", ".", "loads", "(", "file", ".", "read", "(", ")", ".", "strip", "(", "'\\0'", ")", ".", "strip", "(", ")", ")", "file", ".", "c...
Open existing input file
[ "Open", "existing", "input", "file" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/base-containers/base/inginious/input.py#L14-L19
train
UCL-INGI/INGInious
base-containers/base/inginious/input.py
parse_template
def parse_template(input_filename, output_filename=''): """ Parses a template file Replaces all occurences of @@problem_id@@ by the value of the 'problem_id' key in data dictionary input_filename: file to parse output_filename: if not specified, overwrite input file """ ...
python
def parse_template(input_filename, output_filename=''): """ Parses a template file Replaces all occurences of @@problem_id@@ by the value of the 'problem_id' key in data dictionary input_filename: file to parse output_filename: if not specified, overwrite input file """ ...
[ "def", "parse_template", "(", "input_filename", ",", "output_filename", "=", "''", ")", ":", "data", "=", "load_input", "(", ")", "with", "open", "(", "input_filename", ",", "'rb'", ")", "as", "file", ":", "template", "=", "file", ".", "read", "(", ")", ...
Parses a template file Replaces all occurences of @@problem_id@@ by the value of the 'problem_id' key in data dictionary input_filename: file to parse output_filename: if not specified, overwrite input file
[ "Parses", "a", "template", "file", "Replaces", "all", "occurences", "of" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/base-containers/base/inginious/input.py#L49-L92
train
UCL-INGI/INGInious
inginious/client/client.py
_callable_once
def _callable_once(func): """ Returns a function that is only callable once; any other call will do nothing """ def once(*args, **kwargs): if not once.called: once.called = True return func(*args, **kwargs) once.called = False return once
python
def _callable_once(func): """ Returns a function that is only callable once; any other call will do nothing """ def once(*args, **kwargs): if not once.called: once.called = True return func(*args, **kwargs) once.called = False return once
[ "def", "_callable_once", "(", "func", ")", ":", "def", "once", "(", "*", "args", ",", "**", "kwargs", ")", ":", "if", "not", "once", ".", "called", ":", "once", ".", "called", "=", "True", "return", "func", "(", "*", "args", ",", "**", "kwargs", ...
Returns a function that is only callable once; any other call will do nothing
[ "Returns", "a", "function", "that", "is", "only", "callable", "once", ";", "any", "other", "call", "will", "do", "nothing" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/client/client.py#L17-L26
train
UCL-INGI/INGInious
inginious/client/client.py
Client._ask_queue_update
async def _ask_queue_update(self): """ Send a ClientGetQueue message to the backend, if one is not already sent """ try: while True: await asyncio.sleep(self._queue_update_timer) if self._queue_update_last_attempt == 0 or self._queue_update_last_attempt > self...
python
async def _ask_queue_update(self): """ Send a ClientGetQueue message to the backend, if one is not already sent """ try: while True: await asyncio.sleep(self._queue_update_timer) if self._queue_update_last_attempt == 0 or self._queue_update_last_attempt > self...
[ "async", "def", "_ask_queue_update", "(", "self", ")", ":", "try", ":", "while", "True", ":", "await", "asyncio", ".", "sleep", "(", "self", ".", "_queue_update_timer", ")", "if", "self", ".", "_queue_update_last_attempt", "==", "0", "or", "self", ".", "_q...
Send a ClientGetQueue message to the backend, if one is not already sent
[ "Send", "a", "ClientGetQueue", "message", "to", "the", "backend", "if", "one", "is", "not", "already", "sent" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/client/client.py#L144-L162
train
UCL-INGI/INGInious
inginious/client/client.py
Client._handle_job_queue_update
async def _handle_job_queue_update(self, message: BackendGetQueue): """ Handles a BackendGetQueue containing a snapshot of the job queue """ self._logger.debug("Received job queue update") self._queue_update_last_attempt = 0 self._queue_cache = message # Do some precomputation ...
python
async def _handle_job_queue_update(self, message: BackendGetQueue): """ Handles a BackendGetQueue containing a snapshot of the job queue """ self._logger.debug("Received job queue update") self._queue_update_last_attempt = 0 self._queue_cache = message # Do some precomputation ...
[ "async", "def", "_handle_job_queue_update", "(", "self", ",", "message", ":", "BackendGetQueue", ")", ":", "self", ".", "_logger", ".", "debug", "(", "\"Received job queue update\"", ")", "self", ".", "_queue_update_last_attempt", "=", "0", "self", ".", "_queue_ca...
Handles a BackendGetQueue containing a snapshot of the job queue
[ "Handles", "a", "BackendGetQueue", "containing", "a", "snapshot", "of", "the", "job", "queue" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/client/client.py#L164-L185
train
UCL-INGI/INGInious
inginious/client/client.py
Client.new_job
def new_job(self, task, inputdata, callback, launcher_name="Unknown", debug=False, ssh_callback=None): """ Add a new job. Every callback will be called once and only once. :type task: Task :param inputdata: input from the student :type inputdata: Storage or dict :param callback:...
python
def new_job(self, task, inputdata, callback, launcher_name="Unknown", debug=False, ssh_callback=None): """ Add a new job. Every callback will be called once and only once. :type task: Task :param inputdata: input from the student :type inputdata: Storage or dict :param callback:...
[ "def", "new_job", "(", "self", ",", "task", ",", "inputdata", ",", "callback", ",", "launcher_name", "=", "\"Unknown\"", ",", "debug", "=", "False", ",", "ssh_callback", "=", "None", ")", ":", "job_id", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ...
Add a new job. Every callback will be called once and only once. :type task: Task :param inputdata: input from the student :type inputdata: Storage or dict :param callback: a function that will be called asynchronously in the client's process, with the results. it's signatur...
[ "Add", "a", "new", "job", ".", "Every", "callback", "will", "be", "called", "once", "and", "only", "once", "." ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/client/client.py#L253-L311
train
UCL-INGI/INGInious
inginious/client/client.py
Client.kill_job
def kill_job(self, job_id): """ Kills a running job """ self._loop.call_soon_threadsafe(asyncio.ensure_future, self._simple_send(ClientKillJob(job_id)))
python
def kill_job(self, job_id): """ Kills a running job """ self._loop.call_soon_threadsafe(asyncio.ensure_future, self._simple_send(ClientKillJob(job_id)))
[ "def", "kill_job", "(", "self", ",", "job_id", ")", ":", "self", ".", "_loop", ".", "call_soon_threadsafe", "(", "asyncio", ".", "ensure_future", ",", "self", ".", "_simple_send", "(", "ClientKillJob", "(", "job_id", ")", ")", ")" ]
Kills a running job
[ "Kills", "a", "running", "job" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/client/client.py#L313-L317
train
UCL-INGI/INGInious
base-containers/base/inginious/rst.py
get_codeblock
def get_codeblock(language, text): """ Generates rst codeblock for given text and language """ rst = "\n\n.. code-block:: " + language + "\n\n" for line in text.splitlines(): rst += "\t" + line + "\n" rst += "\n" return rst
python
def get_codeblock(language, text): """ Generates rst codeblock for given text and language """ rst = "\n\n.. code-block:: " + language + "\n\n" for line in text.splitlines(): rst += "\t" + line + "\n" rst += "\n" return rst
[ "def", "get_codeblock", "(", "language", ",", "text", ")", ":", "rst", "=", "\"\\n\\n.. code-block:: \"", "+", "language", "+", "\"\\n\\n\"", "for", "line", "in", "text", ".", "splitlines", "(", ")", ":", "rst", "+=", "\"\\t\"", "+", "line", "+", "\"\\n\""...
Generates rst codeblock for given text and language
[ "Generates", "rst", "codeblock", "for", "given", "text", "and", "language" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/base-containers/base/inginious/rst.py#L9-L16
train
UCL-INGI/INGInious
base-containers/base/inginious/rst.py
get_imageblock
def get_imageblock(filename, format=''): """ Generates rst raw block for given image filename and format""" _, extension = os.path.splitext(filename) with open(filename, "rb") as image_file: encoded_string = base64.b64encode(image_file.read()).decode('utf-8') return '\n\n.. raw:: html\n\n\t<im...
python
def get_imageblock(filename, format=''): """ Generates rst raw block for given image filename and format""" _, extension = os.path.splitext(filename) with open(filename, "rb") as image_file: encoded_string = base64.b64encode(image_file.read()).decode('utf-8') return '\n\n.. raw:: html\n\n\t<im...
[ "def", "get_imageblock", "(", "filename", ",", "format", "=", "''", ")", ":", "_", ",", "extension", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "with", "open", "(", "filename", ",", "\"rb\"", ")", "as", "image_file", ":", "encoded_s...
Generates rst raw block for given image filename and format
[ "Generates", "rst", "raw", "block", "for", "given", "image", "filename", "and", "format" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/base-containers/base/inginious/rst.py#L18-L25
train
UCL-INGI/INGInious
base-containers/base/inginious/rst.py
get_admonition
def get_admonition(cssclass, title, text): """ Generates rst admonition block given a bootstrap alert css class, title, and text""" rst = ("\n\n.. admonition:: " + title + "\n") if title else "\n\n.. note:: \n" rst += "\t:class: alert alert-" + cssclass + "\n\n" for line in text.splitlines(): rs...
python
def get_admonition(cssclass, title, text): """ Generates rst admonition block given a bootstrap alert css class, title, and text""" rst = ("\n\n.. admonition:: " + title + "\n") if title else "\n\n.. note:: \n" rst += "\t:class: alert alert-" + cssclass + "\n\n" for line in text.splitlines(): rs...
[ "def", "get_admonition", "(", "cssclass", ",", "title", ",", "text", ")", ":", "rst", "=", "(", "\"\\n\\n.. admonition:: \"", "+", "title", "+", "\"\\n\"", ")", "if", "title", "else", "\"\\n\\n.. note:: \\n\"", "rst", "+=", "\"\\t:class: alert alert-\"", "+", "c...
Generates rst admonition block given a bootstrap alert css class, title, and text
[ "Generates", "rst", "admonition", "block", "given", "a", "bootstrap", "alert", "css", "class", "title", "and", "text" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/base-containers/base/inginious/rst.py#L27-L35
train
UCL-INGI/INGInious
base-containers/base/inginious/lang.py
init
def init(): """ Install gettext with the default parameters """ if "_" not in builtins.__dict__: # avoid installing lang two times os.environ["LANGUAGE"] = inginious.input.get_lang() if inginious.DEBUG: gettext.install("messages", get_lang_dir_path()) else: gette...
python
def init(): """ Install gettext with the default parameters """ if "_" not in builtins.__dict__: # avoid installing lang two times os.environ["LANGUAGE"] = inginious.input.get_lang() if inginious.DEBUG: gettext.install("messages", get_lang_dir_path()) else: gette...
[ "def", "init", "(", ")", ":", "if", "\"_\"", "not", "in", "builtins", ".", "__dict__", ":", "os", ".", "environ", "[", "\"LANGUAGE\"", "]", "=", "inginious", ".", "input", ".", "get_lang", "(", ")", "if", "inginious", ".", "DEBUG", ":", "gettext", "....
Install gettext with the default parameters
[ "Install", "gettext", "with", "the", "default", "parameters" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/base-containers/base/inginious/lang.py#L22-L29
train
UCL-INGI/INGInious
inginious/common/filesystems/local.py
LocalFSProvider._recursive_overwrite
def _recursive_overwrite(self, src, dest): """ Copy src to dest, recursively and with file overwrite. """ if os.path.isdir(src): if not os.path.isdir(dest): os.makedirs(dest) files = os.listdir(src) for f in files: self....
python
def _recursive_overwrite(self, src, dest): """ Copy src to dest, recursively and with file overwrite. """ if os.path.isdir(src): if not os.path.isdir(dest): os.makedirs(dest) files = os.listdir(src) for f in files: self....
[ "def", "_recursive_overwrite", "(", "self", ",", "src", ",", "dest", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "src", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "dest", ")", ":", "os", ".", "makedirs", "(", "dest", ...
Copy src to dest, recursively and with file overwrite.
[ "Copy", "src", "to", "dest", "recursively", "and", "with", "file", "overwrite", "." ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/common/filesystems/local.py#L134-L146
train
UCL-INGI/INGInious
inginious/frontend/plugins/git_repo/__init__.py
init
def init(plugin_manager, _, _2, config): """ Init the plugin Available configuration: :: plugins: - plugin_module: inginious.frontend.plugins.git_repo repo_directory: "./repo_submissions" """ submission_git_saver = SubmissionGitSaver(p...
python
def init(plugin_manager, _, _2, config): """ Init the plugin Available configuration: :: plugins: - plugin_module: inginious.frontend.plugins.git_repo repo_directory: "./repo_submissions" """ submission_git_saver = SubmissionGitSaver(p...
[ "def", "init", "(", "plugin_manager", ",", "_", ",", "_2", ",", "config", ")", ":", "submission_git_saver", "=", "SubmissionGitSaver", "(", "plugin_manager", ",", "config", ")", "submission_git_saver", ".", "daemon", "=", "True", "submission_git_saver", ".", "st...
Init the plugin Available configuration: :: plugins: - plugin_module: inginious.frontend.plugins.git_repo repo_directory: "./repo_submissions"
[ "Init", "the", "plugin" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/plugins/git_repo/__init__.py#L97-L111
train
UCL-INGI/INGInious
inginious/common/tags.py
Tag.get_type_as_str
def get_type_as_str(self): """ Return a textual description of the type """ if self.get_type() == 0: return _("Skill") elif self.get_type() == 1: return _("Misconception") elif self.get_type() == 2: return _("Category") else: return...
python
def get_type_as_str(self): """ Return a textual description of the type """ if self.get_type() == 0: return _("Skill") elif self.get_type() == 1: return _("Misconception") elif self.get_type() == 2: return _("Category") else: return...
[ "def", "get_type_as_str", "(", "self", ")", ":", "if", "self", ".", "get_type", "(", ")", "==", "0", ":", "return", "_", "(", "\"Skill\"", ")", "elif", "self", ".", "get_type", "(", ")", "==", "1", ":", "return", "_", "(", "\"Misconception\"", ")", ...
Return a textual description of the type
[ "Return", "a", "textual", "description", "of", "the", "type" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/common/tags.py#L58-L67
train
UCL-INGI/INGInious
inginious/common/tags.py
Tag.create_tags_from_dict
def create_tags_from_dict(cls, tag_dict): """ Build a tuple of list of Tag objects based on the tag_dict. The tuple contains 3 lists. - The first list contains skill tags - The second list contains misconception tags - The third list contains category...
python
def create_tags_from_dict(cls, tag_dict): """ Build a tuple of list of Tag objects based on the tag_dict. The tuple contains 3 lists. - The first list contains skill tags - The second list contains misconception tags - The third list contains category...
[ "def", "create_tags_from_dict", "(", "cls", ",", "tag_dict", ")", ":", "tag_list_common", "=", "[", "]", "tag_list_misconception", "=", "[", "]", "tag_list_organisational", "=", "[", "]", "for", "tag", "in", "tag_dict", ":", "try", ":", "id", "=", "tag_dict"...
Build a tuple of list of Tag objects based on the tag_dict. The tuple contains 3 lists. - The first list contains skill tags - The second list contains misconception tags - The third list contains category tags
[ "Build", "a", "tuple", "of", "list", "of", "Tag", "objects", "based", "on", "the", "tag_dict", ".", "The", "tuple", "contains", "3", "lists", ".", "-", "The", "first", "list", "contains", "skill", "tags", "-", "The", "second", "list", "contains", "miscon...
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/common/tags.py#L73-L100
train
UCL-INGI/INGInious
inginious/agent/__init__.py
Agent.run
async def run(self): """ Runs the agent. Answer to the requests made by the Backend. May raise an asyncio.CancelledError, in which case the agent should clean itself and restart completely. """ self._logger.info("Agent started") self.__backend_socket.connect(self.__backen...
python
async def run(self): """ Runs the agent. Answer to the requests made by the Backend. May raise an asyncio.CancelledError, in which case the agent should clean itself and restart completely. """ self._logger.info("Agent started") self.__backend_socket.connect(self.__backen...
[ "async", "def", "run", "(", "self", ")", ":", "self", ".", "_logger", ".", "info", "(", "\"Agent started\"", ")", "self", ".", "__backend_socket", ".", "connect", "(", "self", ".", "__backend_addr", ")", "self", ".", "_logger", ".", "info", "(", "\"Sayin...
Runs the agent. Answer to the requests made by the Backend. May raise an asyncio.CancelledError, in which case the agent should clean itself and restart completely.
[ "Runs", "the", "agent", ".", "Answer", "to", "the", "requests", "made", "by", "the", "Backend", ".", "May", "raise", "an", "asyncio", ".", "CancelledError", "in", "which", "case", "the", "agent", "should", "clean", "itself", "and", "restart", "completely", ...
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/agent/__init__.py#L100-L117
train
UCL-INGI/INGInious
inginious/agent/__init__.py
Agent.__check_last_ping
async def __check_last_ping(self, run_listen): """ Check if the last timeout is too old. If it is, kills the run_listen task """ if self.__last_ping < time.time()-10: self._logger.warning("Last ping too old. Restarting the agent.") run_listen.cancel() self.__cancel_re...
python
async def __check_last_ping(self, run_listen): """ Check if the last timeout is too old. If it is, kills the run_listen task """ if self.__last_ping < time.time()-10: self._logger.warning("Last ping too old. Restarting the agent.") run_listen.cancel() self.__cancel_re...
[ "async", "def", "__check_last_ping", "(", "self", ",", "run_listen", ")", ":", "if", "self", ".", "__last_ping", "<", "time", ".", "time", "(", ")", "-", "10", ":", "self", ".", "_logger", ".", "warning", "(", "\"Last ping too old. Restarting the agent.\"", ...
Check if the last timeout is too old. If it is, kills the run_listen task
[ "Check", "if", "the", "last", "timeout", "is", "too", "old", ".", "If", "it", "is", "kills", "the", "run_listen", "task" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/agent/__init__.py#L119-L126
train
UCL-INGI/INGInious
inginious/agent/__init__.py
Agent.__run_listen
async def __run_listen(self): """ Listen to the backend """ while True: message = await ZMQUtils.recv(self.__backend_socket) await self.__handle_backend_message(message)
python
async def __run_listen(self): """ Listen to the backend """ while True: message = await ZMQUtils.recv(self.__backend_socket) await self.__handle_backend_message(message)
[ "async", "def", "__run_listen", "(", "self", ")", ":", "while", "True", ":", "message", "=", "await", "ZMQUtils", ".", "recv", "(", "self", ".", "__backend_socket", ")", "await", "self", ".", "__handle_backend_message", "(", "message", ")" ]
Listen to the backend
[ "Listen", "to", "the", "backend" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/agent/__init__.py#L128-L132
train
UCL-INGI/INGInious
inginious/agent/__init__.py
Agent.__handle_ping
async def __handle_ping(self, _ : Ping): """ Handle a Ping message. Pong the backend """ self.__last_ping = time.time() await ZMQUtils.send(self.__backend_socket, Pong())
python
async def __handle_ping(self, _ : Ping): """ Handle a Ping message. Pong the backend """ self.__last_ping = time.time() await ZMQUtils.send(self.__backend_socket, Pong())
[ "async", "def", "__handle_ping", "(", "self", ",", "_", ":", "Ping", ")", ":", "self", ".", "__last_ping", "=", "time", ".", "time", "(", ")", "await", "ZMQUtils", ".", "send", "(", "self", ".", "__backend_socket", ",", "Pong", "(", ")", ")" ]
Handle a Ping message. Pong the backend
[ "Handle", "a", "Ping", "message", ".", "Pong", "the", "backend" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/agent/__init__.py#L147-L150
train
UCL-INGI/INGInious
inginious/frontend/pages/course_admin/utils.py
get_menu
def get_menu(course, current, renderer, plugin_manager, user_manager): """ Returns the HTML of the menu used in the administration. ```current``` is the current page of section """ default_entries = [] if user_manager.has_admin_rights_on_course(course): default_entries += [("settings", "<i class='fa...
python
def get_menu(course, current, renderer, plugin_manager, user_manager): """ Returns the HTML of the menu used in the administration. ```current``` is the current page of section """ default_entries = [] if user_manager.has_admin_rights_on_course(course): default_entries += [("settings", "<i class='fa...
[ "def", "get_menu", "(", "course", ",", "current", ",", "renderer", ",", "plugin_manager", ",", "user_manager", ")", ":", "default_entries", "=", "[", "]", "if", "user_manager", ".", "has_admin_rights_on_course", "(", "course", ")", ":", "default_entries", "+=", ...
Returns the HTML of the menu used in the administration. ```current``` is the current page of section
[ "Returns", "the", "HTML", "of", "the", "menu", "used", "in", "the", "administration", ".", "current", "is", "the", "current", "page", "of", "section" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/utils.py#L252-L278
train
UCL-INGI/INGInious
inginious/frontend/pages/course_admin/utils.py
UnicodeWriter.writerow
def writerow(self, row): """ Writes a row to the CSV file """ self.writer.writerow(row) # Fetch UTF-8 output from the queue ... data = self.queue.getvalue() # write to the target stream self.stream.write(data) # empty queue self.queue.truncate(0) s...
python
def writerow(self, row): """ Writes a row to the CSV file """ self.writer.writerow(row) # Fetch UTF-8 output from the queue ... data = self.queue.getvalue() # write to the target stream self.stream.write(data) # empty queue self.queue.truncate(0) s...
[ "def", "writerow", "(", "self", ",", "row", ")", ":", "self", ".", "writer", ".", "writerow", "(", "row", ")", "data", "=", "self", ".", "queue", ".", "getvalue", "(", ")", "self", ".", "stream", ".", "write", "(", "data", ")", "self", ".", "queu...
Writes a row to the CSV file
[ "Writes", "a", "row", "to", "the", "CSV", "file" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/utils.py#L175-L184
train
UCL-INGI/INGInious
inginious/frontend/template_helper.py
TemplateHelper.get_renderer
def get_renderer(self, with_layout=True): """ Get the default renderer """ if with_layout and self.is_lti(): return self._default_renderer_lti elif with_layout: return self._default_renderer else: return self._default_renderer_nolayout
python
def get_renderer(self, with_layout=True): """ Get the default renderer """ if with_layout and self.is_lti(): return self._default_renderer_lti elif with_layout: return self._default_renderer else: return self._default_renderer_nolayout
[ "def", "get_renderer", "(", "self", ",", "with_layout", "=", "True", ")", ":", "if", "with_layout", "and", "self", ".", "is_lti", "(", ")", ":", "return", "self", ".", "_default_renderer_lti", "elif", "with_layout", ":", "return", "self", ".", "_default_rend...
Get the default renderer
[ "Get", "the", "default", "renderer" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/template_helper.py#L63-L70
train
UCL-INGI/INGInious
inginious/frontend/template_helper.py
TemplateHelper._javascript_helper
def _javascript_helper(self, position): """ Add javascript links for the current page and for the plugins """ if position not in ["header", "footer"]: position = "footer" # Load javascript files from plugins if position == "header": entries = [entry for entry in ...
python
def _javascript_helper(self, position): """ Add javascript links for the current page and for the plugins """ if position not in ["header", "footer"]: position = "footer" # Load javascript files from plugins if position == "header": entries = [entry for entry in ...
[ "def", "_javascript_helper", "(", "self", ",", "position", ")", ":", "if", "position", "not", "in", "[", "\"header\"", ",", "\"footer\"", "]", ":", "position", "=", "\"footer\"", "if", "position", "==", "\"header\"", ":", "entries", "=", "[", "entry", "for...
Add javascript links for the current page and for the plugins
[ "Add", "javascript", "links", "for", "the", "current", "page", "and", "for", "the", "plugins" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/template_helper.py#L117-L130
train
UCL-INGI/INGInious
inginious/frontend/template_helper.py
TemplateHelper._css_helper
def _css_helper(self): """ Add CSS links for the current page and for the plugins """ entries = [entry for entry in self._plugin_manager.call_hook("css") if entry is not None] # Load javascript for the current page entries += self._get_ctx()["css"] entries = ["<link href='" + ent...
python
def _css_helper(self): """ Add CSS links for the current page and for the plugins """ entries = [entry for entry in self._plugin_manager.call_hook("css") if entry is not None] # Load javascript for the current page entries += self._get_ctx()["css"] entries = ["<link href='" + ent...
[ "def", "_css_helper", "(", "self", ")", ":", "entries", "=", "[", "entry", "for", "entry", "in", "self", ".", "_plugin_manager", ".", "call_hook", "(", "\"css\"", ")", "if", "entry", "is", "not", "None", "]", "entries", "+=", "self", ".", "_get_ctx", "...
Add CSS links for the current page and for the plugins
[ "Add", "CSS", "links", "for", "the", "current", "page", "and", "for", "the", "plugins" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/template_helper.py#L132-L138
train
UCL-INGI/INGInious
inginious/frontend/template_helper.py
TemplateHelper._get_ctx
def _get_ctx(self): """ Get web.ctx object for the Template helper """ if self._WEB_CTX_KEY not in web.ctx: web.ctx[self._WEB_CTX_KEY] = { "javascript": {"footer": [], "header": []}, "css": []} return web.ctx.get(self._WEB_CTX_KEY)
python
def _get_ctx(self): """ Get web.ctx object for the Template helper """ if self._WEB_CTX_KEY not in web.ctx: web.ctx[self._WEB_CTX_KEY] = { "javascript": {"footer": [], "header": []}, "css": []} return web.ctx.get(self._WEB_CTX_KEY)
[ "def", "_get_ctx", "(", "self", ")", ":", "if", "self", ".", "_WEB_CTX_KEY", "not", "in", "web", ".", "ctx", ":", "web", ".", "ctx", "[", "self", ".", "_WEB_CTX_KEY", "]", "=", "{", "\"javascript\"", ":", "{", "\"footer\"", ":", "[", "]", ",", "\"h...
Get web.ctx object for the Template helper
[ "Get", "web", ".", "ctx", "object", "for", "the", "Template", "helper" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/template_helper.py#L140-L146
train
UCL-INGI/INGInious
inginious/frontend/template_helper.py
TemplateHelper._generic_hook
def _generic_hook(self, name, **kwargs): """ A generic hook that links the TemplateHelper with PluginManager """ entries = [entry for entry in self._plugin_manager.call_hook(name, **kwargs) if entry is not None] return "\n".join(entries)
python
def _generic_hook(self, name, **kwargs): """ A generic hook that links the TemplateHelper with PluginManager """ entries = [entry for entry in self._plugin_manager.call_hook(name, **kwargs) if entry is not None] return "\n".join(entries)
[ "def", "_generic_hook", "(", "self", ",", "name", ",", "**", "kwargs", ")", ":", "entries", "=", "[", "entry", "for", "entry", "in", "self", ".", "_plugin_manager", ".", "call_hook", "(", "name", ",", "**", "kwargs", ")", "if", "entry", "is", "not", ...
A generic hook that links the TemplateHelper with PluginManager
[ "A", "generic", "hook", "that", "links", "the", "TemplateHelper", "with", "PluginManager" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/template_helper.py#L148-L151
train
UCL-INGI/INGInious
inginious/client/client_buffer.py
ClientBuffer.new_job
def new_job(self, task, inputdata, launcher_name="Unknown", debug=False): """ Runs a new job. It works exactly like the Client class, instead that there is no callback """ bjobid = uuid.uuid4() self._waiting_jobs.append(str(bjobid)) self._client.new_job(task, inputdata, ...
python
def new_job(self, task, inputdata, launcher_name="Unknown", debug=False): """ Runs a new job. It works exactly like the Client class, instead that there is no callback """ bjobid = uuid.uuid4() self._waiting_jobs.append(str(bjobid)) self._client.new_job(task, inputdata, ...
[ "def", "new_job", "(", "self", ",", "task", ",", "inputdata", ",", "launcher_name", "=", "\"Unknown\"", ",", "debug", "=", "False", ")", ":", "bjobid", "=", "uuid", ".", "uuid4", "(", ")", "self", ".", "_waiting_jobs", ".", "append", "(", "str", "(", ...
Runs a new job. It works exactly like the Client class, instead that there is no callback
[ "Runs", "a", "new", "job", ".", "It", "works", "exactly", "like", "the", "Client", "class", "instead", "that", "there", "is", "no", "callback" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/client/client_buffer.py#L19-L27
train
UCL-INGI/INGInious
inginious/client/client_buffer.py
ClientBuffer._callback
def _callback(self, bjobid, result, grade, problems, tests, custom, archive, stdout, stderr): """ Callback for self._client.new_job """ self._jobs_done[str(bjobid)] = (result, grade, problems, tests, custom, archive, stdout, stderr) self._waiting_jobs.remove(str(bjobid))
python
def _callback(self, bjobid, result, grade, problems, tests, custom, archive, stdout, stderr): """ Callback for self._client.new_job """ self._jobs_done[str(bjobid)] = (result, grade, problems, tests, custom, archive, stdout, stderr) self._waiting_jobs.remove(str(bjobid))
[ "def", "_callback", "(", "self", ",", "bjobid", ",", "result", ",", "grade", ",", "problems", ",", "tests", ",", "custom", ",", "archive", ",", "stdout", ",", "stderr", ")", ":", "self", ".", "_jobs_done", "[", "str", "(", "bjobid", ")", "]", "=", ...
Callback for self._client.new_job
[ "Callback", "for", "self", ".", "_client", ".", "new_job" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/client/client_buffer.py#L29-L32
train
UCL-INGI/INGInious
inginious/frontend/plugins/auth/ldap_auth.py
init
def init(plugin_manager, _, _2, conf): """ Allow to connect through a LDAP service Available configuration: :: plugins: - plugin_module": "inginious.frontend.plugins.auth.ldap_auth", host: "ldap.test.be", port: 0, ...
python
def init(plugin_manager, _, _2, conf): """ Allow to connect through a LDAP service Available configuration: :: plugins: - plugin_module": "inginious.frontend.plugins.auth.ldap_auth", host: "ldap.test.be", port: 0, ...
[ "def", "init", "(", "plugin_manager", ",", "_", ",", "_2", ",", "conf", ")", ":", "encryption", "=", "conf", ".", "get", "(", "\"encryption\"", ",", "\"none\"", ")", "if", "encryption", "not", "in", "[", "\"none\"", ",", "\"ssl\"", ",", "\"tls\"", "]",...
Allow to connect through a LDAP service Available configuration: :: plugins: - plugin_module": "inginious.frontend.plugins.auth.ldap_auth", host: "ldap.test.be", port: 0, encryption: "ssl", base_dn: "o...
[ "Allow", "to", "connect", "through", "a", "LDAP", "service" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/plugins/auth/ldap_auth.py#L127-L165
train
UCL-INGI/INGInious
inginious/frontend/session_mongodb.py
MongoStore.cleanup
def cleanup(self, timeout): ''' Removes all sessions older than ``timeout`` seconds. Called automatically on every session access. ''' cutoff = time() - timeout self.collection.remove({_atime: {'$lt': cutoff}})
python
def cleanup(self, timeout): ''' Removes all sessions older than ``timeout`` seconds. Called automatically on every session access. ''' cutoff = time() - timeout self.collection.remove({_atime: {'$lt': cutoff}})
[ "def", "cleanup", "(", "self", ",", "timeout", ")", ":", "cutoff", "=", "time", "(", ")", "-", "timeout", "self", ".", "collection", ".", "remove", "(", "{", "_atime", ":", "{", "'$lt'", ":", "cutoff", "}", "}", ")" ]
Removes all sessions older than ``timeout`` seconds. Called automatically on every session access.
[ "Removes", "all", "sessions", "older", "than", "timeout", "seconds", ".", "Called", "automatically", "on", "every", "session", "access", "." ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/session_mongodb.py#L114-L120
train
UCL-INGI/INGInious
inginious/frontend/plugin_manager.py
PluginManager.load
def load(self, client, webpy_app, course_factory, task_factory, database, user_manager, submission_manager, config): """ Loads the plugin manager. Must be done after the initialisation of the client """ self._app = webpy_app self._task_factory = task_factory self._database = database ...
python
def load(self, client, webpy_app, course_factory, task_factory, database, user_manager, submission_manager, config): """ Loads the plugin manager. Must be done after the initialisation of the client """ self._app = webpy_app self._task_factory = task_factory self._database = database ...
[ "def", "load", "(", "self", ",", "client", ",", "webpy_app", ",", "course_factory", ",", "task_factory", ",", "database", ",", "user_manager", ",", "submission_manager", ",", "config", ")", ":", "self", ".", "_app", "=", "webpy_app", "self", ".", "_task_fact...
Loads the plugin manager. Must be done after the initialisation of the client
[ "Loads", "the", "plugin", "manager", ".", "Must", "be", "done", "after", "the", "initialisation", "of", "the", "client" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/plugin_manager.py#L28-L38
train
UCL-INGI/INGInious
inginious/frontend/plugin_manager.py
PluginManager.add_page
def add_page(self, pattern, classname): """ Add a new page to the web application. Only available after that the Plugin Manager is loaded """ if not self._loaded: raise PluginManagerNotLoadedException() self._app.add_mapping(pattern, classname)
python
def add_page(self, pattern, classname): """ Add a new page to the web application. Only available after that the Plugin Manager is loaded """ if not self._loaded: raise PluginManagerNotLoadedException() self._app.add_mapping(pattern, classname)
[ "def", "add_page", "(", "self", ",", "pattern", ",", "classname", ")", ":", "if", "not", "self", ".", "_loaded", ":", "raise", "PluginManagerNotLoadedException", "(", ")", "self", ".", "_app", ".", "add_mapping", "(", "pattern", ",", "classname", ")" ]
Add a new page to the web application. Only available after that the Plugin Manager is loaded
[ "Add", "a", "new", "page", "to", "the", "web", "application", ".", "Only", "available", "after", "that", "the", "Plugin", "Manager", "is", "loaded" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/plugin_manager.py#L40-L44
train
UCL-INGI/INGInious
inginious/frontend/plugin_manager.py
PluginManager.add_task_file_manager
def add_task_file_manager(self, task_file_manager): """ Add a task file manager. Only available after that the Plugin Manager is loaded """ if not self._loaded: raise PluginManagerNotLoadedException() self._task_factory.add_custom_task_file_manager(task_file_manager)
python
def add_task_file_manager(self, task_file_manager): """ Add a task file manager. Only available after that the Plugin Manager is loaded """ if not self._loaded: raise PluginManagerNotLoadedException() self._task_factory.add_custom_task_file_manager(task_file_manager)
[ "def", "add_task_file_manager", "(", "self", ",", "task_file_manager", ")", ":", "if", "not", "self", ".", "_loaded", ":", "raise", "PluginManagerNotLoadedException", "(", ")", "self", ".", "_task_factory", ".", "add_custom_task_file_manager", "(", "task_file_manager"...
Add a task file manager. Only available after that the Plugin Manager is loaded
[ "Add", "a", "task", "file", "manager", ".", "Only", "available", "after", "that", "the", "Plugin", "Manager", "is", "loaded" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/plugin_manager.py#L46-L50
train
UCL-INGI/INGInious
inginious/frontend/plugin_manager.py
PluginManager.register_auth_method
def register_auth_method(self, auth_method): """ Register a new authentication method name the name of the authentication method, typically displayed by the webapp input_to_display Only available after that the Plugin Manager is loaded "...
python
def register_auth_method(self, auth_method): """ Register a new authentication method name the name of the authentication method, typically displayed by the webapp input_to_display Only available after that the Plugin Manager is loaded "...
[ "def", "register_auth_method", "(", "self", ",", "auth_method", ")", ":", "if", "not", "self", ".", "_loaded", ":", "raise", "PluginManagerNotLoadedException", "(", ")", "self", ".", "_user_manager", ".", "register_auth_method", "(", "auth_method", ")" ]
Register a new authentication method name the name of the authentication method, typically displayed by the webapp input_to_display Only available after that the Plugin Manager is loaded
[ "Register", "a", "new", "authentication", "method" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/plugin_manager.py#L52-L65
train
UCL-INGI/INGInious
inginious/frontend/pages/course_admin/danger_zone.py
CourseDangerZonePage.dump_course
def dump_course(self, courseid): """ Create a zip file containing all information about a given course in database and then remove it from db""" filepath = os.path.join(self.backup_dir, courseid, datetime.datetime.now().strftime("%Y%m%d.%H%M%S") + ".zip") if not os.path.exists(os.path.dirname(f...
python
def dump_course(self, courseid): """ Create a zip file containing all information about a given course in database and then remove it from db""" filepath = os.path.join(self.backup_dir, courseid, datetime.datetime.now().strftime("%Y%m%d.%H%M%S") + ".zip") if not os.path.exists(os.path.dirname(f...
[ "def", "dump_course", "(", "self", ",", "courseid", ")", ":", "filepath", "=", "os", ".", "path", ".", "join", "(", "self", ".", "backup_dir", ",", "courseid", ",", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "\"%Y%m%d.%H%M...
Create a zip file containing all information about a given course in database and then remove it from db
[ "Create", "a", "zip", "file", "containing", "all", "information", "about", "a", "given", "course", "in", "database", "and", "then", "remove", "it", "from", "db" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/danger_zone.py#L39-L65
train
UCL-INGI/INGInious
inginious/frontend/pages/course_admin/danger_zone.py
CourseDangerZonePage.delete_course
def delete_course(self, courseid): """ Erase all course data """ # Wipes the course (delete database) self.wipe_course(courseid) # Deletes the course from the factory (entire folder) self.course_factory.delete_course(courseid) # Removes backup filepath = os.path...
python
def delete_course(self, courseid): """ Erase all course data """ # Wipes the course (delete database) self.wipe_course(courseid) # Deletes the course from the factory (entire folder) self.course_factory.delete_course(courseid) # Removes backup filepath = os.path...
[ "def", "delete_course", "(", "self", ",", "courseid", ")", ":", "self", ".", "wipe_course", "(", "courseid", ")", "self", ".", "course_factory", ".", "delete_course", "(", "courseid", ")", "filepath", "=", "os", ".", "path", ".", "join", "(", "self", "."...
Erase all course data
[ "Erase", "all", "course", "data" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/danger_zone.py#L93-L107
train
UCL-INGI/INGInious
inginious/frontend/task_problems.py
DisplayableCodeProblem.show_input
def show_input(self, template_helper, language, seed): """ Show BasicCodeProblem and derivatives """ header = ParsableText(self.gettext(language,self._header), "rst", translation=self._translations.get(language, gettext.NullTranslations())) return str(DisplayableCod...
python
def show_input(self, template_helper, language, seed): """ Show BasicCodeProblem and derivatives """ header = ParsableText(self.gettext(language,self._header), "rst", translation=self._translations.get(language, gettext.NullTranslations())) return str(DisplayableCod...
[ "def", "show_input", "(", "self", ",", "template_helper", ",", "language", ",", "seed", ")", ":", "header", "=", "ParsableText", "(", "self", ".", "gettext", "(", "language", ",", "self", ".", "_header", ")", ",", "\"rst\"", ",", "translation", "=", "sel...
Show BasicCodeProblem and derivatives
[ "Show", "BasicCodeProblem", "and", "derivatives" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/task_problems.py#L66-L70
train
UCL-INGI/INGInious
inginious/frontend/task_problems.py
DisplayableMultipleChoiceProblem.show_input
def show_input(self, template_helper, language, seed): """ Show multiple choice problems """ choices = [] limit = self._limit if limit == 0: limit = len(self._choices) # no limit rand = Random("{}#{}#{}".format(self.get_task().get_id(), self.get_id(), seed)) ...
python
def show_input(self, template_helper, language, seed): """ Show multiple choice problems """ choices = [] limit = self._limit if limit == 0: limit = len(self._choices) # no limit rand = Random("{}#{}#{}".format(self.get_task().get_id(), self.get_id(), seed)) ...
[ "def", "show_input", "(", "self", ",", "template_helper", ",", "language", ",", "seed", ")", ":", "choices", "=", "[", "]", "limit", "=", "self", ".", "_limit", "if", "limit", "==", "0", ":", "limit", "=", "len", "(", "self", ".", "_choices", ")", ...
Show multiple choice problems
[ "Show", "multiple", "choice", "problems" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/task_problems.py#L153-L199
train
UCL-INGI/INGInious
inginious/frontend/pages/lti.py
LTILaunchPage._parse_lti_data
def _parse_lti_data(self, courseid, taskid): """ Verify and parse the data for the LTI basic launch """ post_input = web.webapi.rawinput("POST") self.logger.debug('_parse_lti_data:' + str(post_input)) try: course = self.course_factory.get_course(courseid) except exce...
python
def _parse_lti_data(self, courseid, taskid): """ Verify and parse the data for the LTI basic launch """ post_input = web.webapi.rawinput("POST") self.logger.debug('_parse_lti_data:' + str(post_input)) try: course = self.course_factory.get_course(courseid) except exce...
[ "def", "_parse_lti_data", "(", "self", ",", "courseid", ",", "taskid", ")", ":", "post_input", "=", "web", ".", "webapi", ".", "rawinput", "(", "\"POST\"", ")", "self", ".", "logger", ".", "debug", "(", "'_parse_lti_data:'", "+", "str", "(", "post_input", ...
Verify and parse the data for the LTI basic launch
[ "Verify", "and", "parse", "the", "data", "for", "the", "LTI", "basic", "launch" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/lti.py#L145-L197
train
UCL-INGI/INGInious
inginious/frontend/pages/lti.py
LTILaunchPage._find_realname
def _find_realname(self, post_input): """ Returns the most appropriate name to identify the user """ # First, try the full name if "lis_person_name_full" in post_input: return post_input["lis_person_name_full"] if "lis_person_name_given" in post_input and "lis_person_name_fa...
python
def _find_realname(self, post_input): """ Returns the most appropriate name to identify the user """ # First, try the full name if "lis_person_name_full" in post_input: return post_input["lis_person_name_full"] if "lis_person_name_given" in post_input and "lis_person_name_fa...
[ "def", "_find_realname", "(", "self", ",", "post_input", ")", ":", "if", "\"lis_person_name_full\"", "in", "post_input", ":", "return", "post_input", "[", "\"lis_person_name_full\"", "]", "if", "\"lis_person_name_given\"", "in", "post_input", "and", "\"lis_person_name_f...
Returns the most appropriate name to identify the user
[ "Returns", "the", "most", "appropriate", "name", "to", "identify", "the", "user" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/lti.py#L199-L218
train
UCL-INGI/INGInious
inginious/frontend/pages/course_admin/statistics.py
fast_stats
def fast_stats(data): """ Compute base statistics about submissions """ total_submission = len(data) total_submission_best = 0 total_submission_best_succeeded = 0 for submission in data: if "best" in submission and submission["best"]: total_submission_best = total_s...
python
def fast_stats(data): """ Compute base statistics about submissions """ total_submission = len(data) total_submission_best = 0 total_submission_best_succeeded = 0 for submission in data: if "best" in submission and submission["best"]: total_submission_best = total_s...
[ "def", "fast_stats", "(", "data", ")", ":", "total_submission", "=", "len", "(", "data", ")", "total_submission_best", "=", "0", "total_submission_best_succeeded", "=", "0", "for", "submission", "in", "data", ":", "if", "\"best\"", "in", "submission", "and", "...
Compute base statistics about submissions
[ "Compute", "base", "statistics", "about", "submissions" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/statistics.py#L172-L193
train
UCL-INGI/INGInious
inginious/client/_zeromq_client.py
BetterParanoidPirateClient._register_transaction
def _register_transaction(self, send_msg, recv_msg, coroutine_recv, coroutine_abrt, get_key=None, inter_msg=None): """ Register a type of message to be sent. After this message has been sent, if the answer is received, callback_recv is called. If the remote server becomes dones, calls ca...
python
def _register_transaction(self, send_msg, recv_msg, coroutine_recv, coroutine_abrt, get_key=None, inter_msg=None): """ Register a type of message to be sent. After this message has been sent, if the answer is received, callback_recv is called. If the remote server becomes dones, calls ca...
[ "def", "_register_transaction", "(", "self", ",", "send_msg", ",", "recv_msg", ",", "coroutine_recv", ",", "coroutine_abrt", ",", "get_key", "=", "None", ",", "inter_msg", "=", "None", ")", ":", "if", "get_key", "is", "None", ":", "get_key", "=", "lambda", ...
Register a type of message to be sent. After this message has been sent, if the answer is received, callback_recv is called. If the remote server becomes dones, calls callback_abrt. :param send_msg: class of message to be sent :param recv_msg: message that the server should send in resp...
[ "Register", "a", "type", "of", "message", "to", "be", "sent", ".", "After", "this", "message", "has", "been", "sent", "if", "the", "answer", "is", "received", "callback_recv", "is", "called", ".", "If", "the", "remote", "server", "becomes", "dones", "calls...
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/client/_zeromq_client.py#L49-L79
train
UCL-INGI/INGInious
inginious/client/_zeromq_client.py
BetterParanoidPirateClient._reconnect
async def _reconnect(self): """ Called when the remote server is innacessible and the connection has to be restarted """ # 1. Close all transactions for msg_class in self._transactions: _1, _2, _3, coroutine_abrt, _4 = self._msgs_registered[msg_class] if ...
python
async def _reconnect(self): """ Called when the remote server is innacessible and the connection has to be restarted """ # 1. Close all transactions for msg_class in self._transactions: _1, _2, _3, coroutine_abrt, _4 = self._msgs_registered[msg_class] if ...
[ "async", "def", "_reconnect", "(", "self", ")", ":", "for", "msg_class", "in", "self", ".", "_transactions", ":", "_1", ",", "_2", ",", "_3", ",", "coroutine_abrt", ",", "_4", "=", "self", ".", "_msgs_registered", "[", "msg_class", "]", "if", "coroutine_...
Called when the remote server is innacessible and the connection has to be restarted
[ "Called", "when", "the", "remote", "server", "is", "innacessible", "and", "the", "connection", "has", "to", "be", "restarted" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/client/_zeromq_client.py#L152-L178
train
UCL-INGI/INGInious
inginious/client/_zeromq_client.py
BetterParanoidPirateClient.client_start
async def client_start(self): """ Starts the client """ await self._start_socket() await self._on_connect() self._ping_count = 0 # Start the loops, and don't forget to add them to the list of asyncio task to close when the client restarts task_socket = s...
python
async def client_start(self): """ Starts the client """ await self._start_socket() await self._on_connect() self._ping_count = 0 # Start the loops, and don't forget to add them to the list of asyncio task to close when the client restarts task_socket = s...
[ "async", "def", "client_start", "(", "self", ")", ":", "await", "self", ".", "_start_socket", "(", ")", "await", "self", ".", "_on_connect", "(", ")", "self", ".", "_ping_count", "=", "0", "task_socket", "=", "self", ".", "_loop", ".", "create_task", "("...
Starts the client
[ "Starts", "the", "client" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/client/_zeromq_client.py#L180-L194
train
UCL-INGI/INGInious
inginious/client/_zeromq_client.py
BetterParanoidPirateClient._run_socket
async def _run_socket(self): """ Task that runs this client. """ try: while True: message = await ZMQUtils.recv(self._socket) msg_class = message.__msgtype__ if msg_class in self._handlers_registered: # If a ...
python
async def _run_socket(self): """ Task that runs this client. """ try: while True: message = await ZMQUtils.recv(self._socket) msg_class = message.__msgtype__ if msg_class in self._handlers_registered: # If a ...
[ "async", "def", "_run_socket", "(", "self", ")", ":", "try", ":", "while", "True", ":", "message", "=", "await", "ZMQUtils", ".", "recv", "(", "self", ".", "_socket", ")", "msg_class", "=", "message", ".", "__msgtype__", "if", "msg_class", "in", "self", ...
Task that runs this client.
[ "Task", "that", "runs", "this", "client", "." ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/client/_zeromq_client.py#L202-L232
train
UCL-INGI/INGInious
base-containers/base/inginious/feedback.py
load_feedback
def load_feedback(): """ Open existing feedback file """ result = {} if os.path.exists(_feedback_file): f = open(_feedback_file, 'r') cont = f.read() f.close() else: cont = '{}' try: result = json.loads(cont) if cont else {} except ValueError as e: ...
python
def load_feedback(): """ Open existing feedback file """ result = {} if os.path.exists(_feedback_file): f = open(_feedback_file, 'r') cont = f.read() f.close() else: cont = '{}' try: result = json.loads(cont) if cont else {} except ValueError as e: ...
[ "def", "load_feedback", "(", ")", ":", "result", "=", "{", "}", "if", "os", ".", "path", ".", "exists", "(", "_feedback_file", ")", ":", "f", "=", "open", "(", "_feedback_file", ",", "'r'", ")", "cont", "=", "f", ".", "read", "(", ")", "f", ".", ...
Open existing feedback file
[ "Open", "existing", "feedback", "file" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/base-containers/base/inginious/feedback.py#L18-L32
train
UCL-INGI/INGInious
base-containers/base/inginious/feedback.py
save_feedback
def save_feedback(rdict): """ Save feedback file """ # Check for output folder if not os.path.exists(_feedback_dir): os.makedirs(_feedback_dir) jcont = json.dumps(rdict) f = open(_feedback_file, 'w') f.write(jcont) f.close()
python
def save_feedback(rdict): """ Save feedback file """ # Check for output folder if not os.path.exists(_feedback_dir): os.makedirs(_feedback_dir) jcont = json.dumps(rdict) f = open(_feedback_file, 'w') f.write(jcont) f.close()
[ "def", "save_feedback", "(", "rdict", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "_feedback_dir", ")", ":", "os", ".", "makedirs", "(", "_feedback_dir", ")", "jcont", "=", "json", ".", "dumps", "(", "rdict", ")", "f", "=", "open", ...
Save feedback file
[ "Save", "feedback", "file" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/base-containers/base/inginious/feedback.py#L35-L44
train
UCL-INGI/INGInious
base-containers/base/inginious/feedback.py
set_problem_result
def set_problem_result(result, problem_id): """ Set problem specific result value """ rdict = load_feedback() if not 'problems' in rdict: rdict['problems'] = {} cur_val = rdict['problems'].get(problem_id, '') rdict['problems'][problem_id] = [result, cur_val] if type(cur_val) == str else [res...
python
def set_problem_result(result, problem_id): """ Set problem specific result value """ rdict = load_feedback() if not 'problems' in rdict: rdict['problems'] = {} cur_val = rdict['problems'].get(problem_id, '') rdict['problems'][problem_id] = [result, cur_val] if type(cur_val) == str else [res...
[ "def", "set_problem_result", "(", "result", ",", "problem_id", ")", ":", "rdict", "=", "load_feedback", "(", ")", "if", "not", "'problems'", "in", "rdict", ":", "rdict", "[", "'problems'", "]", "=", "{", "}", "cur_val", "=", "rdict", "[", "'problems'", "...
Set problem specific result value
[ "Set", "problem", "specific", "result", "value" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/base-containers/base/inginious/feedback.py#L55-L62
train
UCL-INGI/INGInious
base-containers/base/inginious/feedback.py
set_global_feedback
def set_global_feedback(feedback, append=False): """ Set global feedback in case of error """ rdict = load_feedback() rdict['text'] = rdict.get('text', '') + feedback if append else feedback save_feedback(rdict)
python
def set_global_feedback(feedback, append=False): """ Set global feedback in case of error """ rdict = load_feedback() rdict['text'] = rdict.get('text', '') + feedback if append else feedback save_feedback(rdict)
[ "def", "set_global_feedback", "(", "feedback", ",", "append", "=", "False", ")", ":", "rdict", "=", "load_feedback", "(", ")", "rdict", "[", "'text'", "]", "=", "rdict", ".", "get", "(", "'text'", ",", "''", ")", "+", "feedback", "if", "append", "else"...
Set global feedback in case of error
[ "Set", "global", "feedback", "in", "case", "of", "error" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/base-containers/base/inginious/feedback.py#L72-L76
train
UCL-INGI/INGInious
base-containers/base/inginious/feedback.py
set_problem_feedback
def set_problem_feedback(feedback, problem_id, append=False): """ Set problem specific feedback """ rdict = load_feedback() if not 'problems' in rdict: rdict['problems'] = {} cur_val = rdict['problems'].get(problem_id, '') rdict['problems'][problem_id] = (cur_val + feedback if append else fe...
python
def set_problem_feedback(feedback, problem_id, append=False): """ Set problem specific feedback """ rdict = load_feedback() if not 'problems' in rdict: rdict['problems'] = {} cur_val = rdict['problems'].get(problem_id, '') rdict['problems'][problem_id] = (cur_val + feedback if append else fe...
[ "def", "set_problem_feedback", "(", "feedback", ",", "problem_id", ",", "append", "=", "False", ")", ":", "rdict", "=", "load_feedback", "(", ")", "if", "not", "'problems'", "in", "rdict", ":", "rdict", "[", "'problems'", "]", "=", "{", "}", "cur_val", "...
Set problem specific feedback
[ "Set", "problem", "specific", "feedback" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/base-containers/base/inginious/feedback.py#L79-L86
train
UCL-INGI/INGInious
inginious/frontend/installer.py
Installer._display_big_warning
def _display_big_warning(self, content): """ Displays a BIG warning """ print("") print(BOLD + WARNING + "--- WARNING ---" + ENDC) print(WARNING + content + ENDC) print("")
python
def _display_big_warning(self, content): """ Displays a BIG warning """ print("") print(BOLD + WARNING + "--- WARNING ---" + ENDC) print(WARNING + content + ENDC) print("")
[ "def", "_display_big_warning", "(", "self", ",", "content", ")", ":", "print", "(", "\"\"", ")", "print", "(", "BOLD", "+", "WARNING", "+", "\"--- WARNING ---\"", "+", "ENDC", ")", "print", "(", "WARNING", "+", "content", "+", "ENDC", ")", "print", "(", ...
Displays a BIG warning
[ "Displays", "a", "BIG", "warning" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/installer.py#L64-L69
train
UCL-INGI/INGInious
inginious/frontend/installer.py
Installer._ask_local_config
def _ask_local_config(self): """ Ask some parameters about the local configuration """ options = {"backend": "local", "local-config": {}} # Concurrency while True: concurrency = self._ask_with_default( "Maximum concurrency (number of tasks running simultaneou...
python
def _ask_local_config(self): """ Ask some parameters about the local configuration """ options = {"backend": "local", "local-config": {}} # Concurrency while True: concurrency = self._ask_with_default( "Maximum concurrency (number of tasks running simultaneou...
[ "def", "_ask_local_config", "(", "self", ")", ":", "options", "=", "{", "\"backend\"", ":", "\"local\"", ",", "\"local-config\"", ":", "{", "}", "}", "while", "True", ":", "concurrency", "=", "self", ".", "_ask_with_default", "(", "\"Maximum concurrency (number ...
Ask some parameters about the local configuration
[ "Ask", "some", "parameters", "about", "the", "local", "configuration" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/installer.py#L170-L230
train
UCL-INGI/INGInious
inginious/frontend/installer.py
Installer.ask_backend
def ask_backend(self): """ Ask the user to choose the backend """ response = self._ask_boolean( "Do you have a local docker daemon (on Linux), do you use docker-machine via a local machine, or do you use " "Docker for macOS?", True) if (response): self._displa...
python
def ask_backend(self): """ Ask the user to choose the backend """ response = self._ask_boolean( "Do you have a local docker daemon (on Linux), do you use docker-machine via a local machine, or do you use " "Docker for macOS?", True) if (response): self._displa...
[ "def", "ask_backend", "(", "self", ")", ":", "response", "=", "self", ".", "_ask_boolean", "(", "\"Do you have a local docker daemon (on Linux), do you use docker-machine via a local machine, or do you use \"", "\"Docker for macOS?\"", ",", "True", ")", "if", "(", "response", ...
Ask the user to choose the backend
[ "Ask", "the", "user", "to", "choose", "the", "backend" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/installer.py#L252-L265
train
UCL-INGI/INGInious
inginious/frontend/installer.py
Installer.try_mongodb_opts
def try_mongodb_opts(self, host="localhost", database_name='INGInious'): """ Try MongoDB configuration """ try: mongo_client = MongoClient(host=host) except Exception as e: self._display_warning("Cannot connect to MongoDB on host %s: %s" % (host, str(e))) retu...
python
def try_mongodb_opts(self, host="localhost", database_name='INGInious'): """ Try MongoDB configuration """ try: mongo_client = MongoClient(host=host) except Exception as e: self._display_warning("Cannot connect to MongoDB on host %s: %s" % (host, str(e))) retu...
[ "def", "try_mongodb_opts", "(", "self", ",", "host", "=", "\"localhost\"", ",", "database_name", "=", "'INGInious'", ")", ":", "try", ":", "mongo_client", "=", "MongoClient", "(", "host", "=", "host", ")", "except", "Exception", "as", "e", ":", "self", "."...
Try MongoDB configuration
[ "Try", "MongoDB", "configuration" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/installer.py#L271-L291
train
UCL-INGI/INGInious
inginious/frontend/installer.py
Installer.configure_task_directory
def configure_task_directory(self): """ Configure task directory """ self._display_question( "Please choose a directory in which to store the course/task files. By default, the tool will put them in the current " "directory") task_directory = None while task_direc...
python
def configure_task_directory(self): """ Configure task directory """ self._display_question( "Please choose a directory in which to store the course/task files. By default, the tool will put them in the current " "directory") task_directory = None while task_direc...
[ "def", "configure_task_directory", "(", "self", ")", ":", "self", ".", "_display_question", "(", "\"Please choose a directory in which to store the course/task files. By default, the tool will put them in the current \"", "\"directory\"", ")", "task_directory", "=", "None", "while", ...
Configure task directory
[ "Configure", "task", "directory" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/installer.py#L326-L360
train
UCL-INGI/INGInious
inginious/frontend/installer.py
Installer.download_containers
def download_containers(self, to_download, current_options): """ Download the chosen containers on all the agents """ if current_options["backend"] == "local": self._display_info("Connecting to the local Docker daemon...") try: docker_connection = docker.from_env(...
python
def download_containers(self, to_download, current_options): """ Download the chosen containers on all the agents """ if current_options["backend"] == "local": self._display_info("Connecting to the local Docker daemon...") try: docker_connection = docker.from_env(...
[ "def", "download_containers", "(", "self", ",", "to_download", ",", "current_options", ")", ":", "if", "current_options", "[", "\"backend\"", "]", "==", "\"local\"", ":", "self", ".", "_display_info", "(", "\"Connecting to the local Docker daemon...\"", ")", "try", ...
Download the chosen containers on all the agents
[ "Download", "the", "chosen", "containers", "on", "all", "the", "agents" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/installer.py#L366-L385
train
UCL-INGI/INGInious
inginious/frontend/installer.py
Installer.configure_containers
def configure_containers(self, current_options): """ Configures the container dict """ containers = [ ("default", "Default container. For Bash and Python 2 tasks"), ("cpp", "Contains gcc and g++ for compiling C++"), ("java7", "Contains Java 7"), ("java8sca...
python
def configure_containers(self, current_options): """ Configures the container dict """ containers = [ ("default", "Default container. For Bash and Python 2 tasks"), ("cpp", "Contains gcc and g++ for compiling C++"), ("java7", "Contains Java 7"), ("java8sca...
[ "def", "configure_containers", "(", "self", ",", "current_options", ")", ":", "containers", "=", "[", "(", "\"default\"", ",", "\"Default container. For Bash and Python 2 tasks\"", ")", ",", "(", "\"cpp\"", ",", "\"Contains gcc and g++ for compiling C++\"", ")", ",", "(...
Configures the container dict
[ "Configures", "the", "container", "dict" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/installer.py#L387-L424
train
UCL-INGI/INGInious
inginious/frontend/installer.py
Installer.configure_backup_directory
def configure_backup_directory(self): """ Configure backup directory """ self._display_question("Please choose a directory in which to store the backup files. By default, the tool will them in the current " "directory") backup_directory = None while backup_...
python
def configure_backup_directory(self): """ Configure backup directory """ self._display_question("Please choose a directory in which to store the backup files. By default, the tool will them in the current " "directory") backup_directory = None while backup_...
[ "def", "configure_backup_directory", "(", "self", ")", ":", "self", ".", "_display_question", "(", "\"Please choose a directory in which to store the backup files. By default, the tool will them in the current \"", "\"directory\"", ")", "backup_directory", "=", "None", "while", "ba...
Configure backup directory
[ "Configure", "backup", "directory" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/installer.py#L439-L451
train
UCL-INGI/INGInious
inginious/frontend/installer.py
Installer.ldap_plugin
def ldap_plugin(self): """ Configures the LDAP plugin """ name = self._ask_with_default("Authentication method name (will be displayed on the login page)", "LDAP") prefix = self._ask_with_default("Prefix to append to the username before db storage. Usefull when you have more than one auth method...
python
def ldap_plugin(self): """ Configures the LDAP plugin """ name = self._ask_with_default("Authentication method name (will be displayed on the login page)", "LDAP") prefix = self._ask_with_default("Prefix to append to the username before db storage. Usefull when you have more than one auth method...
[ "def", "ldap_plugin", "(", "self", ")", ":", "name", "=", "self", ".", "_ask_with_default", "(", "\"Authentication method name (will be displayed on the login page)\"", ",", "\"LDAP\"", ")", "prefix", "=", "self", ".", "_ask_with_default", "(", "\"Prefix to append to the ...
Configures the LDAP plugin
[ "Configures", "the", "LDAP", "plugin" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/installer.py#L453-L481
train
UCL-INGI/INGInious
inginious/frontend/installer.py
Installer.configure_authentication
def configure_authentication(self, database): """ Configure the authentication """ options = {"plugins": [], "superadmins": []} self._display_info("We will now create the first user.") username = self._ask_with_default("Enter the login of the superadmin", "superadmin") realname...
python
def configure_authentication(self, database): """ Configure the authentication """ options = {"plugins": [], "superadmins": []} self._display_info("We will now create the first user.") username = self._ask_with_default("Enter the login of the superadmin", "superadmin") realname...
[ "def", "configure_authentication", "(", "self", ",", "database", ")", ":", "options", "=", "{", "\"plugins\"", ":", "[", "]", ",", "\"superadmins\"", ":", "[", "]", "}", "self", ".", "_display_info", "(", "\"We will now create the first user.\"", ")", "username"...
Configure the authentication
[ "Configure", "the", "authentication" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/installer.py#L483-L515
train
UCL-INGI/INGInious
inginious/frontend/app.py
_close_app
def _close_app(app, mongo_client, client): """ Ensures that the app is properly closed """ app.stop() client.close() mongo_client.close()
python
def _close_app(app, mongo_client, client): """ Ensures that the app is properly closed """ app.stop() client.close() mongo_client.close()
[ "def", "_close_app", "(", "app", ",", "mongo_client", ",", "client", ")", ":", "app", ".", "stop", "(", ")", "client", ".", "close", "(", ")", "mongo_client", ".", "close", "(", ")" ]
Ensures that the app is properly closed
[ "Ensures", "that", "the", "app", "is", "properly", "closed" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/app.py#L113-L117
train
UCL-INGI/INGInious
inginious/agent/docker_agent/__init__.py
DockerAgent._init_clean
async def _init_clean(self): """ Must be called when the agent is starting """ # Data about running containers self._containers_running = {} self._container_for_job = {} self._student_containers_running = {} self._student_containers_for_job = {} self._containers...
python
async def _init_clean(self): """ Must be called when the agent is starting """ # Data about running containers self._containers_running = {} self._container_for_job = {} self._student_containers_running = {} self._student_containers_for_job = {} self._containers...
[ "async", "def", "_init_clean", "(", "self", ")", ":", "self", ".", "_containers_running", "=", "{", "}", "self", ".", "_container_for_job", "=", "{", "}", "self", ".", "_student_containers_running", "=", "{", "}", "self", ".", "_student_containers_for_job", "=...
Must be called when the agent is starting
[ "Must", "be", "called", "when", "the", "agent", "is", "starting" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/agent/docker_agent/__init__.py#L57-L99
train
UCL-INGI/INGInious
inginious/agent/docker_agent/__init__.py
DockerAgent._end_clean
async def _end_clean(self): """ Must be called when the agent is closing """ await self._timeout_watcher.clean() async def close_and_delete(container_id): try: await self._docker.remove_container(container_id) except: pass for con...
python
async def _end_clean(self): """ Must be called when the agent is closing """ await self._timeout_watcher.clean() async def close_and_delete(container_id): try: await self._docker.remove_container(container_id) except: pass for con...
[ "async", "def", "_end_clean", "(", "self", ")", ":", "await", "self", ".", "_timeout_watcher", ".", "clean", "(", ")", "async", "def", "close_and_delete", "(", "container_id", ")", ":", "try", ":", "await", "self", ".", "_docker", ".", "remove_container", ...
Must be called when the agent is closing
[ "Must", "be", "called", "when", "the", "agent", "is", "closing" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/agent/docker_agent/__init__.py#L101-L114
train
UCL-INGI/INGInious
inginious/agent/docker_agent/__init__.py
DockerAgent._watch_docker_events
async def _watch_docker_events(self): """ Get raw docker events and convert them to more readable objects, and then give them to self._docker_events_subscriber """ try: source = AsyncIteratorWrapper(self._docker.sync.event_stream(filters={"event": ["die", "oom"]})) async for i in...
python
async def _watch_docker_events(self): """ Get raw docker events and convert them to more readable objects, and then give them to self._docker_events_subscriber """ try: source = AsyncIteratorWrapper(self._docker.sync.event_stream(filters={"event": ["die", "oom"]})) async for i in...
[ "async", "def", "_watch_docker_events", "(", "self", ")", ":", "try", ":", "source", "=", "AsyncIteratorWrapper", "(", "self", ".", "_docker", ".", "sync", ".", "event_stream", "(", "filters", "=", "{", "\"event\"", ":", "[", "\"die\"", ",", "\"oom\"", "]"...
Get raw docker events and convert them to more readable objects, and then give them to self._docker_events_subscriber
[ "Get", "raw", "docker", "events", "and", "convert", "them", "to", "more", "readable", "objects", "and", "then", "give", "them", "to", "self", ".", "_docker_events_subscriber" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/agent/docker_agent/__init__.py#L120-L155
train
UCL-INGI/INGInious
inginious/agent/docker_agent/__init__.py
DockerAgent.handle_student_job_closing
async def handle_student_job_closing(self, container_id, retval): """ Handle a closing student container. Do some cleaning, verify memory limits, timeouts, ... and returns data to the associated grading container """ try: self._logger.debug("Closing student %s", conta...
python
async def handle_student_job_closing(self, container_id, retval): """ Handle a closing student container. Do some cleaning, verify memory limits, timeouts, ... and returns data to the associated grading container """ try: self._logger.debug("Closing student %s", conta...
[ "async", "def", "handle_student_job_closing", "(", "self", ",", "container_id", ",", "retval", ")", ":", "try", ":", "self", ".", "_logger", ".", "debug", "(", "\"Closing student %s\"", ",", "container_id", ")", "try", ":", "job_id", ",", "parent_container_id", ...
Handle a closing student container. Do some cleaning, verify memory limits, timeouts, ... and returns data to the associated grading container
[ "Handle", "a", "closing", "student", "container", ".", "Do", "some", "cleaning", "verify", "memory", "limits", "timeouts", "...", "and", "returns", "data", "to", "the", "associated", "grading", "container" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/agent/docker_agent/__init__.py#L452-L499
train
UCL-INGI/INGInious
inginious/agent/docker_agent/__init__.py
DockerAgent.kill_job
async def kill_job(self, message: BackendKillJob): """ Handles `kill` messages. Kill things. """ try: if message.job_id in self._container_for_job: self._containers_killed[self._container_for_job[message.job_id]] = "killed" await self._docker.kill_container(se...
python
async def kill_job(self, message: BackendKillJob): """ Handles `kill` messages. Kill things. """ try: if message.job_id in self._container_for_job: self._containers_killed[self._container_for_job[message.job_id]] = "killed" await self._docker.kill_container(se...
[ "async", "def", "kill_job", "(", "self", ",", "message", ":", "BackendKillJob", ")", ":", "try", ":", "if", "message", ".", "job_id", "in", "self", ".", "_container_for_job", ":", "self", ".", "_containers_killed", "[", "self", ".", "_container_for_job", "["...
Handles `kill` messages. Kill things.
[ "Handles", "kill", "messages", ".", "Kill", "things", "." ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/agent/docker_agent/__init__.py#L629-L640
train
UCL-INGI/INGInious
inginious/frontend/pages/course_admin/aggregation_edit.py
CourseEditAggregation.get_user_lists
def get_user_lists(self, course, aggregationid=''): """ Get the available student and tutor lists for aggregation edition""" tutor_list = course.get_staff() # Determine student list and if they are grouped student_list = list(self.database.aggregations.aggregate([ {"$match":...
python
def get_user_lists(self, course, aggregationid=''): """ Get the available student and tutor lists for aggregation edition""" tutor_list = course.get_staff() # Determine student list and if they are grouped student_list = list(self.database.aggregations.aggregate([ {"$match":...
[ "def", "get_user_lists", "(", "self", ",", "course", ",", "aggregationid", "=", "''", ")", ":", "tutor_list", "=", "course", ".", "get_staff", "(", ")", "student_list", "=", "list", "(", "self", ".", "database", ".", "aggregations", ".", "aggregate", "(", ...
Get the available student and tutor lists for aggregation edition
[ "Get", "the", "available", "student", "and", "tutor", "lists", "for", "aggregation", "edition" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/aggregation_edit.py#L21-L63
train
UCL-INGI/INGInious
inginious/frontend/pages/course_admin/aggregation_edit.py
CourseEditAggregation.update_aggregation
def update_aggregation(self, course, aggregationid, new_data): """ Update aggregation and returns a list of errored students""" student_list = self.user_manager.get_course_registered_users(course, False) # If aggregation is new if aggregationid == 'None': # Remove _id for c...
python
def update_aggregation(self, course, aggregationid, new_data): """ Update aggregation and returns a list of errored students""" student_list = self.user_manager.get_course_registered_users(course, False) # If aggregation is new if aggregationid == 'None': # Remove _id for c...
[ "def", "update_aggregation", "(", "self", ",", "course", ",", "aggregationid", ",", "new_data", ")", ":", "student_list", "=", "self", ".", "user_manager", ".", "get_course_registered_users", "(", "course", ",", "False", ")", "if", "aggregationid", "==", "'None'...
Update aggregation and returns a list of errored students
[ "Update", "aggregation", "and", "returns", "a", "list", "of", "errored", "students" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/aggregation_edit.py#L65-L132
train
UCL-INGI/INGInious
inginious/frontend/pages/mycourses.py
MyCoursesPage.POST_AUTH
def POST_AUTH(self): # pylint: disable=arguments-differ """ Parse course registration or course creation and display the course list page """ username = self.user_manager.session_username() user_info = self.database.users.find_one({"username": username}) user_input = web.input() ...
python
def POST_AUTH(self): # pylint: disable=arguments-differ """ Parse course registration or course creation and display the course list page """ username = self.user_manager.session_username() user_info = self.database.users.find_one({"username": username}) user_input = web.input() ...
[ "def", "POST_AUTH", "(", "self", ")", ":", "username", "=", "self", ".", "user_manager", ".", "session_username", "(", ")", "user_info", "=", "self", ".", "database", ".", "users", ".", "find_one", "(", "{", "\"username\"", ":", "username", "}", ")", "us...
Parse course registration or course creation and display the course list page
[ "Parse", "course", "registration", "or", "course", "creation", "and", "display", "the", "course", "list", "page" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/mycourses.py#L21-L47
train
UCL-INGI/INGInious
inginious/frontend/arch_helper.py
_restart_on_cancel
async def _restart_on_cancel(logger, agent): """ Restarts an agent when it is cancelled """ while True: try: await agent.run() except asyncio.CancelledError: logger.exception("Restarting agent") pass
python
async def _restart_on_cancel(logger, agent): """ Restarts an agent when it is cancelled """ while True: try: await agent.run() except asyncio.CancelledError: logger.exception("Restarting agent") pass
[ "async", "def", "_restart_on_cancel", "(", "logger", ",", "agent", ")", ":", "while", "True", ":", "try", ":", "await", "agent", ".", "run", "(", ")", "except", "asyncio", ".", "CancelledError", ":", "logger", ".", "exception", "(", "\"Restarting agent\"", ...
Restarts an agent when it is cancelled
[ "Restarts", "an", "agent", "when", "it", "is", "cancelled" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/arch_helper.py#L49-L56
train
UCL-INGI/INGInious
inginious/frontend/pages/utils.py
INGIniousAuthPage.GET
def GET(self, *args, **kwargs): """ Checks if user is authenticated and calls GET_AUTH or performs logout. Otherwise, returns the login template. """ if self.user_manager.session_logged_in(): if not self.user_manager.session_username() and not self.__class__.__name__ ...
python
def GET(self, *args, **kwargs): """ Checks if user is authenticated and calls GET_AUTH or performs logout. Otherwise, returns the login template. """ if self.user_manager.session_logged_in(): if not self.user_manager.session_username() and not self.__class__.__name__ ...
[ "def", "GET", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "self", ".", "user_manager", ".", "session_logged_in", "(", ")", ":", "if", "not", "self", ".", "user_manager", ".", "session_username", "(", ")", "and", "not", "self", ...
Checks if user is authenticated and calls GET_AUTH or performs logout. Otherwise, returns the login template.
[ "Checks", "if", "user", "is", "authenticated", "and", "calls", "GET_AUTH", "or", "performs", "logout", ".", "Otherwise", "returns", "the", "login", "template", "." ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/utils.py#L135-L150
train
UCL-INGI/INGInious
inginious/frontend/static_middleware.py
StaticMiddleware.normpath
def normpath(self, path): """ Normalize the path """ path2 = posixpath.normpath(urllib.parse.unquote(path)) if path.endswith("/"): path2 += "/" return path2
python
def normpath(self, path): """ Normalize the path """ path2 = posixpath.normpath(urllib.parse.unquote(path)) if path.endswith("/"): path2 += "/" return path2
[ "def", "normpath", "(", "self", ",", "path", ")", ":", "path2", "=", "posixpath", ".", "normpath", "(", "urllib", ".", "parse", ".", "unquote", "(", "path", ")", ")", "if", "path", ".", "endswith", "(", "\"/\"", ")", ":", "path2", "+=", "\"/\"", "r...
Normalize the path
[ "Normalize", "the", "path" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/static_middleware.py#L66-L71
train
UCL-INGI/INGInious
inginious/frontend/pages/api/submissions.py
_get_submissions
def _get_submissions(course_factory, submission_manager, user_manager, translations, courseid, taskid, with_input, submissionid=None): """ Helper for the GET methods of the two following classes """ try: course = course_factory.get_course(courseid) except: raise APINotFound("Cou...
python
def _get_submissions(course_factory, submission_manager, user_manager, translations, courseid, taskid, with_input, submissionid=None): """ Helper for the GET methods of the two following classes """ try: course = course_factory.get_course(courseid) except: raise APINotFound("Cou...
[ "def", "_get_submissions", "(", "course_factory", ",", "submission_manager", ",", "user_manager", ",", "translations", ",", "courseid", ",", "taskid", ",", "with_input", ",", "submissionid", "=", "None", ")", ":", "try", ":", "course", "=", "course_factory", "."...
Helper for the GET methods of the two following classes
[ "Helper", "for", "the", "GET", "methods", "of", "the", "two", "following", "classes" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/api/submissions.py#L15-L73
train
UCL-INGI/INGInious
inginious/frontend/pages/api/submissions.py
APISubmissionSingle.API_GET
def API_GET(self, courseid, taskid, submissionid): # pylint: disable=arguments-differ """ List all the submissions that the connected user made. Returns list of the form :: [ { "id": "submission_id1", ...
python
def API_GET(self, courseid, taskid, submissionid): # pylint: disable=arguments-differ """ List all the submissions that the connected user made. Returns list of the form :: [ { "id": "submission_id1", ...
[ "def", "API_GET", "(", "self", ",", "courseid", ",", "taskid", ",", "submissionid", ")", ":", "with_input", "=", "\"input\"", "in", "web", ".", "input", "(", ")", "return", "_get_submissions", "(", "self", ".", "course_factory", ",", "self", ".", "submissi...
List all the submissions that the connected user made. Returns list of the form :: [ { "id": "submission_id1", "submitted_on": "date", "status" : "done", #can be "done", "waiting", "error" ...
[ "List", "all", "the", "submissions", "that", "the", "connected", "user", "made", ".", "Returns", "list", "of", "the", "form" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/api/submissions.py#L81-L110
train
UCL-INGI/INGInious
inginious/frontend/courses.py
WebAppCourse.is_registration_possible
def is_registration_possible(self, user_info): """ Returns true if users can register for this course """ return self.get_accessibility().is_open() and self._registration.is_open() and self.is_user_accepted_by_access_control(user_info)
python
def is_registration_possible(self, user_info): """ Returns true if users can register for this course """ return self.get_accessibility().is_open() and self._registration.is_open() and self.is_user_accepted_by_access_control(user_info)
[ "def", "is_registration_possible", "(", "self", ",", "user_info", ")", ":", "return", "self", ".", "get_accessibility", "(", ")", ".", "is_open", "(", ")", "and", "self", ".", "_registration", ".", "is_open", "(", ")", "and", "self", ".", "is_user_accepted_b...
Returns true if users can register for this course
[ "Returns", "true", "if", "users", "can", "register", "for", "this", "course" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/courses.py#L88-L90
train
UCL-INGI/INGInious
inginious/frontend/courses.py
WebAppCourse.get_accessibility
def get_accessibility(self, plugin_override=True): """ Return the AccessibleTime object associated with the accessibility of this course """ vals = self._hook_manager.call_hook('course_accessibility', course=self, default=self._accessible) return vals[0] if len(vals) and plugin_override else sel...
python
def get_accessibility(self, plugin_override=True): """ Return the AccessibleTime object associated with the accessibility of this course """ vals = self._hook_manager.call_hook('course_accessibility', course=self, default=self._accessible) return vals[0] if len(vals) and plugin_override else sel...
[ "def", "get_accessibility", "(", "self", ",", "plugin_override", "=", "True", ")", ":", "vals", "=", "self", ".", "_hook_manager", ".", "call_hook", "(", "'course_accessibility'", ",", "course", "=", "self", ",", "default", "=", "self", ".", "_accessible", "...
Return the AccessibleTime object associated with the accessibility of this course
[ "Return", "the", "AccessibleTime", "object", "associated", "with", "the", "accessibility", "of", "this", "course" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/courses.py#L100-L103
train
UCL-INGI/INGInious
inginious/frontend/courses.py
WebAppCourse.is_user_accepted_by_access_control
def is_user_accepted_by_access_control(self, user_info): """ Returns True if the user is allowed by the ACL """ if self.get_access_control_method() is None: return True elif not user_info: return False elif self.get_access_control_method() == "username": ...
python
def is_user_accepted_by_access_control(self, user_info): """ Returns True if the user is allowed by the ACL """ if self.get_access_control_method() is None: return True elif not user_info: return False elif self.get_access_control_method() == "username": ...
[ "def", "is_user_accepted_by_access_control", "(", "self", ",", "user_info", ")", ":", "if", "self", ".", "get_access_control_method", "(", ")", "is", "None", ":", "return", "True", "elif", "not", "user_info", ":", "return", "False", "elif", "self", ".", "get_a...
Returns True if the user is allowed by the ACL
[ "Returns", "True", "if", "the", "user", "is", "allowed", "by", "the", "ACL" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/courses.py#L140-L152
train
UCL-INGI/INGInious
inginious/frontend/courses.py
WebAppCourse.allow_unregister
def allow_unregister(self, plugin_override=True): """ Returns True if students can unregister from course """ vals = self._hook_manager.call_hook('course_allow_unregister', course=self, default=self._allow_unregister) return vals[0] if len(vals) and plugin_override else self._allow_unregister
python
def allow_unregister(self, plugin_override=True): """ Returns True if students can unregister from course """ vals = self._hook_manager.call_hook('course_allow_unregister', course=self, default=self._allow_unregister) return vals[0] if len(vals) and plugin_override else self._allow_unregister
[ "def", "allow_unregister", "(", "self", ",", "plugin_override", "=", "True", ")", ":", "vals", "=", "self", ".", "_hook_manager", ".", "call_hook", "(", "'course_allow_unregister'", ",", "course", "=", "self", ",", "default", "=", "self", ".", "_allow_unregist...
Returns True if students can unregister from course
[ "Returns", "True", "if", "students", "can", "unregister", "from", "course" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/courses.py#L157-L160
train
UCL-INGI/INGInious
inginious/frontend/courses.py
WebAppCourse.get_name
def get_name(self, language): """ Return the name of this course """ return self.gettext(language, self._name) if self._name else ""
python
def get_name(self, language): """ Return the name of this course """ return self.gettext(language, self._name) if self._name else ""
[ "def", "get_name", "(", "self", ",", "language", ")", ":", "return", "self", ".", "gettext", "(", "language", ",", "self", ".", "_name", ")", "if", "self", ".", "_name", "else", "\"\"" ]
Return the name of this course
[ "Return", "the", "name", "of", "this", "course" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/courses.py#L162-L164
train
UCL-INGI/INGInious
inginious/frontend/courses.py
WebAppCourse.get_description
def get_description(self, language): """Returns the course description """ description = self.gettext(language, self._description) if self._description else '' return ParsableText(description, "rst", self._translations.get(language, gettext.NullTranslations()))
python
def get_description(self, language): """Returns the course description """ description = self.gettext(language, self._description) if self._description else '' return ParsableText(description, "rst", self._translations.get(language, gettext.NullTranslations()))
[ "def", "get_description", "(", "self", ",", "language", ")", ":", "description", "=", "self", ".", "gettext", "(", "language", ",", "self", ".", "_description", ")", "if", "self", ".", "_description", "else", "''", "return", "ParsableText", "(", "description...
Returns the course description
[ "Returns", "the", "course", "description" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/courses.py#L166-L169
train
UCL-INGI/INGInious
inginious/frontend/courses.py
WebAppCourse.get_all_tags_names_as_list
def get_all_tags_names_as_list(self, admin=False, language="en"): """ Computes and cache two list containing all tags name sorted by natural order on name """ if admin: if self._all_tags_cache_list_admin != {} and language in self._all_tags_cache_list_admin: return self._all...
python
def get_all_tags_names_as_list(self, admin=False, language="en"): """ Computes and cache two list containing all tags name sorted by natural order on name """ if admin: if self._all_tags_cache_list_admin != {} and language in self._all_tags_cache_list_admin: return self._all...
[ "def", "get_all_tags_names_as_list", "(", "self", ",", "admin", "=", "False", ",", "language", "=", "\"en\"", ")", ":", "if", "admin", ":", "if", "self", ".", "_all_tags_cache_list_admin", "!=", "{", "}", "and", "language", "in", "self", ".", "_all_tags_cach...
Computes and cache two list containing all tags name sorted by natural order on name
[ "Computes", "and", "cache", "two", "list", "containing", "all", "tags", "name", "sorted", "by", "natural", "order", "on", "name" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/courses.py#L200-L225
train
UCL-INGI/INGInious
inginious/frontend/courses.py
WebAppCourse.update_all_tags_cache
def update_all_tags_cache(self): """ Force the cache refreshing """ self._all_tags_cache = None self._all_tags_cache_list = {} self._all_tags_cache_list_admin = {} self._organisational_tags_to_task = {} self.get_all_tags() self.get_all_tags_n...
python
def update_all_tags_cache(self): """ Force the cache refreshing """ self._all_tags_cache = None self._all_tags_cache_list = {} self._all_tags_cache_list_admin = {} self._organisational_tags_to_task = {} self.get_all_tags() self.get_all_tags_n...
[ "def", "update_all_tags_cache", "(", "self", ")", ":", "self", ".", "_all_tags_cache", "=", "None", "self", ".", "_all_tags_cache_list", "=", "{", "}", "self", ".", "_all_tags_cache_list_admin", "=", "{", "}", "self", ".", "_organisational_tags_to_task", "=", "{...
Force the cache refreshing
[ "Force", "the", "cache", "refreshing" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/courses.py#L243-L253
train
UCL-INGI/INGInious
inginious/frontend/webdav.py
get_app
def get_app(config): """ Init the webdav app """ mongo_client = MongoClient(host=config.get('mongo_opt', {}).get('host', 'localhost')) database = mongo_client[config.get('mongo_opt', {}).get('database', 'INGInious')] # Create the FS provider if "tasks_directory" not in config: raise Runtime...
python
def get_app(config): """ Init the webdav app """ mongo_client = MongoClient(host=config.get('mongo_opt', {}).get('host', 'localhost')) database = mongo_client[config.get('mongo_opt', {}).get('database', 'INGInious')] # Create the FS provider if "tasks_directory" not in config: raise Runtime...
[ "def", "get_app", "(", "config", ")", ":", "mongo_client", "=", "MongoClient", "(", "host", "=", "config", ".", "get", "(", "'mongo_opt'", ",", "{", "}", ")", ".", "get", "(", "'host'", ",", "'localhost'", ")", ")", "database", "=", "mongo_client", "["...
Init the webdav app
[ "Init", "the", "webdav", "app" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/webdav.py#L120-L140
train
UCL-INGI/INGInious
inginious/frontend/webdav.py
INGIniousDAVDomainController.getDomainRealm
def getDomainRealm(self, inputURL, environ): """Resolve a relative url to the appropriate realm name.""" # we don't get the realm here, its already been resolved in # request_resolver if inputURL.startswith("/"): inputURL = inputURL[1:] parts = inputURL.split("/") ...
python
def getDomainRealm(self, inputURL, environ): """Resolve a relative url to the appropriate realm name.""" # we don't get the realm here, its already been resolved in # request_resolver if inputURL.startswith("/"): inputURL = inputURL[1:] parts = inputURL.split("/") ...
[ "def", "getDomainRealm", "(", "self", ",", "inputURL", ",", "environ", ")", ":", "if", "inputURL", ".", "startswith", "(", "\"/\"", ")", ":", "inputURL", "=", "inputURL", "[", "1", ":", "]", "parts", "=", "inputURL", ".", "split", "(", "\"/\"", ")", ...
Resolve a relative url to the appropriate realm name.
[ "Resolve", "a", "relative", "url", "to", "the", "appropriate", "realm", "name", "." ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/webdav.py#L30-L37
train
UCL-INGI/INGInious
inginious/frontend/webdav.py
INGIniousDAVDomainController.isRealmUser
def isRealmUser(self, realmname, username, environ): """Returns True if this username is valid for the realm, False otherwise.""" try: course = self.course_factory.get_course(realmname) ok = self.user_manager.has_admin_rights_on_course(course, username=username) retur...
python
def isRealmUser(self, realmname, username, environ): """Returns True if this username is valid for the realm, False otherwise.""" try: course = self.course_factory.get_course(realmname) ok = self.user_manager.has_admin_rights_on_course(course, username=username) retur...
[ "def", "isRealmUser", "(", "self", ",", "realmname", ",", "username", ",", "environ", ")", ":", "try", ":", "course", "=", "self", ".", "course_factory", ".", "get_course", "(", "realmname", ")", "ok", "=", "self", ".", "user_manager", ".", "has_admin_righ...
Returns True if this username is valid for the realm, False otherwise.
[ "Returns", "True", "if", "this", "username", "is", "valid", "for", "the", "realm", "False", "otherwise", "." ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/webdav.py#L44-L51
train
UCL-INGI/INGInious
inginious/frontend/webdav.py
INGIniousDAVDomainController.getRealmUserPassword
def getRealmUserPassword(self, realmname, username, environ): """Return the password for the given username for the realm. Used for digest authentication. """ return self.user_manager.get_user_api_key(username, create=True)
python
def getRealmUserPassword(self, realmname, username, environ): """Return the password for the given username for the realm. Used for digest authentication. """ return self.user_manager.get_user_api_key(username, create=True)
[ "def", "getRealmUserPassword", "(", "self", ",", "realmname", ",", "username", ",", "environ", ")", ":", "return", "self", ".", "user_manager", ".", "get_user_api_key", "(", "username", ",", "create", "=", "True", ")" ]
Return the password for the given username for the realm. Used for digest authentication.
[ "Return", "the", "password", "for", "the", "given", "username", "for", "the", "realm", "." ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/webdav.py#L53-L58
train
UCL-INGI/INGInious
inginious/frontend/webdav.py
INGIniousFilesystemProvider.getResourceInst
def getResourceInst(self, path, environ): """Return info dictionary for path. See DAVProvider.getResourceInst() """ self._count_getResourceInst += 1 fp = self._locToFilePath(path) if not os.path.exists(fp): return None if os.path.isdir(fp): ...
python
def getResourceInst(self, path, environ): """Return info dictionary for path. See DAVProvider.getResourceInst() """ self._count_getResourceInst += 1 fp = self._locToFilePath(path) if not os.path.exists(fp): return None if os.path.isdir(fp): ...
[ "def", "getResourceInst", "(", "self", ",", "path", ",", "environ", ")", ":", "self", ".", "_count_getResourceInst", "+=", "1", "fp", "=", "self", ".", "_locToFilePath", "(", "path", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "fp", ")", ...
Return info dictionary for path. See DAVProvider.getResourceInst()
[ "Return", "info", "dictionary", "for", "path", "." ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/webdav.py#L105-L117
train
UCL-INGI/INGInious
inginious/frontend/pages/course_admin/task_edit.py
CourseEditTask.contains_is_html
def contains_is_html(cls, data): """ Detect if the problem has at least one "xyzIsHTML" key """ for key, val in data.items(): if isinstance(key, str) and key.endswith("IsHTML"): return True if isinstance(val, (OrderedDict, dict)) and cls.contains_is_html(val): ...
python
def contains_is_html(cls, data): """ Detect if the problem has at least one "xyzIsHTML" key """ for key, val in data.items(): if isinstance(key, str) and key.endswith("IsHTML"): return True if isinstance(val, (OrderedDict, dict)) and cls.contains_is_html(val): ...
[ "def", "contains_is_html", "(", "cls", ",", "data", ")", ":", "for", "key", ",", "val", "in", "data", ".", "items", "(", ")", ":", "if", "isinstance", "(", "key", ",", "str", ")", "and", "key", ".", "endswith", "(", "\"IsHTML\"", ")", ":", "return"...
Detect if the problem has at least one "xyzIsHTML" key
[ "Detect", "if", "the", "problem", "has", "at", "least", "one", "xyzIsHTML", "key" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/task_edit.py#L73-L80
train
UCL-INGI/INGInious
inginious/frontend/pages/course_admin/task_edit.py
CourseEditTask.parse_problem
def parse_problem(self, problem_content): """ Parses a problem, modifying some data """ del problem_content["@order"] return self.task_factory.get_problem_types().get(problem_content["type"]).parse_problem(problem_content)
python
def parse_problem(self, problem_content): """ Parses a problem, modifying some data """ del problem_content["@order"] return self.task_factory.get_problem_types().get(problem_content["type"]).parse_problem(problem_content)
[ "def", "parse_problem", "(", "self", ",", "problem_content", ")", ":", "del", "problem_content", "[", "\"@order\"", "]", "return", "self", ".", "task_factory", ".", "get_problem_types", "(", ")", ".", "get", "(", "problem_content", "[", "\"type\"", "]", ")", ...
Parses a problem, modifying some data
[ "Parses", "a", "problem", "modifying", "some", "data" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/task_edit.py#L113-L116
train
UCL-INGI/INGInious
inginious/frontend/pages/course_admin/task_edit.py
CourseEditTask.wipe_task
def wipe_task(self, courseid, taskid): """ Wipe the data associated to the taskid from DB""" submissions = self.database.submissions.find({"courseid": courseid, "taskid": taskid}) for submission in submissions: for key in ["input", "archive"]: if key in submission and...
python
def wipe_task(self, courseid, taskid): """ Wipe the data associated to the taskid from DB""" submissions = self.database.submissions.find({"courseid": courseid, "taskid": taskid}) for submission in submissions: for key in ["input", "archive"]: if key in submission and...
[ "def", "wipe_task", "(", "self", ",", "courseid", ",", "taskid", ")", ":", "submissions", "=", "self", ".", "database", ".", "submissions", ".", "find", "(", "{", "\"courseid\"", ":", "courseid", ",", "\"taskid\"", ":", "taskid", "}", ")", "for", "submis...
Wipe the data associated to the taskid from DB
[ "Wipe", "the", "data", "associated", "to", "the", "taskid", "from", "DB" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/pages/course_admin/task_edit.py#L118-L130
train
UCL-INGI/INGInious
inginious/common/hook_manager.py
HookManager._exception_free_callback
def _exception_free_callback(self, callback, *args, **kwargs): """ A wrapper that remove all exceptions raised from hooks """ try: return callback(*args, **kwargs) except Exception: self._logger.exception("An exception occurred while calling a hook! ",exc_info=True) ...
python
def _exception_free_callback(self, callback, *args, **kwargs): """ A wrapper that remove all exceptions raised from hooks """ try: return callback(*args, **kwargs) except Exception: self._logger.exception("An exception occurred while calling a hook! ",exc_info=True) ...
[ "def", "_exception_free_callback", "(", "self", ",", "callback", ",", "*", "args", ",", "**", "kwargs", ")", ":", "try", ":", "return", "callback", "(", "*", "args", ",", "**", "kwargs", ")", "except", "Exception", ":", "self", ".", "_logger", ".", "ex...
A wrapper that remove all exceptions raised from hooks
[ "A", "wrapper", "that", "remove", "all", "exceptions", "raised", "from", "hooks" ]
cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/common/hook_manager.py#L18-L24
train