Commits

Richard Shea  committed 007149e Draft

Moving diagnostic.py so that it's no longer in a package

  • Participants
  • Parent commits 48d596a

Comments (0)

Files changed (2)

File MathsMish/diagnostic.py

-import pprint
-from MathsMish.QuestionMachine import QuestionMachine
-import MathsMish.MMDBLogger
-import logging
-def mmeval(s):
-    s = s.replace("x", "*")
-    answer = eval(s)
-    return answer
-module_logger = logging.getLogger("MMDB.primary")
-qMachine=QuestionMachine(1,'x')
-l = qMachine.CandidateSpace
-for ll in l:
-    print ll
-print len(qMachine.CandidateSpace)
-print "About to start getting questions"
-for i in range(20):
-    aQuestion = qMachine.getNextQuestion()
-    questionInString = "%s %s %s" % (aQuestion.sum.lhs, aQuestion.sum.operator, aQuestion.sum.rhs)
-    print questionInString
-    logging.debug(questionInString)
-    answer = mmeval(questionInString)
-    if i % 3 == 0:
-        Adjustedanswer = answer + 1
-    else:
-        Adjustedanswer = answer
-    module_logger.debug("Question is : %s. Calculated Answer is %s. Adjusted Answer is %s" % (questionInString, answer, Adjustedanswer))
-    module_logger.debug("dir(qq) = " % (dir(aQuestion)))
-    aQuestion.suppliedAnswer = Adjustedanswer
-    qMachine.answerQuestion(Adjustedanswer, aQuestion)
-print "Finished in loop"
-
-
-

File diagnostic.py

+import pprint
+from MathsMish.QuestionMachine import QuestionMachine
+import MathsMish.MMDBLogger
+import logging
+def mmeval(s):
+    s = s.replace("x", "*")
+    answer = eval(s)
+    return answer
+module_logger = logging.getLogger("MMDB.primary")
+qMachine=QuestionMachine(1,'x')
+l = qMachine.CandidateSpace
+for ll in l:
+    print ll
+print len(qMachine.CandidateSpace)
+print "About to start getting questions"
+for i in range(20):
+    aQuestion = qMachine.getNextQuestion()
+    questionInString = "%s %s %s" % (aQuestion.sum.lhs, aQuestion.sum.operator, aQuestion.sum.rhs)
+    print questionInString
+    logging.debug(questionInString)
+    answer = mmeval(questionInString)
+    if i % 3 == 0:
+        Adjustedanswer = answer + 1
+    else:
+        Adjustedanswer = answer
+    module_logger.debug("Question is : %s. Calculated Answer is %s. Adjusted Answer is %s" % (questionInString, answer, Adjustedanswer))
+    module_logger.debug("dir(qq) = " % (dir(aQuestion)))
+    aQuestion.suppliedAnswer = Adjustedanswer
+    qMachine.answerQuestion(Adjustedanswer, aQuestion)
+print "Finished in loop"
+
+
+