• No results found

Code documentation

In document INGInious Documentation (Page 62-86)

4.4.1 inginious package

inginious.get_root_path() Returns the INGInious root path

INGInious Documentation, Release 0.4

Subpackages

inginious.agent package Submodules

inginious.agent.docker_agent module inginious.agent.mcq_agent module inginious.backend package

Submodules

inginious.backend.backend module inginious.client package

Submodules

inginious.client.client module

inginious.client.client_buffer module

Contains ClientBuffer, which creates a buffer for a Client

class inginious.client.client_buffer.ClientBuffer(client) Bases: object

A buffer for a Client get_result(bjobid)

Get the result of task. Must only be called ONCE, AFTER the task is done (after a successfull call to is_done). :return a tuple (result, grade, problems, tests, custom, archive) result is itself a tuple containing the result string and the main feedback (i.e. (‘success’, ‘You succeeded’) grade is a number between 0 and 100 indicating the grade of the users problems is a dict of tuple, in the form {‘problemid’: result} test is a dict of tests made in the container custom is a dict containing random things set in the container archive is either None or a bytes containing a tgz archive of files from the job

is_done(bjobid)

Return true if the job is done is_waiting(bjobid)

Return true if the job is in queue

new_job(task, inputdata, launcher_name=’Unknown’, debug=False)

Runs a new job. It works exactly like the Client class, instead that there is no callback

inginious.client.client_sync module A synchronized “layer” for Client

4.4. Code documentation 59

class inginious.client.client_sync.ClientSync(client) Bases: object

Runs job synchronously

new_job(task, inputdata, launcher_name=’Unknown’, debug=False)

Runs a new job. It works exactly like the Client class, instead that there is no callback and directly returns result, in the form of a tuple (result, grade, problems, tests, custom, archive).

inginious.common package

Common package: basic library for INGInious, needed by all its components.

Subpackages

inginious.common.task_file_readers package Managers for handling the different format of task files

Submodules

inginious.common.task_file_readers.abstract_reader module inginious.common.task_file_readers.yaml_reader module inginious.common.tests package

Tests for the inginious.common package

Submodules

inginious.common.tests.TestBase module inginious.common.tests.TestCourse module inginious.common.tests.TestCustomYaml module inginious.common.tests.TestHookManager module

class inginious.common.tests.TestHookManager.TestHookManager Bases: object

make_exception()

test_exception()

Hook Manager should silently ignore hooks that make exceptions test_multple()

INGInious Documentation, Release 0.4

inginious.common.tests.TestTask module Submodules

inginious.common.asyncio_utils module inginious.common.base module

inginious.common.course_factory module inginious.common.courses module

Contains the class Course and utility functions

class inginious.common.courses.Course(courseid, content_description, task_factory, hook_manager)

Bases: object Represents a course get_descriptor()

Get (a copy) the description of the course get_id()

Return the _id of this course get_task(taskid)

Returns a Task object get_tasks()

Get all tasks in this course

inginious.common.custom_yaml module inginious.common.exceptions module

Some type of exceptions used by parts of INGInious

exception inginious.common.exceptions.CourseAlreadyExistsException Bases: exceptions.Exception

exception inginious.common.exceptions.CourseNotFoundException Bases: exceptions.Exception

exception inginious.common.exceptions.CourseUnreadableException Bases: exceptions.Exception

exception inginious.common.exceptions.InvalidNameException Bases: exceptions.Exception

exception inginious.common.exceptions.TaskNotFoundException Bases: exceptions.Exception

exception inginious.common.exceptions.TaskReaderNotFoundException Bases: exceptions.Exception

4.4. Code documentation 61

exception inginious.common.exceptions.TaskUnreadableException Bases: exceptions.Exception

inginious.common.hook_manager module

Hook Manager

class inginious.common.hook_manager.HookManager Bases: object

Registers an manages hooks. Hooks are callback functions called when the inginious.backend does a specific action.

add_hook(name, callback)

Add a new hook that can be called with the call_hook function call_hook(name, **kwargs)

Call all hooks registered with this name. Returns a list of the returns values of the hooks (in the order the hooks were added)

inginious.common.log module

Some common functions for logging

class inginious.common.log.CustomLogMiddleware(app, logger) WSGI middleware for logging the status in webpy

log(status, environ)

inginious.common.log.get_course_logger(coursename) Parameters coursename – the course id

Returns a logger object associated to a specific course inginious.common.log.init_logging(log_level=10)

Init logging :param log_level: An integer representing the log level or a string representing one

INGInious Documentation, Release 0.4

inginious.common.message_meta module inginious.common.messages module inginious.common.task_factory module inginious.common.tasks module

inginious.common.tasks_code_boxes module inginious.common.tasks_problems module inginious.frontend package

Subpackages

inginious.frontend.common package Subpackages

inginious.frontend.common.tests package Submodules

inginious.frontend.common.tests.TestParsableText module Submodules

inginious.frontend.common.arch_helper module inginious.frontend.common.courses module

Classes modifying basic tasks, problems and boxes classes

class inginious.frontend.common.courses.FrontendCourse(courseid, content, task_factory, hook_manager)

Bases:inginious.common.courses.Course A basic course extension that stores the name of the course get_name()

Return the name of this course

4.4. Code documentation 63

inginious.frontend.common.installer module inginious.frontend.common.parsable_text module inginious.frontend.common.plugin_manager module

Plugin Manager

class inginious.frontend.common.plugin_manager.PluginManager Bases:inginious.common.hook_manager.HookManager

Registers an manage plugins. The init method inits only the Hook Manager; you have to call the method load() to start the plugins

add_page(pattern, classname)

Add a new page to the web application. Only available after that the Plugin Manager is loaded add_task_file_manager(task_file_manager)

Add a task file manager. Only available after that the Plugin Manager is loaded get_database()

Returns the frontend database get_submission_manager()

Returns the submission manager get_user_manager()

Returns the user manager

load(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 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

exception inginious.frontend.common.plugin_manager.PluginManagerNotLoadedException Bases: exceptions.Exception

INGInious Documentation, Release 0.4

inginious.frontend.common.session_mongodb module inginious.frontend.common.static_middleware module inginious.frontend.common.submission_manager module inginious.frontend.common.task_page_helpers module inginious.frontend.common.task_problems module inginious.frontend.common.tasks module

inginious.frontend.common.tasks_code_boxes module inginious.frontend.common.template_helper module inginious.frontend.common.user_manager module inginious.frontend.lti package

A LTI 1.1 tool provider based on the INGInious inginious.backend

4.4. Code documentation 65

Subpackages

inginious.frontend.lti.pages package Submodules

inginious.frontend.lti.pages.download module inginious.frontend.lti.pages.launch module inginious.frontend.lti.pages.task module inginious.frontend.lti.pages.utils module Submodules

inginious.frontend.lti.app module

inginious.frontend.lti.custom_session module inginious.frontend.lti.installer module

inginious.frontend.lti.lis_outcome_manager module inginious.frontend.lti.submission_manager module inginious.frontend.lti.user_manager module

inginious.frontend.webapp package Package that implements a webapp for INGInious

Subpackages

inginious.frontend.webapp.pages package Frontend pages (controllers)

Subpackages

inginious.frontend.webapp.pages.api package REST API for the webapp

INGInious Documentation, Release 0.4

Submodules

inginious.frontend.webapp.pages.api.auth_methods module inginious.frontend.webapp.pages.api.authentication module inginious.frontend.webapp.pages.api.courses module inginious.frontend.webapp.pages.api.submissions module inginious.frontend.webapp.pages.api.tasks module

inginious.frontend.webapp.pages.course_admin package Course administration

4.4. Code documentation 67

INGInious Documentation, Release 0.4

Submodules

inginious.frontend.webapp.pages.course_admin.aggregation_edit module inginious.frontend.webapp.pages.course_admin.aggregation_info module inginious.frontend.webapp.pages.course_admin.aggregation_list module inginious.frontend.webapp.pages.course_admin.aggregation_task module inginious.frontend.webapp.pages.course_admin.batch module

inginious.frontend.webapp.pages.course_admin.classroom_edit module inginious.frontend.webapp.pages.course_admin.danger_zone module inginious.frontend.webapp.pages.course_admin.download module inginious.frontend.webapp.pages.course_admin.settings module inginious.frontend.webapp.pages.course_admin.student_info module inginious.frontend.webapp.pages.course_admin.student_list module inginious.frontend.webapp.pages.course_admin.student_task module inginious.frontend.webapp.pages.course_admin.submission module inginious.frontend.webapp.pages.course_admin.task_edit module inginious.frontend.webapp.pages.course_admin.task_edit_file module inginious.frontend.webapp.pages.course_admin.task_info module inginious.frontend.webapp.pages.course_admin.task_list module inginious.frontend.webapp.pages.course_admin.utils module Submodules

inginious.frontend.webapp.pages.aggregation module inginious.frontend.webapp.pages.course module inginious.frontend.webapp.pages.index module

inginious.frontend.webapp.pages.maintenance module inginious.frontend.webapp.pages.tasks module

inginious.frontend.webapp.pages.utils module inginious.frontend.webapp.plugins package Plugins for the webapp of INGInious

4.4. Code documentation 69

Subpackages

inginious.frontend.webapp.plugins.auth package Auth plugins

Submodules

inginious.frontend.webapp.plugins.auth.db_auth module inginious.frontend.webapp.plugins.auth.demo_auth module inginious.frontend.webapp.plugins.auth.ldap_auth module inginious.frontend.webapp.plugins.contests package Submodules

inginious.frontend.webapp.plugins.contests.contests module inginious.frontend.webapp.plugins.scoreboard package inginious.frontend.webapp.plugins.task_file_readers package Additional task files managers for INGInious

INGInious Documentation, Release 0.4

Submodules

inginious.frontend.webapp.plugins.task_file_readers.json_reader module inginious.frontend.webapp.plugins.task_file_readers.rst_reader module Submodules

inginious.frontend.webapp.plugins.client_test module inginious.frontend.webapp.plugins.demo_page module inginious.frontend.webapp.plugins.edx module

inginious.frontend.webapp.plugins.git_repo module inginious.frontend.webapp.plugins.simple_grader module inginious.frontend.webapp.tests package

Submodules

inginious.frontend.webapp.tests.SeleniumTest module inginious.frontend.webapp.tests.TestLogin module inginious.frontend.webapp.tests.TestTaskDisplay module inginious.frontend.webapp.tests.TestTaskSubmission module Submodules

inginious.frontend.webapp.accessible_time module

Contains AccessibleTime, class that represents the period of time when a course/task is accessible class inginious.frontend.webapp.accessible_time.AccessibleTime(val=None)

Bases: object

represents the period of time when a course/task is accessible after_start(when=None)

Returns True if the task/course is or have been accessible in the past before_start(when=None)

Returns True if the task/course is not yet accessible get_end_date()

Return a datetime object, representing the deadline for accessibility

4.4. Code documentation 71

get_start_date()

Return a datetime object, representing the date when the task/course become accessible get_std_end_date()

If the date is custom, return the end datetime with the format %Y-%m-%d %H:%M:%S. Else, returns “”.

get_std_start_date()

If the date is custom, return the start datetime with the format %Y-%m-%d %H:%M:%S. Else, returns “”.

is_always_accessible()

Returns true if the course/task is always accessible is_never_accessible()

Returns true if the course/task is never accessible is_open(when=None)

Returns True if the course/task is still open

inginious.frontend.webapp.accessible_time.parse_date(date, default=None) Parse a valid date

inginious.frontend.webapp.app module

inginious.frontend.webapp.batch_manager module inginious.frontend.webapp.courses module

A course class with some modification for users

class inginious.frontend.webapp.courses.WebAppCourse(courseid, content, task_factory, hook_manager)

Bases:inginious.frontend.common.courses.FrontendCourse A course with some modification for users

allow_unregister(plugin_override=True) Returns True if students can unregister from course can_students_choose_group()

Returns True if the students can choose their groups get_access_control_list()

Returns the list of all users allowed by the AC list get_access_control_method()

Returns either None, “username”, “realname”, or “email”, depending on the method used to verify that users can register to the course

get_accessibility(plugin_override=True)

Return the AccessibleTime object associated with the accessibility of this course get_admins()

Returns a list containing the usernames of the administrators of this course get_registration_accessibility()

Return the AccessibleTime object associated with the registration get_registration_password()

Returns the password needed for registration (None if there is no password)

INGInious Documentation, Release 0.4

get_staff()

Returns a list containing the usernames of all the staff users get_tasks()

get_tutors()

Returns a list containing the usernames of the tutors assigned to this course is_open_to_non_staff()

Returns true if the course is accessible by users that are not administrator of this course is_password_needed_for_registration()

Returns true if a password is needed for registration

is_registration_possible(username, realname, email) Returns true if users can register for this course

is_user_accepted_by_access_control(username, realname, email) Returns True if the user is allowed by the ACL

use_classrooms()

Returns True if classrooms are used

inginious.frontend.webapp.database_updater module inginious.frontend.webapp.installer module

inginious.frontend.webapp.submission_manager module inginious.frontend.webapp.tasks module

inginious.frontend.webapp.user_manager module

4.4. Code documentation 73

CHAPTER 5

Indices and tables

• genindex

• modindex

• search

75

Python Module Index

i

inginious,58

inginious.agent,59 inginious.backend,59 inginious.client,59

inginious.client.client_buffer,59 inginious.client.client_sync,59 inginious.common,60

inginious.common.courses,61 inginious.common.exceptions,61 inginious.common.hook_manager,62 inginious.common.log,62

inginious.common.task_file_readers,60 inginious.common.tests,60

inginious.common.tests.TestHookManager, 60

inginious.frontend,63

inginious.frontend.common,63

inginious.frontend.common.courses,63 inginious.frontend.common.plugin_manager,

64

inginious.frontend.common.tests,63 inginious.frontend.lti,65

inginious.frontend.lti.pages,66 inginious.frontend.webapp,66

inginious.frontend.webapp.accessible_time, 71

inginious.frontend.webapp.courses,72 inginious.frontend.webapp.pages,66 inginious.frontend.webapp.pages.api,66

inginious.frontend.webapp.pages.course_admin, 67

inginious.frontend.webapp.plugins,69 inginious.frontend.webapp.plugins.auth,

70

inginious.frontend.webapp.plugins.task_file_readers, 70

inginious.frontend.webapp.tests,71

77

Index

Symbols

–concurrency CONCURRENCY

inginious-agent-docker command line option,19 –config

inginious-lti command line option,18 inginious-webapp command line option,17 –conver-yaml

inginious-old-task-converter command line option, 21

–debug-host DEBUG_HOST

inginious-agent-docker command line option,18 –debug-ports DEBUG_PORTS

inginious-agent-docker command line option,18 –delete-html

inginious-old-task-converter command line option, 21

–file

inginious-install command line option,17 –host HOST

inginious-lti command line option,18 inginious-webapp command line option,17 –port PORT

inginious-check-task command line option,20 inginious-lti command line option,18

inginious-webapp command line option,18 –taskdir TASKDIR

inginious-check-task command line option,20 –tasks TASKS

inginious-agent-docker command line option,18 inginious-agent-mcq command line option,19 –tmpdir TMPDIR

inginious-agent-docker command line option,18 -c, –config

inginious-test-task command line option,20 -h, –help

inginious-agent-docker command line option,18 inginious-agent-mcq command line option,19 inginious-backend command line option,19 inginious-check-task command line option,20

inginious-install command line option,17 inginious-lti command line option,18

inginious-old-task-converter command line option, 21

inginious-test-task command line option,20 inginious-webapp command line option,18 -v, –verbose

inginious-agent-docker command line option,19 inginious-agent-mcq command line option,19 inginious-backend command line option,19 inginious-test-task command line option,20

A

AccessibleTime (class in

ingin-ious.frontend.webapp.accessible_time),71

inginious-backend command line option,19

allow_unregister()

(ingin-ious.frontend.webapp.courses.WebAppCourse method),72

B

backend

inginious-agent-docker command line option,19 inginious-agent-mcq command line option,19

before_start() (inginious.frontend.webapp.accessible_time.AccessibleTime

can_students_choose_group() (ingin-ious.frontend.webapp.courses.WebAppCourse method),72

client

inginious-backend command line option,19 ClientBuffer (class in inginious.client.client_buffer),59 ClientSync (class in inginious.client.client_sync),59 course

inginious-check-task command line option,20 Course (class in inginious.common.courses),61 CourseAlreadyExistsException,61

courseid

inginious-test-task command line option,20 CourseNotFoundException,61

CourseUnreadableException,61

CustomLogMiddleware (class in inginious.common.log), 62

F

FrontendCourse (class in

ingin-ious.frontend.common.courses),63

get_course_logger() (in module inginious.common.log), 62

get_id() (inginious.common.courses.Course method),61

get_name() (inginious.frontend.common.courses.FrontendCourse

get_root_path() (in module inginious),58

get_staff() (inginious.frontend.webapp.courses.WebAppCourse

HookManager (class in

ingin-ious.common.hook_manager),62

I

inginious (module),58

inginious-agent-docker command line option –concurrency CONCURRENCY,19

inginious-agent-mcq command line option –tasks TASKS,19

-h, –help,19 -v, –verbose,19 backend,19

inginious-backend command line option -h, –help,19

-v, –verbose,19 agent,19 client,19

inginious-check-task command line option –port PORT,20

–taskdir TASKDIR,20 -h, –help,20

INGInious Documentation, Release 0.4

course,20

inginious-install command line option –file,17

-h, –help,17 lti, webapp,17

inginious-lti command line option –config,18

–host HOST,18 –port PORT,18 -h, –help,18

inginious-old-task-converter command line option –conver-yaml,21

–delete-html,21 -h, –help,21 tasks,21

inginious-test-task command line option -c, –config,20

-h, –help,20 -v, –verbose,20 courseid,20 taskid,20

inginious-webapp command line option –config,17 init_logging() (in module inginious.common.log),62 InvalidNameException,61

inginious-install command line option,17

M

parse_date() (in module

ingin-ious.frontend.webapp.accessible_time),72

Index 81

PluginManager (class in ingin-ious.frontend.common.plugin_manager), 64

PluginManagerNotLoadedException,64

R

register_auth_method()

(ingin-ious.frontend.common.plugin_manager.PluginManager method),64

T

taskid

inginious-test-task command line option,20 TaskNotFoundException,61

TaskReaderNotFoundException,61 tasks

inginious-old-task-converter command line option, 21

TaskUnreadableException,61

test_exception()

(ingin-ious.common.tests.TestHookManager.TestHookManager method),60

test_multple() (inginious.common.tests.TestHookManager.TestHookManager method),60

TestHookManager (class in

ingin-ious.common.tests.TestHookManager),60

U

use_classrooms()

(ingin-ious.frontend.webapp.courses.WebAppCourse method),73

W

WebAppCourse (class in

ingin-ious.frontend.webapp.courses),72

In document INGInious Documentation (Page 62-86)

Related documents