Skip to main content

Moodle GIFT files parser

Project description

Python Moodle GIFT parser

Python Moodle GIFT parser is a parser for GIFT files: https://docs.moodle.org/38/en/GIFT_format

The program consist in two parts: parser.py with lex/yacc and gift.py 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 example.py 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 pypi.org: 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 = myfile.read()
    gift_object = parser.parse(s)

From here you'll have Gift object into gift_object (see pygiftparser/gift.py 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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file pygiftparserrgmf-0.0.5.tar.gz.

File metadata

  • Download URL: pygiftparserrgmf-0.0.5.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

File hashes

Hashes for pygiftparserrgmf-0.0.5.tar.gz
Algorithm Hash digest
SHA256 81f88d86f838b4e28e671ca5543b14a994b2d34d96d0d658b962dbc393a8cd1b
MD5 52385acf4303506b21d5b71d4b2ab28a
BLAKE2b-256 89d6021124de3f22e2aeffb5bd7562ebe97a3e04bf672db0814c2a3f68cd9ade

See more details on using hashes here.

File details

Details for the file pygiftparserrgmf-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: pygiftparserrgmf-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 30.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

File hashes

Hashes for pygiftparserrgmf-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0084fca6b73f0f47813e1cf168cdaef39e236bf94b34931891451ec45ae4d2ec
MD5 862866ee34c42ba05f4a0844621463ac
BLAKE2b-256 c249671beff93bb460139c8156ec0faa5af652b3f1cb0ae35e9353c8a54cb6df

See more details on using hashes here.

Supported by

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