Stubbing out the initial framework
authorW. Trevor King <wking@tremily.us>
Mon, 4 Feb 2013 23:05:32 +0000 (18:05 -0500)
committerW. Trevor King <wking@tremily.us>
Mon, 4 Feb 2013 23:05:32 +0000 (18:05 -0500)
.gitignore [new file with mode: 0644]
README [new file with mode: 0644]
pq.py [new file with mode: 0755]
quizzer/__init__.py [new file with mode: 0644]
quizzer/cli.py [new file with mode: 0644]
quizzer/question.py [new file with mode: 0644]
quizzer/quiz.py [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..bee8a64
--- /dev/null
@@ -0,0 +1 @@
+__pycache__
diff --git a/README b/README
new file mode 100644 (file)
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 (executable)
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 (file)
index 0000000..3a4b731
--- /dev/null
@@ -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 (file)
index 0000000..7a63e87
--- /dev/null
@@ -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 (file)
index 0000000..b9435c8
--- /dev/null
@@ -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 (file)
index 0000000..651a514
--- /dev/null
@@ -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