From a0c8545feafefe91dcb24043c0a39605d64bb0e9 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 4 Feb 2013 18:05:32 -0500 Subject: [PATCH] Stubbing out the initial framework --- .gitignore | 1 + README | 5 +++++ pq.py | 6 ++++++ quizzer/__init__.py | 10 ++++++++++ quizzer/cli.py | 22 ++++++++++++++++++++++ quizzer/question.py | 9 +++++++++ quizzer/quiz.py | 11 +++++++++++ 7 files changed, 64 insertions(+) create mode 100644 .gitignore create mode 100644 README create mode 100755 pq.py create mode 100644 quizzer/__init__.py create mode 100644 quizzer/cli.py create mode 100644 quizzer/question.py create mode 100644 quizzer/quiz.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bee8a64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__ diff --git a/README b/README new file mode 100644 index 0000000..c2f4264 --- /dev/null +++ b/README @@ -0,0 +1,5 @@ +Break learning up into small task-based tests for focused study. + +Tests can be defined with prerequites so a student wishing to learn a +higher level task, but out of their depth with the task itself, can +easily go back through the basics. diff --git a/pq.py b/pq.py new file mode 100755 index 0000000..5cdd0bb --- /dev/null +++ b/pq.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python + +import quizzer.cli + + +quizzer.cli.main() diff --git a/quizzer/__init__.py b/quizzer/__init__.py new file mode 100644 index 0000000..3a4b731 --- /dev/null +++ b/quizzer/__init__.py @@ -0,0 +1,10 @@ +"""Break learning up into small task-based tests for focused study +""" + +import logging as _logging + + +__version__ = '0.1' + +LOG = _logging.getLogger(__name__) +LOG.setLevel(_logging.ERROR) diff --git a/quizzer/cli.py b/quizzer/cli.py new file mode 100644 index 0000000..7a63e87 --- /dev/null +++ b/quizzer/cli.py @@ -0,0 +1,22 @@ +import argparse as _argparse + +from . import __doc__ as _module_doc +from . import __version__ +from . import quiz as _quiz + + +def main(): + parser = _argparse.ArgumentParser(description=_module_doc) + parser.add_argument( + '--version', action='version', + version='%(prog)s {}'.format(__version__)) + parser.add_argument( + 'quiz', metavar='QUIZ', + help='path to a quiz file') + + args = parser.parse_args() + + quiz = Quiz() + quiz.load(args.quiz) + for question in quiz: + print(question) diff --git a/quizzer/question.py b/quizzer/question.py new file mode 100644 index 0000000..b9435c8 --- /dev/null +++ b/quizzer/question.py @@ -0,0 +1,9 @@ +class Question (object): + def __init__(self, prompt=None, answer=None, help=None): + self.prompt = prompt + self.answer = answer + self.help = help + + def check(self, answer): + return answer == self.answer + diff --git a/quizzer/quiz.py b/quizzer/quiz.py new file mode 100644 index 0000000..651a514 --- /dev/null +++ b/quizzer/quiz.py @@ -0,0 +1,11 @@ +class Quiz (list): + def __init__(self, questions=None): + if questions is None: + questions = [] + super(Quiz, self).__init__(questions) + + def load(self): + pass + + def save(self): + pass -- 2.26.2