QuizGenerator 0.6.0__py3-none-any.whl → 0.6.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.
@@ -2338,6 +2338,23 @@ class ContentAST:
2338
2338
  d = decimal.Decimal(f.numerator).quantize(q, rounding=decimal.ROUND_HALF_UP)
2339
2339
  outs.add(format(d, 'f'))
2340
2340
 
2341
+ # Simple fraction
2342
+ if allow_simple_fraction:
2343
+ fr = f.limit_denominator(max_denominator)
2344
+ if fr == f:
2345
+ a, b = fr.numerator, fr.denominator
2346
+ if fr.denominator > 1:
2347
+ outs.add(f"{a}/{b}")
2348
+ if include_spaces:
2349
+ outs.add(f"{a} / {b}")
2350
+ if allow_mixed and b != 1 and abs(a) > b:
2351
+ sign = '-' if a < 0 else ''
2352
+ A = abs(a)
2353
+ whole, rem = divmod(A, b)
2354
+ outs.add(f"{sign}{whole} {rem}/{b}")
2355
+ else:
2356
+ return sorted(outs, key=lambda s: (len(s), s))
2357
+
2341
2358
  # Fixed-decimal form
2342
2359
  q = decimal.Decimal(1).scaleb(-ContentAST.Answer.DEFAULT_ROUNDING_DIGITS)
2343
2360
  d = (decimal.Decimal(f.numerator) / decimal.Decimal(f.denominator)).quantize(q, rounding=decimal.ROUND_HALF_UP)
@@ -2354,20 +2371,6 @@ class ContentAST:
2354
2371
  s = '0'
2355
2372
  outs.add(s)
2356
2373
 
2357
- # Simple fraction
2358
- if allow_simple_fraction:
2359
- fr = f.limit_denominator(max_denominator)
2360
- if fr == f:
2361
- a, b = fr.numerator, fr.denominator
2362
- outs.add(f"{a}/{b}")
2363
- if include_spaces:
2364
- outs.add(f"{a} / {b}")
2365
- if allow_mixed and b != 1 and abs(a) > b:
2366
- sign = '-' if a < 0 else ''
2367
- A = abs(a)
2368
- whole, rem = divmod(A, b)
2369
- outs.add(f"{sign}{whole} {rem}/{b}")
2370
-
2371
2374
  return sorted(outs, key=lambda s: (len(s), s))
2372
2375
 
2373
2376
  @staticmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: QuizGenerator
3
- Version: 0.6.0
3
+ Version: 0.6.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
@@ -1,7 +1,7 @@
1
1
  QuizGenerator/__init__.py,sha256=8EV-k90A3PNC8Cm2-ZquwNyVyvnwW1gs6u-nGictyhs,840
2
2
  QuizGenerator/__main__.py,sha256=Dd9w4R0Unm3RiXztvR4Y_g9-lkWp6FHg-4VN50JbKxU,151
3
3
  QuizGenerator/constants.py,sha256=AO-UWwsWPLb1k2JW6KP8rl9fxTcdT0rW-6XC6zfnDOs,4386
4
- QuizGenerator/contentast.py,sha256=lK92FlRfKnNU-9AhG8RJbCkpQixo5n7bmwvggyPazpM,93664
4
+ QuizGenerator/contentast.py,sha256=MzM5yaQ1XVLIMh9ag-KYWJ9qrD539aQZkgDp8v7At_E,93788
5
5
  QuizGenerator/generate.py,sha256=bOkR6JhGQE0r4zbRWhC_3Dsj5hOEk6-jzFLcjk-qwKg,14811
6
6
  QuizGenerator/misc.py,sha256=wtlrEpmEpoE6vNRmgjNUmuWnRdQKSCYfrqeoTagNaxg,464
7
7
  QuizGenerator/mixins.py,sha256=HEhdGdeghqGWoajADTAIdUjkzwDSYl1b65LAkUdV50U,19211
@@ -43,8 +43,8 @@ QuizGenerator/premade_questions/cst463/neural-network-basics/__init__.py,sha256=
43
43
  QuizGenerator/premade_questions/cst463/neural-network-basics/neural_network_questions.py,sha256=luWlTfj1UM1yQDQzs_tNzTV67qXhRUBwNt8QrV74XHs,46115
44
44
  QuizGenerator/premade_questions/cst463/tensorflow-intro/__init__.py,sha256=G1gEHtG4KakYgi8ZXSYYhX6bQRtnm2tZVGx36d63Nmo,173
45
45
  QuizGenerator/premade_questions/cst463/tensorflow-intro/tensorflow_questions.py,sha256=8Wo38kTd_n0Oau2ERpvcudB9uJiOVDYYQNeWu9v4Tyo,33516
46
- quizgenerator-0.6.0.dist-info/METADATA,sha256=F6pWRrq1r55-tR5-lLyLpegiV26GxCeP4X7Y1w_NK8k,7212
47
- quizgenerator-0.6.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
48
- quizgenerator-0.6.0.dist-info/entry_points.txt,sha256=aOIdRdw26xY8HkxOoKHBnUPe2mwGv5Ti3U1zojb6zxQ,98
49
- quizgenerator-0.6.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
50
- quizgenerator-0.6.0.dist-info/RECORD,,
46
+ quizgenerator-0.6.1.dist-info/METADATA,sha256=2Odb3SpBU-voYkEMehqtzhjU1K_Tn4OZo5vmY88HM9I,7212
47
+ quizgenerator-0.6.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
48
+ quizgenerator-0.6.1.dist-info/entry_points.txt,sha256=aOIdRdw26xY8HkxOoKHBnUPe2mwGv5Ti3U1zojb6zxQ,98
49
+ quizgenerator-0.6.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
50
+ quizgenerator-0.6.1.dist-info/RECORD,,