QuizGenerator 0.4.4__py3-none-any.whl → 0.5.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. QuizGenerator/contentast.py +952 -82
  2. QuizGenerator/generate.py +45 -9
  3. QuizGenerator/misc.py +4 -554
  4. QuizGenerator/mixins.py +47 -25
  5. QuizGenerator/premade_questions/cst334/languages.py +139 -125
  6. QuizGenerator/premade_questions/cst334/math_questions.py +78 -66
  7. QuizGenerator/premade_questions/cst334/memory_questions.py +258 -144
  8. QuizGenerator/premade_questions/cst334/persistence_questions.py +71 -33
  9. QuizGenerator/premade_questions/cst334/process.py +554 -64
  10. QuizGenerator/premade_questions/cst463/gradient_descent/gradient_calculation.py +32 -6
  11. QuizGenerator/premade_questions/cst463/gradient_descent/gradient_descent_questions.py +59 -34
  12. QuizGenerator/premade_questions/cst463/gradient_descent/loss_calculations.py +27 -8
  13. QuizGenerator/premade_questions/cst463/math_and_data/matrix_questions.py +53 -32
  14. QuizGenerator/premade_questions/cst463/math_and_data/vector_questions.py +228 -88
  15. QuizGenerator/premade_questions/cst463/models/attention.py +26 -10
  16. QuizGenerator/premade_questions/cst463/models/cnns.py +32 -19
  17. QuizGenerator/premade_questions/cst463/models/rnns.py +25 -12
  18. QuizGenerator/premade_questions/cst463/models/text.py +26 -11
  19. QuizGenerator/premade_questions/cst463/models/weight_counting.py +36 -22
  20. QuizGenerator/premade_questions/cst463/neural-network-basics/neural_network_questions.py +89 -109
  21. QuizGenerator/premade_questions/cst463/tensorflow-intro/tensorflow_questions.py +117 -51
  22. QuizGenerator/question.py +110 -15
  23. QuizGenerator/quiz.py +81 -24
  24. QuizGenerator/regenerate.py +98 -29
  25. {quizgenerator-0.4.4.dist-info → quizgenerator-0.5.1.dist-info}/METADATA +1 -1
  26. {quizgenerator-0.4.4.dist-info → quizgenerator-0.5.1.dist-info}/RECORD +29 -31
  27. QuizGenerator/README.md +0 -5
  28. QuizGenerator/logging.yaml +0 -55
  29. {quizgenerator-0.4.4.dist-info → quizgenerator-0.5.1.dist-info}/WHEEL +0 -0
  30. {quizgenerator-0.4.4.dist-info → quizgenerator-0.5.1.dist-info}/entry_points.txt +0 -0
  31. {quizgenerator-0.4.4.dist-info → quizgenerator-0.5.1.dist-info}/licenses/LICENSE +0 -0
@@ -54,7 +54,15 @@ class HardDriveAccessTime(IOQuestion, TableQuestionMixin, BodyTemplatesMixin):
54
54
  ),
55
55
  })
56
56
 
57
- def get_body(self, *args, **kwargs) -> ContentAST.Section:
57
+ def _get_body(self, *args, **kwargs):
58
+ """Build question body and collect answers."""
59
+ answers = [
60
+ self.answers["answer__rotational_delay"],
61
+ self.answers["answer__access_delay"],
62
+ self.answers["answer__transfer_delay"],
63
+ self.answers["answer__disk_access_delay"],
64
+ ]
65
+
58
66
  # Create parameter info table using mixin
59
67
  parameter_info = {
60
68
  "Hard Drive Rotation Speed": f"{self.hard_drive_rotation_speed}RPM",
@@ -84,8 +92,8 @@ class HardDriveAccessTime(IOQuestion, TableQuestionMixin, BodyTemplatesMixin):
84
92
  intro_text = "Given the information below, please calculate the following values."
85
93
 
86
94
  instructions = (
87
- f"Make sure your answers are rounded to {Answer.DEFAULT_ROUNDING_DIGITS} decimal points "
88
- f"(even if they are whole numbers), and do so after you finish all your calculations! "
95
+ f"Make sure that if you round your answers you use the unrounded values for your final calculations, "
96
+ f"otherwise you may introduce error into your calculations."
89
97
  f"(i.e. don't use your rounded answers to calculate your overall answer)"
90
98
  )
91
99
 
@@ -96,9 +104,14 @@ class HardDriveAccessTime(IOQuestion, TableQuestionMixin, BodyTemplatesMixin):
96
104
  additional_instructions=instructions
97
105
  )
98
106
 
107
+ return body, answers
108
+
109
+ def get_body(self, *args, **kwargs) -> ContentAST.Section:
110
+ """Build question body (backward compatible interface)."""
111
+ body, _ = self._get_body(*args, **kwargs)
99
112
  return body
100
-
101
- def get_explanation(self) -> ContentAST.Section:
113
+
114
+ def _get_explanation(self):
102
115
  explanation = ContentAST.Section()
103
116
 
104
117
  explanation.add_element(
@@ -150,6 +163,11 @@ class HardDriveAccessTime(IOQuestion, TableQuestionMixin, BodyTemplatesMixin):
150
163
  f"= {self.number_of_reads} \\cdot {self.access_delay:0.2f} + {self.transfer_delay:0.2f} "
151
164
  f"= {self.disk_access_delay:0.2f}ms")
152
165
  ])
166
+ return explanation, []
167
+
168
+ def get_explanation(self) -> ContentAST.Section:
169
+ """Build question explanation (backward compatible interface)."""
170
+ explanation, _ = self._get_explanation()
153
171
  return explanation
154
172
 
155
173
 
@@ -178,7 +196,15 @@ class INodeAccesses(IOQuestion, TableQuestionMixin, BodyTemplatesMixin):
178
196
  "answer__inode_index_in_block": Answer.integer("answer__inode_index_in_block", self.inode_index_in_block),
179
197
  })
180
198
 
181
- def get_body(self) -> ContentAST.Section:
199
+ def _get_body(self):
200
+ """Build question body and collect answers."""
201
+ answers = [
202
+ self.answers["answer__inode_address"],
203
+ self.answers["answer__inode_block"],
204
+ self.answers["answer__inode_address_in_block"],
205
+ self.answers["answer__inode_index_in_block"],
206
+ ]
207
+
182
208
  # Create parameter info table using mixin
183
209
  parameter_info = {
184
210
  "Block Size": f"{self.block_size} Bytes",
@@ -206,21 +232,21 @@ class INodeAccesses(IOQuestion, TableQuestionMixin, BodyTemplatesMixin):
206
232
  # Use mixin to create complete body with both tables
207
233
  intro_text = "Given the information below, please calculate the following values."
208
234
 
209
- instructions = (
210
- "(hint: they should all be round numbers). "
211
- "Remember, demonstrating you know the equations and what goes into them is generally sufficient."
212
- )
213
-
214
235
  body = self.create_parameter_calculation_body(
215
236
  intro_text=intro_text,
216
237
  parameter_table=parameter_table,
217
238
  answer_table=answer_table,
218
- additional_instructions=instructions
239
+ # additional_instructions=instructions
219
240
  )
220
241
 
242
+ return body, answers
243
+
244
+ def get_body(self) -> ContentAST.Section:
245
+ """Build question body (backward compatible interface)."""
246
+ body, _ = self._get_body()
221
247
  return body
222
-
223
- def get_explanation(self) -> ContentAST.Section:
248
+
249
+ def _get_explanation(self):
224
250
  explanation = ContentAST.Section()
225
251
 
226
252
  explanation.add_element(
@@ -292,7 +318,12 @@ class INodeAccesses(IOQuestion, TableQuestionMixin, BodyTemplatesMixin):
292
318
  f"{self.inode_index_in_block}"
293
319
  ]
294
320
  ))
295
-
321
+
322
+ return explanation, []
323
+
324
+ def get_explanation(self) -> ContentAST.Section:
325
+ """Build question explanation (backward compatible interface)."""
326
+ explanation, _ = self._get_explanation()
296
327
  return explanation
297
328
 
298
329
 
@@ -330,40 +361,42 @@ class VSFS_states(IOQuestion):
330
361
  f"{operations[-1]['cmd']}",
331
362
  kind=Answer.AnswerKind.MULTIPLE_DROPDOWN,
332
363
  correct=True,
333
- baffles=list(set([op['cmd'] for op in operations[:-1] if op != operations[-1]['cmd']]))
364
+ baffles=list(set([op['cmd'] for op in operations[:-1] if op != operations[-1]['cmd']])),
365
+ label="Command"
334
366
  )
335
367
 
336
- def get_body(self) -> ContentAST.Section:
368
+ def _get_body(self):
369
+ """Build question body and collect answers."""
370
+ answers = [self.answers["answer__cmd"]]
371
+
337
372
  body = ContentAST.Section()
338
-
373
+
339
374
  body.add_element(ContentAST.Paragraph(["What operation happens between these two states?"]))
340
-
375
+
341
376
  body.add_element(
342
377
  ContentAST.Code(
343
378
  self.start_state,
344
379
  make_small=True
345
380
  )
346
381
  )
347
-
348
- body.add_element(
349
- ContentAST.AnswerBlock(
350
- ContentAST.Answer(
351
- self.answers["answer__cmd"],
352
- label="Command"
353
- )
354
- )
355
- )
356
-
382
+
383
+ body.add_element(ContentAST.AnswerBlock(self.answers["answer__cmd"]))
384
+
357
385
  body.add_element(
358
386
  ContentAST.Code(
359
387
  self.end_state,
360
388
  make_small=True
361
389
  )
362
390
  )
363
-
391
+
392
+ return body, answers
393
+
394
+ def get_body(self) -> ContentAST.Section:
395
+ """Build question body (backward compatible interface)."""
396
+ body, _ = self._get_body()
364
397
  return body
365
-
366
- def get_explanation(self) -> ContentAST.Section:
398
+
399
+ def _get_explanation(self):
367
400
  explanation = ContentAST.Section()
368
401
 
369
402
  log.debug(f"self.start_state: {self.start_state}")
@@ -446,6 +479,11 @@ class VSFS_states(IOQuestion):
446
479
  highlight_changes(self.start_state, self.end_state)
447
480
  )
448
481
  )
449
-
482
+
483
+ return explanation, []
484
+
485
+ def get_explanation(self) -> ContentAST.Section:
486
+ """Build question explanation (backward compatible interface)."""
487
+ explanation, _ = self._get_explanation()
450
488
  return explanation
451
489