rbx.cp 0.5.17__tar.gz → 0.5.19__tar.gz

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 (168) hide show
  1. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/PKG-INFO +2 -1
  2. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/pyproject.toml +2 -1
  3. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/builder.py +1 -1
  4. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/code.py +8 -6
  5. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/contest/build_contest_statements.py +3 -4
  6. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/contest/contest_package.py +13 -1
  7. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/contest/contest_utils.py +0 -9
  8. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/contest/main.py +33 -22
  9. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/contest/statements.py +2 -3
  10. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/main.py +12 -5
  11. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/package.py +22 -0
  12. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/packaging/contest_main.py +2 -2
  13. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/solutions.py +49 -13
  14. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading/judge/sandboxes/timeit.py +3 -3
  15. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading/steps.py +21 -1
  16. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/utils.py +7 -0
  17. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/LICENSE +0 -0
  18. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/README.md +0 -0
  19. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/__init__.py +0 -0
  20. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/annotations.py +0 -0
  21. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/autoenum.py +0 -0
  22. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/__init__.py +0 -0
  23. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/cd.py +0 -0
  24. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/checkers.py +0 -0
  25. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/compile.py +0 -0
  26. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/conftest.py +0 -0
  27. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/contest/__init__.py +0 -0
  28. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/contest/schema.py +0 -0
  29. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/creation.py +0 -0
  30. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/deferred.py +0 -0
  31. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/download.py +0 -0
  32. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/environment.py +0 -0
  33. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/extensions.py +0 -0
  34. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/generators.py +0 -0
  35. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/generators_test.py +0 -0
  36. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/packaging/boca/extension.py +0 -0
  37. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/packaging/boca/packager.py +0 -0
  38. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/packaging/main.py +0 -0
  39. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/packaging/packager.py +0 -0
  40. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/packaging/polygon/packager.py +0 -0
  41. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/packaging/polygon/test.py +0 -0
  42. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/packaging/polygon/xml_schema.py +0 -0
  43. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/presets/__init__.py +0 -0
  44. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/presets/fetch.py +0 -0
  45. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/presets/lock_schema.py +0 -0
  46. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/presets/schema.py +0 -0
  47. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/sanitizers/warning_stack.py +0 -0
  48. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/schema.py +0 -0
  49. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/setter_config.py +0 -0
  50. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/solutions_test.py +0 -0
  51. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/statements/__init__.py +0 -0
  52. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/statements/build_statements.py +0 -0
  53. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/statements/builders.py +0 -0
  54. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/statements/joiners.py +0 -0
  55. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/statements/latex.py +0 -0
  56. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/statements/latex_jinja.py +0 -0
  57. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/statements/schema.py +0 -0
  58. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/stresses.py +0 -0
  59. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/stressing/__init__.py +0 -0
  60. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/stressing/finder_parser.py +0 -0
  61. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/stressing/generator_parser.py +0 -0
  62. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/testcases.py +0 -0
  63. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/ui/__init__.py +0 -0
  64. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/ui/captured_log.py +0 -0
  65. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/ui/css/app.tcss +0 -0
  66. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/ui/main.py +0 -0
  67. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/ui/run.py +0 -0
  68. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/validators.py +0 -0
  69. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/box/validators_test.py +0 -0
  70. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/checker.py +0 -0
  71. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/clone.py +0 -0
  72. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/config.py +0 -0
  73. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/conftest.py +0 -0
  74. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/console.py +0 -0
  75. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/create.py +0 -0
  76. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/edit.py +0 -0
  77. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading/__init__.py +0 -0
  78. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading/caching.py +0 -0
  79. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading/conftest.py +0 -0
  80. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading/judge/__init__.py +0 -0
  81. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading/judge/cacher.py +0 -0
  82. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading/judge/digester.py +0 -0
  83. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading/judge/sandbox.py +0 -0
  84. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading/judge/sandboxes/__init__.py +0 -0
  85. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading/judge/sandboxes/isolate.py +0 -0
  86. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading/judge/sandboxes/stupid_sandbox.py +0 -0
  87. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading/judge/storage.py +0 -0
  88. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading/judge/test.py +0 -0
  89. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading/judge/testiso.py +0 -0
  90. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading/steps_with_caching.py +0 -0
  91. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading/steps_with_caching_run_test.py +0 -0
  92. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/grading_utils.py +0 -0
  93. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/hydration.py +0 -0
  94. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/main.py +0 -0
  95. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/metadata.py +0 -0
  96. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/providers/__init__.py +0 -0
  97. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/providers/codeforces.py +0 -0
  98. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/providers/provider.py +0 -0
  99. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/checkers/boilerplate.cpp +0 -0
  100. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/default_config.json +0 -0
  101. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/default_setter_config.mac.yml +0 -0
  102. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/default_setter_config.yml +0 -0
  103. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/envs/default.rbx.yml +0 -0
  104. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/envs/isolate.rbx.yml +0 -0
  105. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/packagers/boca/checker.sh +0 -0
  106. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/packagers/boca/compare +0 -0
  107. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/packagers/boca/compile/c +0 -0
  108. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/packagers/boca/compile/cc +0 -0
  109. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/packagers/boca/compile/cpp +0 -0
  110. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/packagers/boca/compile/java +0 -0
  111. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/packagers/boca/compile/kt +0 -0
  112. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/packagers/boca/compile/pas +0 -0
  113. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/packagers/boca/compile/py2 +0 -0
  114. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/packagers/boca/compile/py3 +0 -0
  115. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/packagers/boca/run/c +0 -0
  116. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/packagers/boca/run/cc +0 -0
  117. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/packagers/boca/run/cpp +0 -0
  118. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/packagers/boca/run/java +0 -0
  119. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/packagers/boca/run/kt +0 -0
  120. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/packagers/boca/run/py2 +0 -0
  121. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/packagers/boca/run/py3 +0 -0
  122. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/contest/contest.rbx.yml +0 -0
  123. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/contest/statement/contest.rbx.tex +0 -0
  124. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/contest/statement/olymp.sty +0 -0
  125. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/contest/statement/template.rbx.tex +0 -0
  126. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/preset.rbx.yml +0 -0
  127. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/problem/.gitignore +0 -0
  128. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/problem/gen.cpp +0 -0
  129. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/problem/problem.rbx.yml +0 -0
  130. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/problem/random.py +0 -0
  131. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/problem/random.txt +0 -0
  132. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/problem/sols/main.cpp +0 -0
  133. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/problem/sols/slow.cpp +0 -0
  134. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/problem/sols/wa.cpp +0 -0
  135. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/problem/statement/olymp.sty +0 -0
  136. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/problem/statement/projecao.png +0 -0
  137. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/problem/statement/statement.rbx.tex +0 -0
  138. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/problem/statement/template.rbx.tex +0 -0
  139. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/problem/tests/samples/000.in +0 -0
  140. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/problem/tests/samples/001.in +0 -0
  141. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/problem/validator.cpp +0 -0
  142. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/presets/default/problem/wcmp.cpp +0 -0
  143. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/resources/templates/template.cpp +0 -0
  144. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/run.py +0 -0
  145. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/schema.py +0 -0
  146. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/submit.py +0 -0
  147. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/submitors/__init__.py +0 -0
  148. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/submitors/codeforces.py +0 -0
  149. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/submitors/submitor.py +0 -0
  150. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/test.py +0 -0
  151. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testcase.py +0 -0
  152. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testcase_rendering.py +0 -0
  153. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testdata/box1/gen1.cpp +0 -0
  154. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testdata/box1/gen2.cpp +0 -0
  155. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testdata/box1/genScript.py +0 -0
  156. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testdata/box1/hard-tle.sol.cpp +0 -0
  157. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testdata/box1/ole.cpp +0 -0
  158. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testdata/box1/problem.rbx.yml +0 -0
  159. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testdata/box1/re.sol.cpp +0 -0
  160. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testdata/box1/sol.cpp +0 -0
  161. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testdata/box1/tests/1.in +0 -0
  162. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testdata/box1/tle-and-incorrect.sol.cpp +0 -0
  163. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testdata/box1/tle.sol.cpp +0 -0
  164. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testdata/box1/validator.cpp +0 -0
  165. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testdata/box1/wa.sol.cpp +0 -0
  166. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testdata/caching/executable.py +0 -0
  167. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testdata/compatible +0 -0
  168. {rbx_cp-0.5.17 → rbx_cp-0.5.19}/rbx/testing_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rbx.cp
3
- Version: 0.5.17
3
+ Version: 0.5.19
4
4
  Summary:
5
5
  Author: Roberto Sales
6
6
  Requires-Python: >=3.9,<4.0
@@ -27,6 +27,7 @@ Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
27
27
  Requires-Dist: questionary (>=2.1.0,<3.0.0)
28
28
  Requires-Dist: requests (>=2.32.3,<3.0.0)
29
29
  Requires-Dist: rich (>=13.9.4,<14.0.0)
30
+ Requires-Dist: ruyaml (>=0.91.0,<0.92.0)
30
31
  Requires-Dist: textual (>=0.79.1,<0.80.0)
31
32
  Requires-Dist: typer (>=0.15.1,<0.16.0)
32
33
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "rbx.cp"
3
- version = "0.5.17"
3
+ version = "0.5.19"
4
4
  description = ""
5
5
  packages = [
6
6
  {include = "rbx"}
@@ -30,6 +30,7 @@ pyte = "^0.8.2"
30
30
  questionary = "^2.1.0"
31
31
  lark = "^1.2.2"
32
32
  chardet = "^5.2.0"
33
+ ruyaml = "^0.91.0"
33
34
 
34
35
  [tool.poetry.scripts]
35
36
  rbc = "rbx.main:app"
@@ -103,5 +103,5 @@ async def verify(verification: environment.VerificationParam) -> bool:
103
103
  return await print_run_report(
104
104
  solution_result,
105
105
  console.console,
106
- verification,
106
+ VerificationLevel(verification),
107
107
  )
@@ -124,6 +124,14 @@ def compile_item(
124
124
  if sanitized.should_sanitize():
125
125
  commands = add_sanitizer_flags(commands)
126
126
 
127
+ # Remove any memory constraints for a sanitized executable.
128
+ # Sanitizers are known to be memory-hungry.
129
+ sandbox_params.address_space = None
130
+
131
+ # Reset timeout configs since sanitizers are known to be time-hungry.
132
+ sandbox_params.timeout = None
133
+ sandbox_params.wallclock_timeout = None
134
+
127
135
  compiled_digest = DigestHolder()
128
136
 
129
137
  artifacts = GradingArtifacts()
@@ -214,12 +222,6 @@ def run_item(
214
222
  # Reset timeout configs since sanitizers are known to be time-hungry.
215
223
  sandbox_params.timeout = None
216
224
  sandbox_params.wallclock_timeout = None
217
- orig_execution_config = get_execution_config(language)
218
- if orig_execution_config.sandbox is not None:
219
- sandbox_params.timeout = orig_execution_config.sandbox.timeLimit
220
- sandbox_params.wallclock_timeout = (
221
- orig_execution_config.sandbox.wallTimeLimit
222
- )
223
225
  sanitized = True
224
226
 
225
227
  sandbox_params.set_stdall(
@@ -7,8 +7,7 @@ from typing import List, Optional, Tuple
7
7
  import typer
8
8
 
9
9
  from rbx import console, testing_utils
10
- from rbx.box import cd
11
- from rbx.box.contest import contest_utils
10
+ from rbx.box import cd, package
12
11
  from rbx.box.contest.contest_package import get_problems
13
12
  from rbx.box.contest.schema import Contest, ContestProblem, ContestStatement
14
13
  from rbx.box.schema import Package, Testcase
@@ -60,7 +59,7 @@ class ExtractedProblem:
60
59
 
61
60
  def _get_samples(problem: ContestProblem) -> List[Testcase]:
62
61
  with cd.new_package_cd(problem.get_path()):
63
- contest_utils.clear_package_cache()
62
+ package.clear_package_cache()
64
63
  return get_samples()
65
64
 
66
65
 
@@ -158,7 +157,7 @@ def _build_problem_statements(
158
157
  f'Building statement for problem {extracted_problem.problem.short_name}...'
159
158
  )
160
159
  with cd.new_package_cd(extracted_problem.problem.get_path()):
161
- contest_utils.clear_package_cache()
160
+ package.clear_package_cache()
162
161
  # TODO: respect steps override
163
162
  content, _ = build_statements.build_statement_bytes(
164
163
  extracted_problem.statement,
@@ -1,7 +1,8 @@
1
1
  import functools
2
2
  import pathlib
3
- from typing import List, Optional
3
+ from typing import List, Optional, Tuple
4
4
 
5
+ import ruyaml
5
6
  import typer
6
7
  from pydantic import ValidationError
7
8
 
@@ -81,3 +82,14 @@ def get_problems(contest: Contest) -> List[Package]:
81
82
  for problem in contest.problems:
82
83
  problems.append(find_problem_package_or_die(problem.get_path()))
83
84
  return problems
85
+
86
+
87
+ def get_ruyaml() -> Tuple[ruyaml.YAML, ruyaml.Any]:
88
+ contest_yaml_path = find_contest_yaml()
89
+ if contest_yaml_path is None:
90
+ console.console.print(
91
+ f'Contest not found in {pathlib.Path().absolute()}', style='error'
92
+ )
93
+ raise typer.Exit(1)
94
+ res = ruyaml.YAML()
95
+ return res, res.load(contest_yaml_path.read_text())
@@ -2,15 +2,6 @@ from rbx.box import environment, package
2
2
  from rbx.box.contest import contest_package
3
3
 
4
4
 
5
- def clear_package_cache():
6
- pkgs = [package]
7
-
8
- for pkg in pkgs:
9
- for fn in pkg.__dict__.values():
10
- if hasattr(fn, 'cache_clear'):
11
- fn.cache_clear()
12
-
13
-
14
5
  def clear_all_caches():
15
6
  pkgs = [package, environment, contest_package]
16
7
 
@@ -8,12 +8,11 @@ import typer
8
8
 
9
9
  from rbx import annotations, console, utils
10
10
  from rbx.box import cd, creation, presets
11
- from rbx.box.contest import contest_utils, statements
11
+ from rbx.box.contest import contest_package, contest_utils, statements
12
12
  from rbx.box.contest.contest_package import (
13
13
  find_contest,
14
14
  find_contest_package_or_die,
15
15
  find_contest_yaml,
16
- save_contest,
17
16
  within_contest,
18
17
  )
19
18
  from rbx.box.contest.schema import ContestProblem
@@ -145,16 +144,19 @@ def add(path: str, short_name: str, preset: Optional[str] = None):
145
144
  creation.create(name, preset=preset, path=pathlib.Path(path))
146
145
 
147
146
  contest = find_contest_package_or_die()
148
- # Reassign mutable object before saving.
149
- contest.problems = sorted(
150
- [
151
- *contest.problems,
152
- ContestProblem(short_name=short_name, path=pathlib.Path(path)),
153
- ],
154
- key=lambda p: p.short_name,
147
+
148
+ ru, contest = contest_package.get_ruyaml()
149
+
150
+ contest['problems'].append(
151
+ {
152
+ 'short_name': short_name,
153
+ 'path': path,
154
+ }
155
155
  )
156
+ dest = find_contest_yaml()
157
+ assert dest is not None
158
+ utils.save_ruyaml(dest, ru, contest)
156
159
 
157
- save_contest(contest)
158
160
  console.console.print(
159
161
  f'Problem [item]{name} ({short_name})[/item] added to contest at [item]{path}[/item].'
160
162
  )
@@ -165,25 +167,34 @@ def add(path: str, short_name: str, preset: Optional[str] = None):
165
167
  def remove(path_or_short_name: str):
166
168
  contest = find_contest_package_or_die()
167
169
 
168
- kept_problems = []
169
- removed_problems = []
170
- for problem in contest.problems:
170
+ removed_problem_idx = None
171
+ removed_problem = None
172
+ for i, problem in enumerate(contest.problems):
171
173
  if (
172
174
  problem.path == pathlib.Path(path_or_short_name)
173
175
  or problem.short_name == path_or_short_name
174
176
  ):
175
- removed_problems.append(problem)
176
- else:
177
- kept_problems.append(problem)
177
+ removed_problem_idx = i
178
+ removed_problem = problem
179
+ break
178
180
 
179
- contest.problems = kept_problems
180
- save_contest(contest)
181
-
182
- for problem in removed_problems:
183
- shutil.rmtree(str(problem.path), ignore_errors=True)
181
+ if removed_problem_idx is None or removed_problem is None:
184
182
  console.console.print(
185
- f'Problem [item]{problem.short_name}[/item] removed from contest at [item]{problem.path}[/item].'
183
+ f'[error]Problem [item]{path_or_short_name}[/item] not found in contest.[/error]'
186
184
  )
185
+ raise typer.Exit(1)
186
+
187
+ ru, contest = contest_package.get_ruyaml()
188
+
189
+ del contest['problems'][removed_problem_idx]
190
+ dest = find_contest_yaml()
191
+ assert dest is not None
192
+ utils.save_ruyaml(dest, ru, contest)
193
+
194
+ shutil.rmtree(str(removed_problem.path), ignore_errors=True)
195
+ console.console.print(
196
+ f'Problem [item]{removed_problem.short_name}[/item] removed from contest at [item]{removed_problem.path}[/item].'
197
+ )
187
198
 
188
199
 
189
200
  @app.command(
@@ -3,8 +3,7 @@ from typing import Annotated, List, Optional
3
3
  import typer
4
4
 
5
5
  from rbx import annotations, console
6
- from rbx.box import builder, cd, environment
7
- from rbx.box.contest import contest_utils
6
+ from rbx.box import builder, cd, environment, package
8
7
  from rbx.box.contest.build_contest_statements import build_statement
9
8
  from rbx.box.contest.contest_package import (
10
9
  find_contest_package_or_die,
@@ -50,7 +49,7 @@ def build(
50
49
  f'Processing problem [item]{problem.short_name}[/item]...'
51
50
  )
52
51
  with cd.new_package_cd(problem.get_path()):
53
- contest_utils.clear_package_cache()
52
+ package.clear_package_cache()
54
53
 
55
54
  if not builder.build(
56
55
  verification=verification, groups=set(['samples']), output=None
@@ -215,7 +215,7 @@ def run(
215
215
  print_run_report(
216
216
  solution_result,
217
217
  console.console,
218
- verification,
218
+ VerificationLevel(verification),
219
219
  detailed=detailed,
220
220
  )
221
221
  )
@@ -250,7 +250,7 @@ def _time_impl(check: bool, detailed: bool) -> Optional[int]:
250
250
  print_run_report(
251
251
  solution_result,
252
252
  console.console,
253
- verification,
253
+ VerificationLevel(verification),
254
254
  detailed=detailed,
255
255
  )
256
256
  )
@@ -508,10 +508,17 @@ def stress(
508
508
  groups_by_name[testgroup] = TestcaseGroup(
509
509
  name=testgroup, generatorScript=CodeItem(path=new_script_path)
510
510
  )
511
- console.console.print(
512
- f'[warning]A testgroup for [item]{new_script_path}[/item] will not be automatically added to the problem.rbx.yml file for you.\n'
513
- 'Please add it manually. [/warning]'
511
+ ru, problem_yml = package.get_ruyaml()
512
+ problem_yml['testcases'].append(
513
+ {
514
+ 'name': testgroup,
515
+ 'generatorScript': new_script_path.name,
516
+ }
514
517
  )
518
+ dest = package.find_problem_yaml()
519
+ assert dest is not None
520
+ utils.save_ruyaml(dest, ru, problem_yml)
521
+ package.clear_package_cache()
515
522
 
516
523
  if testgroup not in groups_by_name:
517
524
  break
@@ -1,7 +1,9 @@
1
1
  import functools
2
2
  import pathlib
3
+ import sys
3
4
  from typing import Dict, List, Optional, Tuple
4
5
 
6
+ import ruyaml
5
7
  import typer
6
8
  from pydantic import ValidationError
7
9
 
@@ -119,6 +121,17 @@ def save_package(
119
121
  problem_yaml_path.write_text(utils.model_to_yaml(package))
120
122
 
121
123
 
124
+ def get_ruyaml() -> Tuple[ruyaml.YAML, ruyaml.Any]:
125
+ problem_yaml_path = find_problem_yaml()
126
+ if problem_yaml_path is None:
127
+ console.console.print(
128
+ f'Problem not found in {pathlib.Path().absolute()}', style='error'
129
+ )
130
+ raise typer.Exit(1)
131
+ res = ruyaml.YAML()
132
+ return res, res.load(problem_yaml_path.read_text())
133
+
134
+
122
135
  @functools.cache
123
136
  def get_problem_cache_dir(root: pathlib.Path = pathlib.Path()) -> pathlib.Path:
124
137
  cache_dir = find_problem(root) / '.box'
@@ -328,3 +341,12 @@ def get_compilation_files(code: CodeItem) -> List[Tuple[pathlib.Path, pathlib.Pa
328
341
  )
329
342
  )
330
343
  return res
344
+
345
+
346
+ def clear_package_cache():
347
+ pkgs = [sys.modules[__name__]]
348
+
349
+ for pkg in pkgs:
350
+ for fn in pkg.__dict__.values():
351
+ if hasattr(fn, 'cache_clear'):
352
+ fn.cache_clear()
@@ -6,7 +6,7 @@ import typer
6
6
 
7
7
  from rbx import annotations, console
8
8
  from rbx.box import cd, environment, package
9
- from rbx.box.contest import build_contest_statements, contest_package, contest_utils
9
+ from rbx.box.contest import build_contest_statements, contest_package
10
10
  from rbx.box.packaging.main import run_packager
11
11
  from rbx.box.packaging.packager import (
12
12
  BaseContestPackager,
@@ -33,7 +33,7 @@ def run_contest_packager(
33
33
  f'Processing problem [item]{problem.short_name}[/item]...'
34
34
  )
35
35
  with cd.new_package_cd(problem.get_path()):
36
- contest_utils.clear_package_cache()
36
+ package.clear_package_cache()
37
37
  package_path = run_packager(packager_cls, verification=verification)
38
38
  built_packages.append(
39
39
  BuiltProblemPackage(
@@ -13,7 +13,7 @@ import rich.table
13
13
  from pydantic import BaseModel
14
14
 
15
15
  from rbx import console
16
- from rbx.box import checkers, environment, package
16
+ from rbx.box import checkers, package
17
17
  from rbx.box.code import SanitizationLevel, compile_item, find_language_name, run_item
18
18
  from rbx.box.deferred import Deferred
19
19
  from rbx.box.environment import EnvironmentSandbox, ExecutionConfig, VerificationLevel
@@ -539,6 +539,24 @@ def get_evals_formatted_time(evals: List[Evaluation]) -> str:
539
539
  return f'{max_time} ms'
540
540
 
541
541
 
542
+ def get_capped_evals_formatted_time(
543
+ solution: Solution, evals: List[Evaluation], verification: VerificationLevel
544
+ ) -> str:
545
+ pkg = package.find_problem_package_or_die()
546
+
547
+ max_time = _get_evals_time_in_ms(evals)
548
+ has_tle = any(eval.result.outcome == Outcome.TIME_LIMIT_EXCEEDED for eval in evals)
549
+ tl = pkg.timelimit_for_language(solution.language)
550
+
551
+ if verification.value >= VerificationLevel.FULL.value:
552
+ # Using double TL for verification.
553
+ tl = tl * 2
554
+
555
+ if has_tle and max_time > tl:
556
+ return f'>{tl} ms'
557
+ return f'{max_time} ms'
558
+
559
+
542
560
  def get_evals_formatted_memory(evals: List[Evaluation]) -> str:
543
561
  max_memory = _get_evals_memory_in_bytes(evals)
544
562
  if max_memory < 1024 * 1024:
@@ -628,10 +646,12 @@ def _print_solution_outcome(
628
646
 
629
647
  if has_sanitizer_warnings:
630
648
  console.print(
631
- '[warning]WARNING[/warning] The solution had sanitizer errors or warnings, marked with [item]*[/item]. See their stderr for more details.'
649
+ '[warning]WARNING[/warning] The solution had sanitizer errors or warnings, marked with [warning]*[/warning]. See their stderr for more details.'
632
650
  )
633
651
 
634
- console.print(f'Time: {get_evals_formatted_time(evals)}')
652
+ console.print(
653
+ f'Time: {get_capped_evals_formatted_time(solution, evals, verification)}'
654
+ )
635
655
  console.print(f'Memory: {get_evals_formatted_memory(evals)}')
636
656
  return len(unmatched_bad_verdicts) == 0
637
657
 
@@ -698,6 +718,7 @@ async def _render_detailed_group_table(
698
718
  skeleton: SolutionReportSkeleton,
699
719
  structured_evaluations: StructuredEvaluation,
700
720
  console: rich.console.Console,
721
+ verification: VerificationLevel = VerificationLevel.NONE,
701
722
  ):
702
723
  group_skeleton = skeleton.find_group_skeleton(group.name)
703
724
  assert group_skeleton is not None
@@ -722,12 +743,16 @@ async def _render_detailed_group_table(
722
743
  row.append('...')
723
744
  continue
724
745
 
746
+ evals_per_solution[str(solution.path)].append(eval)
747
+
725
748
  verdict = get_testcase_markup_verdict(eval)
726
- time = get_evals_formatted_time([eval])
749
+ time = get_capped_evals_formatted_time(solution, [eval], verification)
750
+ memory = get_evals_formatted_memory([eval])
751
+ full_item = f'{verdict} {time} / {memory}'
727
752
  if eval.result.sanitizer_warnings:
728
- time = f'{time} [item]*[/item]'
729
- evals_per_solution[str(solution.path)].append(eval)
730
- row.append(f'{verdict} {time}')
753
+ full_item = f'{full_item} [warning]*[/warning]'
754
+
755
+ row.append(full_item)
731
756
  table.add_row(*row)
732
757
 
733
758
  if table.row_count > 0:
@@ -738,7 +763,11 @@ async def _render_detailed_group_table(
738
763
  if not non_null_evals:
739
764
  summary_row.append('...')
740
765
  continue
741
- summary_row.append(' ' + get_evals_formatted_time(non_null_evals))
766
+ formatted_time = get_capped_evals_formatted_time(
767
+ solution, non_null_evals, verification
768
+ )
769
+ formatted_memory = get_evals_formatted_memory(non_null_evals)
770
+ summary_row.append(f' {formatted_time} / {formatted_memory}')
742
771
  table.add_section()
743
772
  table.add_row(*summary_row)
744
773
  return table
@@ -763,6 +792,7 @@ async def _print_detailed_run_report(
763
792
  console: rich.console.Console,
764
793
  structured_evaluations: StructuredEvaluation,
765
794
  timing: bool = True,
795
+ verification: VerificationLevel = VerificationLevel.NONE,
766
796
  ):
767
797
  for group in result.skeleton.groups:
768
798
  console.print(f'[bold][status]{group.name}[/status][/bold]')
@@ -772,6 +802,7 @@ async def _print_detailed_run_report(
772
802
  result.skeleton,
773
803
  structured_evaluations,
774
804
  console,
805
+ verification=verification,
775
806
  )
776
807
  continue
777
808
 
@@ -788,6 +819,7 @@ async def _print_detailed_run_report(
788
819
  solution,
789
820
  all_evals,
790
821
  console,
822
+ verification=verification,
791
823
  )
792
824
  ok = ok and cur_ok
793
825
  console.print()
@@ -802,7 +834,7 @@ async def _print_detailed_run_report(
802
834
  async def print_run_report(
803
835
  result: RunSolutionResult,
804
836
  console: rich.console.Console,
805
- verification: environment.VerificationParam,
837
+ verification: VerificationLevel,
806
838
  detailed: bool = False,
807
839
  timing: bool = True,
808
840
  ) -> bool:
@@ -811,7 +843,11 @@ async def print_run_report(
811
843
  )
812
844
  if detailed:
813
845
  return await _print_detailed_run_report(
814
- result, console, structured_evaluations, timing=timing
846
+ result,
847
+ console,
848
+ structured_evaluations,
849
+ verification=verification,
850
+ timing=timing,
815
851
  )
816
852
 
817
853
  ok = True
@@ -830,13 +866,13 @@ async def print_run_report(
830
866
  console.print(f'{i}/', end='')
831
867
  console.print(get_testcase_markup_verdict(eval), end='')
832
868
  if eval.result.sanitizer_warnings:
833
- console.print('[item]*[/item]', end='')
869
+ console.print('[warning]*[/warning]', end='')
834
870
  console.print('', end=' ')
835
871
  group_evals.append(eval)
836
872
  solution_evals.append(eval)
837
873
 
838
874
  console.print(
839
- f'({get_evals_formatted_time(group_evals)}, {get_evals_formatted_memory(group_evals)})',
875
+ f'({get_capped_evals_formatted_time(solution, group_evals, verification)}, {get_evals_formatted_memory(group_evals)})',
840
876
  end='',
841
877
  )
842
878
  console.print()
@@ -845,7 +881,7 @@ async def print_run_report(
845
881
  solution,
846
882
  solution_evals,
847
883
  console,
848
- verification=VerificationLevel(verification),
884
+ verification=verification,
849
885
  )
850
886
  console.print()
851
887
 
@@ -200,14 +200,14 @@ def main():
200
200
  os.kill(sub_pid, 9)
201
201
  return
202
202
 
203
- signal.alarm(1)
203
+ signal.setitimer(signal.ITIMER_REAL, 0.3)
204
204
 
205
- signal.alarm(1)
205
+ signal.setitimer(signal.ITIMER_REAL, 0.3)
206
206
  signal.signal(signal.SIGALRM, handle_alarm)
207
207
  wait_and_finish(sub_pid, options, start_time, alarm_msg=alarm_msg)
208
208
 
209
209
  # Cancel alarm before exiting to avoid surprises.
210
- signal.alarm(0)
210
+ signal.setitimer(signal.ITIMER_REAL, 0)
211
211
 
212
212
  # Exit gracefully.
213
213
  sys.exit()
@@ -1,5 +1,6 @@
1
1
  import functools
2
2
  import pathlib
3
+ import re
3
4
  import shlex
4
5
  import shutil
5
6
  import subprocess
@@ -435,6 +436,23 @@ def _check_for_sanitizer_warnings(
435
436
  return any(_check_for_sanitizer_warnings_in_line(line.decode()) for line in f)
436
437
 
437
438
 
439
+ _WARNING_RE = re.compile(r'([^:]+):\d+:\d+:[ ]+warning:.*')
440
+
441
+
442
+ def _check_for_compilation_warnings_in_line(line: str) -> bool:
443
+ if line.startswith('./'):
444
+ return False
445
+ match = _WARNING_RE.match(line)
446
+ if match is None:
447
+ return False
448
+ file = match.group(1).strip().lower()
449
+ if 'testlib' in file or 'jngen' in file or 'stresslib' in file:
450
+ return False
451
+ if file.endswith('.h'):
452
+ return False
453
+ return True
454
+
455
+
438
456
  def _check_for_compilation_warnings(
439
457
  sandbox: SandboxBase, stderr_file: Optional[pathlib.Path]
440
458
  ) -> bool:
@@ -443,7 +461,9 @@ def _check_for_compilation_warnings(
443
461
  if not sandbox.file_exists(stderr_file):
444
462
  return False
445
463
  with sandbox.get_file(stderr_file) as f:
446
- return any(line.strip() for line in f)
464
+ return any(
465
+ _check_for_compilation_warnings_in_line(line.strip().decode()) for line in f
466
+ )
447
467
 
448
468
 
449
469
  def compile(
@@ -9,6 +9,7 @@ from typing import Any, Optional, Type, TypeVar
9
9
  import rich
10
10
  import rich.prompt
11
11
  import rich.status
12
+ import ruyaml
12
13
  import typer
13
14
  import yaml
14
15
  from fastapi.encoders import jsonable_encoder
@@ -91,6 +92,12 @@ def validate_field(model: Type[T], field: str, value: Any):
91
92
  )
92
93
 
93
94
 
95
+ def save_ruyaml(path: pathlib.Path, yml: ruyaml.YAML, data: ruyaml.Any):
96
+ path.parent.mkdir(parents=True, exist_ok=True)
97
+ with path.open('w') as f:
98
+ yml.dump(data, f)
99
+
100
+
94
101
  def confirm_on_status(status: Optional[rich.status.Status], *args, **kwargs) -> bool:
95
102
  if status:
96
103
  status.stop()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes