rbx.cp 0.5.35__tar.gz → 0.5.36__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 (173) hide show
  1. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/PKG-INFO +1 -1
  2. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/pyproject.toml +1 -1
  3. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/contest/main.py +2 -1
  4. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/creation.py +7 -12
  5. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/main.py +10 -0
  6. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/package.py +2 -2
  7. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/testcase_utils.py +7 -7
  8. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/testcases/main.py +4 -4
  9. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/config.py +16 -2
  10. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/LICENSE +0 -0
  11. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/README.md +0 -0
  12. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/__init__.py +0 -0
  13. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/annotations.py +0 -0
  14. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/autoenum.py +0 -0
  15. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/__init__.py +0 -0
  16. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/builder.py +0 -0
  17. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/cd.py +0 -0
  18. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/checkers.py +0 -0
  19. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/code.py +0 -0
  20. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/compile.py +0 -0
  21. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/conftest.py +0 -0
  22. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/contest/__init__.py +0 -0
  23. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/contest/build_contest_statements.py +0 -0
  24. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/contest/contest_package.py +0 -0
  25. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/contest/contest_utils.py +0 -0
  26. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/contest/schema.py +0 -0
  27. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/contest/statements.py +0 -0
  28. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/deferred.py +0 -0
  29. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/download.py +0 -0
  30. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/environment.py +0 -0
  31. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/extensions.py +0 -0
  32. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/formatting.py +0 -0
  33. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/generators.py +0 -0
  34. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/generators_test.py +0 -0
  35. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/packaging/boca/extension.py +0 -0
  36. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/packaging/boca/packager.py +0 -0
  37. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/packaging/contest_main.py +0 -0
  38. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/packaging/main.py +0 -0
  39. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/packaging/packager.py +0 -0
  40. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/packaging/polygon/packager.py +0 -0
  41. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/packaging/polygon/test.py +0 -0
  42. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/packaging/polygon/xml_schema.py +0 -0
  43. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/presets/__init__.py +0 -0
  44. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/presets/fetch.py +0 -0
  45. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/presets/lock_schema.py +0 -0
  46. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/presets/schema.py +0 -0
  47. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/retries.py +0 -0
  48. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/sanitizers/warning_stack.py +0 -0
  49. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/schema.py +0 -0
  50. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/setter_config.py +0 -0
  51. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/solutions.py +0 -0
  52. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/solutions_test.py +0 -0
  53. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/state.py +0 -0
  54. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/statements/__init__.py +0 -0
  55. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/statements/build_statements.py +0 -0
  56. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/statements/builders.py +0 -0
  57. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/statements/joiners.py +0 -0
  58. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/statements/latex.py +0 -0
  59. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/statements/latex_jinja.py +0 -0
  60. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/statements/schema.py +0 -0
  61. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/stresses.py +0 -0
  62. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/stressing/__init__.py +0 -0
  63. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/stressing/finder_parser.py +0 -0
  64. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/stressing/generator_parser.py +0 -0
  65. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/testcases/__init__.py +0 -0
  66. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/ui/__init__.py +0 -0
  67. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/ui/captured_log.py +0 -0
  68. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/ui/css/app.tcss +0 -0
  69. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/ui/main.py +0 -0
  70. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/ui/run.py +0 -0
  71. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/validators.py +0 -0
  72. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/box/validators_test.py +0 -0
  73. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/checker.py +0 -0
  74. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/clone.py +0 -0
  75. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/conftest.py +0 -0
  76. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/console.py +0 -0
  77. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/create.py +0 -0
  78. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/edit.py +0 -0
  79. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading/__init__.py +0 -0
  80. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading/caching.py +0 -0
  81. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading/conftest.py +0 -0
  82. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading/judge/__init__.py +0 -0
  83. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading/judge/cacher.py +0 -0
  84. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading/judge/digester.py +0 -0
  85. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading/judge/sandbox.py +0 -0
  86. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading/judge/sandboxes/__init__.py +0 -0
  87. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading/judge/sandboxes/isolate.py +0 -0
  88. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading/judge/sandboxes/stupid_sandbox.py +0 -0
  89. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading/judge/sandboxes/timeit.py +0 -0
  90. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading/judge/storage.py +0 -0
  91. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading/judge/test.py +0 -0
  92. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading/judge/testiso.py +0 -0
  93. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading/steps.py +0 -0
  94. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading/steps_with_caching.py +0 -0
  95. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading/steps_with_caching_run_test.py +0 -0
  96. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/grading_utils.py +0 -0
  97. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/hydration.py +0 -0
  98. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/main.py +0 -0
  99. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/metadata.py +0 -0
  100. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/providers/__init__.py +0 -0
  101. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/providers/codeforces.py +0 -0
  102. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/providers/provider.py +0 -0
  103. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/checkers/boilerplate.cpp +0 -0
  104. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/default_config.json +0 -0
  105. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/default_setter_config.mac.yml +0 -0
  106. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/default_setter_config.yml +0 -0
  107. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/envs/default.rbx.yml +0 -0
  108. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/envs/isolate.rbx.yml +0 -0
  109. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/packagers/boca/checker.sh +0 -0
  110. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/packagers/boca/compare +0 -0
  111. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/packagers/boca/compile/c +0 -0
  112. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/packagers/boca/compile/cc +0 -0
  113. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/packagers/boca/compile/cpp +0 -0
  114. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/packagers/boca/compile/java +0 -0
  115. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/packagers/boca/compile/kt +0 -0
  116. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/packagers/boca/compile/pas +0 -0
  117. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/packagers/boca/compile/py2 +0 -0
  118. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/packagers/boca/compile/py3 +0 -0
  119. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/packagers/boca/run/c +0 -0
  120. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/packagers/boca/run/cc +0 -0
  121. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/packagers/boca/run/cpp +0 -0
  122. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/packagers/boca/run/java +0 -0
  123. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/packagers/boca/run/kt +0 -0
  124. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/packagers/boca/run/py2 +0 -0
  125. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/packagers/boca/run/py3 +0 -0
  126. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/contest/contest.rbx.yml +0 -0
  127. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/contest/statement/contest.rbx.tex +0 -0
  128. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/contest/statement/olymp.sty +0 -0
  129. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/contest/statement/template.rbx.tex +0 -0
  130. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/preset.rbx.yml +0 -0
  131. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/problem/.gitignore +0 -0
  132. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/problem/gen.cpp +0 -0
  133. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/problem/problem.rbx.yml +0 -0
  134. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/problem/random.py +0 -0
  135. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/problem/random.txt +0 -0
  136. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/problem/sols/main.cpp +0 -0
  137. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/problem/sols/slow.cpp +0 -0
  138. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/problem/sols/wa.cpp +0 -0
  139. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/problem/statement/olymp.sty +0 -0
  140. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/problem/statement/projecao.png +0 -0
  141. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/problem/statement/statement.rbx.tex +0 -0
  142. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/problem/statement/template.rbx.tex +0 -0
  143. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/problem/tests/samples/000.in +0 -0
  144. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/problem/tests/samples/001.in +0 -0
  145. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/problem/validator.cpp +0 -0
  146. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/presets/default/problem/wcmp.cpp +0 -0
  147. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/resources/templates/template.cpp +0 -0
  148. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/run.py +0 -0
  149. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/schema.py +0 -0
  150. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/submit.py +0 -0
  151. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/submitors/__init__.py +0 -0
  152. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/submitors/codeforces.py +0 -0
  153. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/submitors/submitor.py +0 -0
  154. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/test.py +0 -0
  155. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testcase.py +0 -0
  156. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testcase_rendering.py +0 -0
  157. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testdata/box1/gen1.cpp +0 -0
  158. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testdata/box1/gen2.cpp +0 -0
  159. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testdata/box1/genScript.py +0 -0
  160. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testdata/box1/hard-tle.sol.cpp +0 -0
  161. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testdata/box1/ole.cpp +0 -0
  162. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testdata/box1/problem.rbx.yml +0 -0
  163. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testdata/box1/re.sol.cpp +0 -0
  164. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testdata/box1/sol.cpp +0 -0
  165. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testdata/box1/tests/1.in +0 -0
  166. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testdata/box1/tle-and-incorrect.sol.cpp +0 -0
  167. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testdata/box1/tle.sol.cpp +0 -0
  168. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testdata/box1/validator.cpp +0 -0
  169. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testdata/box1/wa.sol.cpp +0 -0
  170. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testdata/caching/executable.py +0 -0
  171. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testdata/compatible +0 -0
  172. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/testing_utils.py +0 -0
  173. {rbx_cp-0.5.35 → rbx_cp-0.5.36}/rbx/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rbx.cp
3
- Version: 0.5.35
3
+ Version: 0.5.36
4
4
  Summary:
5
5
  Author: Roberto Sales
6
6
  Requires-Python: >=3.9,<4.0
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "rbx.cp"
3
- version = "0.5.35"
3
+ version = "0.5.36"
4
4
  description = ""
5
5
  packages = [
6
6
  {include = "rbx"}
@@ -128,7 +128,8 @@ def edit():
128
128
  @app.command('add, a', help='Add new problem to contest.')
129
129
  @within_contest
130
130
  def add(path: str, short_name: str, preset: Optional[str] = None):
131
- name = pathlib.Path(path).stem
131
+ problem_path = pathlib.Path(path)
132
+ name = problem_path.stem
132
133
  utils.validate_field(ContestProblem, 'short_name', short_name)
133
134
  utils.validate_field(Package, 'name', name)
134
135
 
@@ -4,9 +4,8 @@ from typing import Annotated, Optional
4
4
 
5
5
  import typer
6
6
 
7
- from rbx import console
8
- from rbx.box import presets
9
- from rbx.box.contest.contest_package import find_contest_yaml
7
+ from rbx import console, utils
8
+ from rbx.box import package, presets
10
9
  from rbx.box.presets.fetch import get_preset_fetch_info
11
10
 
12
11
 
@@ -27,15 +26,6 @@ def create(
27
26
  ] = None,
28
27
  path: Optional[pathlib.Path] = None,
29
28
  ):
30
- if find_contest_yaml() is not None:
31
- console.console.print(
32
- '[error]Cannot [item]rbx create[/item] a problem inside a contest.[/error]'
33
- )
34
- console.console.print(
35
- '[error]Instead, use [item]rbx contest add[/item] to add a problem to a contest.[/error]'
36
- )
37
- raise typer.Exit(1)
38
-
39
29
  preset = preset or 'default'
40
30
  console.console.print(f'Creating new problem [item]{name}[/item]...')
41
31
 
@@ -80,4 +70,9 @@ def create(
80
70
  for lock in dest_path.rglob('.preset-lock.yml'):
81
71
  lock.unlink(missing_ok=True)
82
72
 
73
+ # Change problem name.
74
+ ru, problem = package.get_ruyaml(dest_path)
75
+ problem['name'] = name
76
+ utils.save_ruyaml(dest_path / 'problem.rbx.yml', ru, problem)
77
+
83
78
  presets.generate_lock(preset, root=dest_path)
@@ -37,6 +37,7 @@ from rbx.box import (
37
37
  validators,
38
38
  )
39
39
  from rbx.box.contest import main as contest
40
+ from rbx.box.contest.contest_package import find_contest_yaml
40
41
  from rbx.box.environment import VerificationLevel, get_environment_path
41
42
  from rbx.box.packaging import main as packaging
42
43
  from rbx.box.testcases import main as testcases
@@ -448,6 +449,15 @@ def create(
448
449
  Optional[str], typer.Option(help='Preset to use when creating the problem.')
449
450
  ] = None,
450
451
  ):
452
+ if find_contest_yaml() is not None:
453
+ console.console.print(
454
+ '[error]Cannot [item]rbx create[/item] a problem inside a contest.[/error]'
455
+ )
456
+ console.console.print(
457
+ '[error]Instead, use [item]rbx contest add[/item] to add a problem to a contest.[/error]'
458
+ )
459
+ raise typer.Exit(1)
460
+
451
461
  if preset is not None:
452
462
  creation.create(name, preset=preset)
453
463
  return
@@ -121,8 +121,8 @@ def save_package(
121
121
  problem_yaml_path.write_text(utils.model_to_yaml(package))
122
122
 
123
123
 
124
- def get_ruyaml() -> Tuple[ruyaml.YAML, ruyaml.Any]:
125
- problem_yaml_path = find_problem_yaml()
124
+ def get_ruyaml(root: pathlib.Path = pathlib.Path()) -> Tuple[ruyaml.YAML, ruyaml.Any]:
125
+ problem_yaml_path = find_problem_yaml(root)
126
126
  if problem_yaml_path is None:
127
127
  console.console.print(
128
128
  f'Problem not found in {pathlib.Path().absolute()}', style='error'
@@ -70,20 +70,20 @@ class TestcasePattern(BaseModel):
70
70
 
71
71
  def __str__(self) -> str:
72
72
  prefix = '/'.join(self.group_prefix)
73
+ if not prefix:
74
+ return '*'
73
75
  if self.index is None:
74
76
  return f'{prefix}/'
75
77
  return f'{prefix}/{self.index}'
76
78
 
77
79
  @classmethod
78
80
  def parse(cls, spec: str) -> 'TestcasePattern':
79
- parts = spec.split('/')
80
- if not parts:
81
- console.console.print(
82
- f'[error]Invalid testcase pattern [item]{spec}[/item].[/error]',
83
- )
84
- raise typer.Exit(1)
81
+ spec = spec.strip()
82
+ if spec == '*':
83
+ return cls(group_prefix=[], index=None)
85
84
 
86
- if len(parts) == 1:
85
+ parts = spec.split('/')
86
+ if len(parts) <= 1:
87
87
  return cls(group_prefix=parts, index=None)
88
88
 
89
89
  if parts[-1].isdigit():
@@ -116,19 +116,19 @@ def view(
116
116
  items = _generate_for_editing(
117
117
  testcase, input=not output_only, output=not input_only, progress=s
118
118
  )
119
- config.edit_multiple(items)
119
+ config.edit_multiple(items, readonly=True)
120
120
 
121
121
 
122
122
  @app.command('info, i', help='Show information about testcases.')
123
123
  def info(
124
124
  pattern: Annotated[
125
- str,
125
+ Optional[str],
126
126
  typer.Argument(
127
127
  help='Testcases to detail, as a pattern. Might be a group, or a specific test in the format [group]/[index].'
128
128
  ),
129
- ],
129
+ ] = None,
130
130
  ):
131
- tc_pattern = TestcasePattern.parse(pattern)
131
+ tc_pattern = TestcasePattern.parse(pattern or '*')
132
132
  testcases = extract_generation_testcases_from_patterns([tc_pattern])
133
133
  if not testcases:
134
134
  console.print(
@@ -5,6 +5,7 @@ import os
5
5
  import pathlib
6
6
  import shutil
7
7
  import subprocess
8
+ import tempfile
8
9
  from typing import Any, Dict, List, Optional
9
10
 
10
11
  import requests
@@ -227,10 +228,23 @@ def open_editor(path: Any, *args):
227
228
  subprocess.run([editor, str(path), *[str(arg) for arg in args]])
228
229
 
229
230
 
230
- def edit_multiple(paths: List[pathlib.Path]):
231
+ def _readonly_copy(path: pathlib.Path) -> pathlib.Path:
232
+ temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False)
233
+ shutil.copy(str(path), temp_file.name)
234
+ temp_file.close()
235
+ return pathlib.Path(temp_file.name)
236
+
237
+
238
+ def edit_multiple(paths: List[pathlib.Path], readonly: bool = False):
231
239
  if is_vim_editor():
232
- open_editor('-O', *paths)
240
+ if readonly:
241
+ open_editor('-R', '-O', *paths)
242
+ else:
243
+ open_editor('-O', *paths)
233
244
  return
245
+
246
+ if readonly:
247
+ paths = [_readonly_copy(path) for path in paths]
234
248
  open_editor(*paths)
235
249
 
236
250
 
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
File without changes
File without changes
File without changes
File without changes
File without changes