Skip to content

Modules

Arios Jentu edited this page Aug 8, 2021 · 1 revision

There is some information about generating your own modules for this project.

Structure

Any module in this project containing a folder in Modules folder, which automatically parsing by Modules script with class ModulesLoader.

Module must contain next folders structure:

  • Information
    • AssignmentsInformation.py
    • Assignments...

File AssignmentsInformation must contain all information about assignments in this module.

Structure of AssignmentsInformation file

First of all — it must import class AssignmentsInformationClass and define AssignmentInformation object:

import Scripts.Assignments as Assignments
AssignmentsInformation = Assignments.AssignmentsInformationClass()

This part must be at first lines of this file.

Then user define imports of the Assignment Information files:

from . import Assignment1
from .Others import Assignment2

All assignments must be in same folder or inside subfolders of the Information folder. Because reader of the modules haven't any "good" prediction of the files folder, import should be relative.

After import Assignment Information files, append Assignment classes into AssignmentInformation object, and add them key value which will be used in generation (read usage):

AssignmentsInformation.append(Assignment1.Assignment1, "a")
AssignmentsInformation.append(Assignment2.ExampleClassName2, "a")

This example add Assignment1 and Assignment2 into same key-class. They must have different Assignment numbers to avoid numbering conflicts.

Example of the full AssignmentsInformation file

import Scripts.Assignments as Assignments
AssignmentsInformation = Assignments.AssignmentsInformationClass()

#Imports
from . import Assignment1
from .Others import Assignment2

#Append assignments into Assignments Information List
AssignmentsInformation.append(Assignment1.Assignment1, "a")
AssignmentsInformation.append(Assignment2.ExampleClassName2, "a")

You can also check tests branch with example of the it's AssignmentsInformation.py file.

Clone this wiki locally