QuizGenerator 0.3.0__py3-none-any.whl → 0.3.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.
- QuizGenerator/premade_questions/cst334/persistence_questions.py +78 -23
- QuizGenerator/premade_questions/cst463/models/weight_counting.py +1 -1
- {quizgenerator-0.3.0.dist-info → quizgenerator-0.3.1.dist-info}/METADATA +1 -1
- {quizgenerator-0.3.0.dist-info → quizgenerator-0.3.1.dist-info}/RECORD +7 -7
- {quizgenerator-0.3.0.dist-info → quizgenerator-0.3.1.dist-info}/WHEEL +0 -0
- {quizgenerator-0.3.0.dist-info → quizgenerator-0.3.1.dist-info}/entry_points.txt +0 -0
- {quizgenerator-0.3.0.dist-info → quizgenerator-0.3.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
4
|
import abc
|
|
5
|
+
import difflib
|
|
5
6
|
import logging
|
|
6
7
|
|
|
7
8
|
from QuizGenerator.question import Question, Answer, QuestionRegistry
|
|
@@ -365,31 +366,85 @@ class VSFS_states(IOQuestion):
|
|
|
365
366
|
def get_explanation(self) -> ContentAST.Section:
|
|
366
367
|
explanation = ContentAST.Section()
|
|
367
368
|
|
|
368
|
-
|
|
369
|
+
log.debug(f"self.start_state: {self.start_state}")
|
|
370
|
+
log.debug(f"self.end_state: {self.end_state}")
|
|
371
|
+
|
|
372
|
+
explanation.add_elements([
|
|
369
373
|
ContentAST.Paragraph([
|
|
370
|
-
"
|
|
371
|
-
"
|
|
372
|
-
"<a href=\"https://github.com/chyyuu/os_tutorial_lab/blob/master/ostep/ostep13-vsfs.md\">here</a>, "
|
|
373
|
-
"as well as simulator code. Please note that the code uses python 2.",
|
|
374
|
-
"",
|
|
375
|
-
"In general, I recommend looking for differences between the two outputs. Recommended steps would be:",
|
|
376
|
-
"<ol>"
|
|
377
|
-
|
|
378
|
-
"<li> Check to see if there are differences between the bitmaps "
|
|
379
|
-
"that could indicate a file/directroy were created or removed.</li>",
|
|
380
|
-
|
|
381
|
-
"<li>Check the listed inodes to see if any entries have changed. "
|
|
382
|
-
"This might be a new entry entirely or a reference count changing. "
|
|
383
|
-
"If the references increased then this was likely a link or creation, "
|
|
384
|
-
"and if it decreased then it is likely an unlink.</li>",
|
|
385
|
-
|
|
386
|
-
"<li>Look at the data blocks to see if a new entry has "
|
|
387
|
-
"been added to a directory or a new block has been mapped.</li>",
|
|
388
|
-
|
|
389
|
-
"</ol>",
|
|
390
|
-
"These steps can usually help you quickly identify "
|
|
391
|
-
"what has occured in the simulation and key you in to the right answer."
|
|
374
|
+
"The key thing to pay attention to when solving these problems is where there are differences between the start state and the end state.",
|
|
375
|
+
"In this particular problem, we can see that these lines are different:"
|
|
392
376
|
])
|
|
377
|
+
])
|
|
378
|
+
|
|
379
|
+
chunk_to_add = []
|
|
380
|
+
lines_that_changed = []
|
|
381
|
+
for start_line, end_line in zip(self.start_state.split('\n'), self.end_state.split('\n')):
|
|
382
|
+
if start_line == end_line:
|
|
383
|
+
continue
|
|
384
|
+
lines_that_changed.append((start_line, end_line))
|
|
385
|
+
chunk_to_add.append(
|
|
386
|
+
f" - `{start_line}` -> `{end_line}`"
|
|
387
|
+
)
|
|
388
|
+
|
|
389
|
+
explanation.add_element(
|
|
390
|
+
ContentAST.Paragraph(chunk_to_add)
|
|
391
|
+
)
|
|
392
|
+
|
|
393
|
+
chunk_to_add = [
|
|
394
|
+
"A great place to start is to check to see if the bitmaps have changed as this can quickly tell us a lot of information"
|
|
395
|
+
]
|
|
396
|
+
|
|
397
|
+
inode_bitmap_lines = list(filter(lambda s: "inode bitmap" in s[0], lines_that_changed))
|
|
398
|
+
data_bitmap_lines = list(filter(lambda s: "data bitmap" in s[0], lines_that_changed))
|
|
399
|
+
|
|
400
|
+
def get_bitmap(line: str) -> str:
|
|
401
|
+
log.debug(f"line: {line}")
|
|
402
|
+
return line.split()[-1]
|
|
403
|
+
|
|
404
|
+
def highlight_changes(a: str, b: str) -> str:
|
|
405
|
+
matcher = difflib.SequenceMatcher(None, a, b)
|
|
406
|
+
result = []
|
|
407
|
+
|
|
408
|
+
for tag, i1, i2, j1, j2 in matcher.get_opcodes():
|
|
409
|
+
if tag == "equal":
|
|
410
|
+
result.append(b[j1:j2])
|
|
411
|
+
elif tag in ("insert", "replace"):
|
|
412
|
+
result.append(f"***{b[j1:j2]}***")
|
|
413
|
+
# for "delete", do nothing since text is removed
|
|
414
|
+
|
|
415
|
+
return "".join(result)
|
|
416
|
+
|
|
417
|
+
if len(inode_bitmap_lines) > 0:
|
|
418
|
+
inode_bitmap_lines = inode_bitmap_lines[0]
|
|
419
|
+
chunk_to_add.append(f"The inode bitmap lines have changed from {get_bitmap(inode_bitmap_lines[0])} to {get_bitmap(inode_bitmap_lines[1])}.")
|
|
420
|
+
if get_bitmap(inode_bitmap_lines[0]).count('1') < get_bitmap(inode_bitmap_lines[1]).count('1'):
|
|
421
|
+
chunk_to_add.append("We can see that we have added an inode, so we have either called `creat` or `mkdir`.")
|
|
422
|
+
else:
|
|
423
|
+
chunk_to_add.append("We can see that we have removed an inode, so we have called `unlink`.")
|
|
424
|
+
|
|
425
|
+
if len(data_bitmap_lines) > 0:
|
|
426
|
+
data_bitmap_lines = data_bitmap_lines[0]
|
|
427
|
+
chunk_to_add.append(f"The inode bitmap lines have changed from {get_bitmap(data_bitmap_lines[0])} to {get_bitmap(data_bitmap_lines[1])}.")
|
|
428
|
+
if get_bitmap(data_bitmap_lines[0]).count('1') < get_bitmap(data_bitmap_lines[1]).count('1'):
|
|
429
|
+
chunk_to_add.append("We can see that we have added a data block, so we have either called `mkdir` or `write`.")
|
|
430
|
+
else:
|
|
431
|
+
chunk_to_add.append("We can see that we have removed a data block, so we have `unlink`ed a file.")
|
|
432
|
+
|
|
433
|
+
if len(data_bitmap_lines) == 0 and len(inode_bitmap_lines) == 0:
|
|
434
|
+
chunk_to_add.append("If they have not changed, then we know we must have eithered called `link` or `unlink` and must check the references.")
|
|
435
|
+
|
|
436
|
+
explanation.add_element(
|
|
437
|
+
ContentAST.Paragraph(chunk_to_add)
|
|
438
|
+
)
|
|
439
|
+
|
|
440
|
+
explanation.add_elements([
|
|
441
|
+
ContentAST.Paragraph(["The overall changes are highlighted with `*` symbols below"])
|
|
442
|
+
])
|
|
443
|
+
|
|
444
|
+
explanation.add_element(
|
|
445
|
+
ContentAST.Code(
|
|
446
|
+
highlight_changes(self.start_state, self.end_state)
|
|
447
|
+
)
|
|
393
448
|
)
|
|
394
449
|
|
|
395
450
|
return explanation
|
|
@@ -194,7 +194,7 @@ class WeightCounting_CNN(WeightCounting):
|
|
|
194
194
|
)
|
|
195
195
|
]
|
|
196
196
|
)
|
|
197
|
-
return model, ["filters", "kernel_size", "strides", "padding", "pool_size"]
|
|
197
|
+
return model, ["units", "filters", "kernel_size", "strides", "padding", "pool_size"]
|
|
198
198
|
|
|
199
199
|
|
|
200
200
|
@QuestionRegistry.register("cst463.WeightCounting-RNN")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: QuizGenerator
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Generate randomized quiz questions for Canvas LMS and PDF exams
|
|
5
5
|
Project-URL: Homepage, https://github.com/OtterDen-Lab/QuizGenerator
|
|
6
6
|
Project-URL: Documentation, https://github.com/OtterDen-Lab/QuizGenerator/tree/main/documentation
|
|
@@ -22,7 +22,7 @@ QuizGenerator/premade_questions/cst334/languages.py,sha256=N5vcmZi-AFM_BZypnvNog
|
|
|
22
22
|
QuizGenerator/premade_questions/cst334/math_questions.py,sha256=za8lNqhM0RB8qefmPP-Ww0WB_SQn0iRcBKOrZgyHCQQ,9290
|
|
23
23
|
QuizGenerator/premade_questions/cst334/memory_questions.py,sha256=B4hpnMliJY-x65hNbjwbf22m-jiTi3WEXmauKv_YA84,51598
|
|
24
24
|
QuizGenerator/premade_questions/cst334/ostep13_vsfs.py,sha256=d9jjrynEw44vupAH_wKl57UoHooCNEJXaC5DoNYualk,16163
|
|
25
|
-
QuizGenerator/premade_questions/cst334/persistence_questions.py,sha256=
|
|
25
|
+
QuizGenerator/premade_questions/cst334/persistence_questions.py,sha256=hIOi-_K-0B_owWtV_YnXXW8Bb51uQF_lpVcXQkAlbXc,16520
|
|
26
26
|
QuizGenerator/premade_questions/cst334/process.py,sha256=EB0iuT9Q8FfOnmlQoXL7gkfsPyVJP55cRFOe2mWfamc,23647
|
|
27
27
|
QuizGenerator/premade_questions/cst463/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
28
|
QuizGenerator/premade_questions/cst463/gradient_descent/__init__.py,sha256=sH2CUV6zK9FT3jWTn453ys6_JTrUKRtZnU8hK6RmImU,240
|
|
@@ -39,13 +39,13 @@ QuizGenerator/premade_questions/cst463/models/cnns.py,sha256=iNuQmHgd8kwAXaofTwi
|
|
|
39
39
|
QuizGenerator/premade_questions/cst463/models/matrices.py,sha256=H61_8cF1DGCt4Z4Ssoi4SMClf6tD5wHkOqY5bMdsSt4,699
|
|
40
40
|
QuizGenerator/premade_questions/cst463/models/rnns.py,sha256=-tXeGgqPkctBBUy4RvEPqhv2kfPqoyO2wk-lNJLNWmY,6697
|
|
41
41
|
QuizGenerator/premade_questions/cst463/models/text.py,sha256=T1cmaoxNcWK1UbytFQmweL_Nmkm5ONq1m6F4AIJdmdc,6284
|
|
42
|
-
QuizGenerator/premade_questions/cst463/models/weight_counting.py,sha256=
|
|
42
|
+
QuizGenerator/premade_questions/cst463/models/weight_counting.py,sha256=acygK-MobvdmwS4UYKVVL4Ey59M1qmq8dITWOT6V-aI,6793
|
|
43
43
|
QuizGenerator/premade_questions/cst463/neural-network-basics/__init__.py,sha256=pmyCezO-20AFEQC6MR7KnAsaU9TcgZYsGQOMVkRZ-U8,149
|
|
44
44
|
QuizGenerator/premade_questions/cst463/neural-network-basics/neural_network_questions.py,sha256=pyTSvibCaLuT0LnYAZfjUoZlzywaPWWAaSZ5VepH04E,44148
|
|
45
45
|
QuizGenerator/premade_questions/cst463/tensorflow-intro/__init__.py,sha256=G1gEHtG4KakYgi8ZXSYYhX6bQRtnm2tZVGx36d63Nmo,173
|
|
46
46
|
QuizGenerator/premade_questions/cst463/tensorflow-intro/tensorflow_questions.py,sha256=dPn8Sj0yk4m02np62esMKZ7CvcljhYq3Tq51nY9aJnA,29781
|
|
47
|
-
quizgenerator-0.3.
|
|
48
|
-
quizgenerator-0.3.
|
|
49
|
-
quizgenerator-0.3.
|
|
50
|
-
quizgenerator-0.3.
|
|
51
|
-
quizgenerator-0.3.
|
|
47
|
+
quizgenerator-0.3.1.dist-info/METADATA,sha256=5Q7Q6ypYJbLZplzvY0Q2smH_dgyCqKcj_nJ7IrFLFMA,7212
|
|
48
|
+
quizgenerator-0.3.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
49
|
+
quizgenerator-0.3.1.dist-info/entry_points.txt,sha256=iViWMzswXGe88WKoue_Ib-ODUSiT_j_6f1us28w9pkc,56
|
|
50
|
+
quizgenerator-0.3.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
51
|
+
quizgenerator-0.3.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|