Skip to main content

Moodle GIFT files parser

Project description

Python Moodle GIFT parser

Python Moodle GIFT parser is a parser for GIFT files:

The program consist in two parts: with lex/yacc and with classes where parser results will saved. The class Gift will contain all questions and every Question will have an answer (there are several types of answers - read the Moodle GIFT documentation).

How to run (use) the parser

There is an script python with an example. This script expect a file and parse it. After that it prints the object Gift with all information catched by the parser.

Use it like a package in your own project

You can install it like a package using pip from pip install pygiftparserrgmf.

After that, you can parse a file like this:

from pygiftparserrgmf import parser

with open('gift_file.txt', 'r') as myfile:
    s =
    gift_object = parser.parse(s)

From here you'll have Gift object into gift_object (see pygiftparser/ file).

Hot to test the parser

Inside tests folder there are several tests. You can run all of them executing the command python -m unittest discover -v -s tests/.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygiftparserrgmf-0.0.5.tar.gz (11.6 kB view hashes)

Uploaded source

Built Distribution

pygiftparserrgmf-0.0.5-py3-none-any.whl (30.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page