rbx.cp 0.13.3__py3-none-any.whl → 0.13.5__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 (73) hide show
  1. rbx/annotations.py +5 -5
  2. rbx/box/checkers.py +26 -22
  3. rbx/box/cli.py +0 -4
  4. rbx/box/code.py +27 -80
  5. rbx/box/contest/build_contest_statements.py +16 -3
  6. rbx/box/contest/schema.py +1 -2
  7. rbx/box/environment.py +16 -6
  8. rbx/box/fields.py +25 -1
  9. rbx/box/generators.py +31 -5
  10. rbx/box/global_package.py +6 -2
  11. rbx/box/header.py +31 -11
  12. rbx/box/package.py +3 -15
  13. rbx/box/presets/__init__.py +2 -2
  14. rbx/box/schema.py +4 -25
  15. rbx/box/setter_config.py +11 -0
  16. rbx/box/solutions.py +12 -4
  17. rbx/box/statements/build_statements.py +5 -1
  18. rbx/box/statements/builders.py +7 -7
  19. rbx/box/statements/schema.py +11 -2
  20. rbx/box/tasks.py +9 -4
  21. rbx/box/testcase_utils.py +2 -0
  22. rbx/box/testing/__init__.py +0 -0
  23. rbx/box/testing/testing_package.py +246 -0
  24. rbx/box/testing/testing_preset.py +36 -0
  25. rbx/box/testing/testing_shared.py +81 -0
  26. rbx/box/ui/screens/run_explorer.py +0 -8
  27. rbx/box/ui/utils/run_ui.py +7 -3
  28. rbx/box/ui/widgets/test_output_box.py +1 -1
  29. rbx/box/validators.py +5 -2
  30. rbx/grading/caching.py +67 -16
  31. rbx/grading/judge/program.py +268 -0
  32. rbx/grading/judge/sandbox.py +30 -193
  33. rbx/grading/judge/sandboxes/stupid_sandbox.py +232 -241
  34. rbx/grading/judge/sandboxes/tee.py +31 -0
  35. rbx/grading/steps.py +87 -199
  36. rbx/grading/steps_with_caching.py +15 -6
  37. rbx/resources/presets/default/problem/problem.rbx.yml +0 -2
  38. rbx/resources/presets/default/shared/contest_template.rbx.tex +1 -1
  39. rbx/resources/presets/default/shared/problem_template.rbx.tex +5 -1
  40. rbx/resources/templates/rbx.h +43 -2
  41. rbx/testing_utils.py +8 -1
  42. rbx/utils.py +59 -1
  43. {rbx_cp-0.13.3.dist-info → rbx_cp-0.13.5.dist-info}/METADATA +2 -1
  44. {rbx_cp-0.13.3.dist-info → rbx_cp-0.13.5.dist-info}/RECORD +47 -67
  45. rbx/box/conftest.py +0 -42
  46. rbx/box/generators_test.py +0 -67
  47. rbx/box/lazy_importing_test.py +0 -25
  48. rbx/box/solutions_test.py +0 -47
  49. rbx/box/validators_test.py +0 -15
  50. rbx/checker.py +0 -128
  51. rbx/clone.py +0 -197
  52. rbx/conftest.py +0 -38
  53. rbx/create.py +0 -37
  54. rbx/edit.py +0 -24
  55. rbx/grading/conftest.py +0 -33
  56. rbx/grading/judge/sandboxes/isolate.py +0 -695
  57. rbx/grading/judge/testiso.py +0 -54
  58. rbx/grading/steps_with_caching_run_test.py +0 -707
  59. rbx/grading_utils.py +0 -148
  60. rbx/hydration.py +0 -101
  61. rbx/main.py +0 -118
  62. rbx/metadata.py +0 -105
  63. rbx/resources/envs/isolate.rbx.yml +0 -36
  64. rbx/resources/presets/default/problem/sols/slow.cpp +0 -15
  65. rbx/run.py +0 -45
  66. rbx/schema.py +0 -64
  67. rbx/submit.py +0 -61
  68. rbx/test.py +0 -349
  69. rbx/testcase.py +0 -70
  70. rbx/testcase_rendering.py +0 -79
  71. {rbx_cp-0.13.3.dist-info → rbx_cp-0.13.5.dist-info}/LICENSE +0 -0
  72. {rbx_cp-0.13.3.dist-info → rbx_cp-0.13.5.dist-info}/WHEEL +0 -0
  73. {rbx_cp-0.13.3.dist-info → rbx_cp-0.13.5.dist-info}/entry_points.txt +0 -0
@@ -1,41 +1,38 @@
1
1
  rbx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- rbx/annotations.py,sha256=qcJGL_INONSirH7LTrEma5RsweAIbO6QlRHVvRvb9ao,3521
2
+ rbx/annotations.py,sha256=_TkLhgZWiUyon3bonHwUo03ls1jY8LwgcR4bVgtgnc0,3519
3
3
  rbx/autoenum.py,sha256=cusv8ClXRlDVvhZ8eDrtYcL_2peXlHugAey_ht8roXk,12025
4
4
  rbx/box/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  rbx/box/builder.py,sha256=umrTdVAwvsOosBDVvDZ6kq1yWg3Z2Lxp2o1zK-V7BBk,3594
6
6
  rbx/box/cd.py,sha256=_XAzb3kV1NUaaRs8hc9SGDo10O1yh2_gr1EiAKzfUjI,2711
7
- rbx/box/checkers.py,sha256=wjS64fDrEkTjU6f80strt4QEBHPo4FQDh9ijELhOQT0,13016
8
- rbx/box/cli.py,sha256=44QKM2v4ibpIcpzSYsvkAI84VoB-X60ik9A1_68horY,30008
9
- rbx/box/code.py,sha256=4GChCeUaHjT7stvtPAURbCL1_V238geG3xmXQjbdV20,26708
7
+ rbx/box/checkers.py,sha256=mRovZyTZdySFEaYFVc3Lc-xgEsu6F9FjVPOxDwub7aY,13226
8
+ rbx/box/cli.py,sha256=eBXiy3zG6IzrIHPYplFWhGn7cB7nmA7F1GiAGoYFWp0,29904
9
+ rbx/box/code.py,sha256=SXjce-rBr_B4bVNgCYBuN6KZJTtb9GfYqIxPmrO2XWo,25467
10
10
  rbx/box/compile.py,sha256=Kzn5mEQu4vb91W9vjyt0DS6cfPJzFLTUoowFj7uHLUo,2539
11
- rbx/box/conftest.py,sha256=sEmciXSeDC-wmrZ1JSxbsUenKNP_VWW32mrCun2pY3I,1070
12
11
  rbx/box/contest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- rbx/box/contest/build_contest_statements.py,sha256=OKf7BQ6DxtY65TpzjhNbY5Bu3wByrxZt7qCqWDXBaNQ,12693
12
+ rbx/box/contest/build_contest_statements.py,sha256=N7TQ8Ki7ZM94sATHploDsSKbY41Xey_FlXclEdCBpJI,13010
14
13
  rbx/box/contest/contest_package.py,sha256=r6BGq3S4Ezj3Ep7pCmtvz3SN44npb2_rKJEoT5lSOqk,2985
15
14
  rbx/box/contest/contest_utils.py,sha256=fsWHG1e65wq9zvRY3tdf32VF0nU1yzGTOBX5yjXiNk4,1102
16
15
  rbx/box/contest/main.py,sha256=e_DjbrwpXTFZQaVWJO7prJyehJ702GkVEAGEraRK6h4,8352
17
- rbx/box/contest/schema.py,sha256=eb7xtyq078YYWYHueximNhyHFINzwgLMFm1j9U3LxBQ,7461
16
+ rbx/box/contest/schema.py,sha256=21kP3v5aPMOjjp832R7Q_QzJirCVKQCSAklT8nnssdk,7435
18
17
  rbx/box/contest/statements.py,sha256=dI3AmaTYfOzyB1uh75ST9se9o_QqXzar4pNkIdC-_G8,3956
19
18
  rbx/box/creation.py,sha256=oTAC11XV2Pw2YAlF_d11Eo7A1fD6ItlpFMpLEzMLyFI,1331
20
19
  rbx/box/deferred.py,sha256=II3X9e87JCOZtmspnHh-n4PFqh-FsH_oc0XJHZ9ZYVQ,691
21
20
  rbx/box/download.py,sha256=tLW5gLVeLk0gHMEMwScSoHIXQPkXuPsqXzItsrsnUZY,3070
22
21
  rbx/box/dump_schemas.py,sha256=3j5t47_vJmXj0BCczxDX6ByOcsfolGEDNCBXlPpk86w,593
23
- rbx/box/environment.py,sha256=iR-VTNvbW8iNienWKYVnd1xxCuhWml7bYa5FTIZCOY0,13574
22
+ rbx/box/environment.py,sha256=rwUXuIEfuH-nbnkpQUSazZdi0Z0MUrcCmiYuC5yIxAw,14014
24
23
  rbx/box/extensions.py,sha256=Von8kIeXvNFTkGlMRMTvL2HIHPwlkuiMswr-ydbGV1w,519
25
- rbx/box/fields.py,sha256=lc1OHpo_AC8RxzNasipULGkRmToAiXBGzWDeb14L_ss,1092
24
+ rbx/box/fields.py,sha256=rai4gE95mavvRPBLgnMj2jG5b2W76fvGuFQRXO0O4fM,1792
26
25
  rbx/box/formatting.py,sha256=i3vXHpo_L_VpVPxOe4wHlai1WhlDJlfxUexS9DC0Szg,1249
27
- rbx/box/generators.py,sha256=4iO5QNy_UzybhO5GhSyts9ZsLld-Hp38Xl-CHjrqivY,16149
28
- rbx/box/generators_test.py,sha256=J7aBfuJhU84MWDWzgReRoOuQw_hVa09B8gTKAvL2XVo,1987
26
+ rbx/box/generators.py,sha256=Q7xZ0BQVrh4eTwiYgxdpaHJqqZT4_X_YPl-uReZz5tw,16880
29
27
  rbx/box/git_utils.py,sha256=VlUgzuHOCnrjjiJQnDB32qDHbHw_zkwgA7wm4bloibc,750
30
- rbx/box/global_package.py,sha256=OMnvqY8VQlP9YVSZwH5LCVkTsE7zNIhhRcslIWktkQc,2016
31
- rbx/box/header.py,sha256=2XMsGfX3GTMPFRs6cPFUC3qncyJKKZj-UT6-KJ7jWQg,2176
28
+ rbx/box/global_package.py,sha256=YfFGw2vxFspF2v3phBEeBCrLe1sfbANrctGqii3I2X4,2106
29
+ rbx/box/header.py,sha256=68Sd7cnooULXVb2KCWc4Wrt8YrAP4hpOfZbry4A-fp0,2828
32
30
  rbx/box/lang.py,sha256=CSD-yxFUC3LWdGpv4IVFOLdgONc_JbsI45BEN3bjaFw,888
33
31
  rbx/box/lazy_importing_main.py,sha256=6Z8As7qVFFT619xHH9Xt8VCH57NjC4aDxfAgkWiUwT8,116
34
- rbx/box/lazy_importing_test.py,sha256=B0-b3y_DkxEmtVfu4NfmVsgVdFl6kRCsEL6GLMHJISo,628
35
32
  rbx/box/linting.py,sha256=wRE0hKCduTBHZYBFmmis_d9AMTsDu0Q-AjByCeTnkrY,3187
36
33
  rbx/box/main.py,sha256=a8CYi77kOywPFly4-ucEIJLXQW-1NFp91kK2fA42YTE,86
37
34
  rbx/box/naming.py,sha256=pOG37X_wQM9CCSYwJIUf-b-ZHEs_nchO7wQEdP_quJg,1367
38
- rbx/box/package.py,sha256=VyG7TZKYGeqzilPkLs8rbJDa1kTIXfrZADequnJvyE4,15110
35
+ rbx/box/package.py,sha256=66MqTVfb5V-IVjnTndH3CwrGgWWaHW_RTUiR86QcKt4,14756
39
36
  rbx/box/packaging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
37
  rbx/box/packaging/boca/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
38
  rbx/box/packaging/boca/extension.py,sha256=EQALNEOv4zVDXSKs_dk11n92y7cBZVn8TogIK683lE0,890
@@ -52,36 +49,39 @@ rbx/box/packaging/polygon/polygon_api.py,sha256=mPKEqiwANJ1nr-JhOgzGMaDhnbljsAgz
52
49
  rbx/box/packaging/polygon/test.py,sha256=bgEju5PwudgyfwxXJagm8fM6CJVlWM6l_-2q1V-oKaQ,3069
53
50
  rbx/box/packaging/polygon/upload.py,sha256=W9LcEe2D2ySOdyXETp529lP5BtB4GyOUD2lLPbSzCjE,13548
54
51
  rbx/box/packaging/polygon/xml_schema.py,sha256=TSl4BWwMWv7V07BKJ56mcLXNr_3zlRgNmqN2q-wnk4M,3128
55
- rbx/box/presets/__init__.py,sha256=L6fy_hetXnB8Eo_MO3oadv_ce2hwVW2J-BJm9CooEdA,33432
52
+ rbx/box/presets/__init__.py,sha256=Vm9Xievtn1fbFMHubPh6Ngz-GvMx3ycfx15tkvwcvfA,33421
56
53
  rbx/box/presets/fetch.py,sha256=900aq9S8e12TlgSenG0iHgtF4OWgqavZsptgI_a1YKM,2508
57
54
  rbx/box/presets/lock_schema.py,sha256=8PKL7UMX4dkdVpCPLwYtaNIIrZpAfHGvTfnF8bRFedM,1708
58
55
  rbx/box/presets/schema.py,sha256=iOGWHqJ9Z-ljQV8ljOjQMuCwqJQLJKm_pYX9cLjZbmE,2432
59
56
  rbx/box/remote.py,sha256=PsJ4i3suQEr3cxiKk4nCho98QBGs5b2v8_TEvn_nE-o,5204
60
57
  rbx/box/retries.py,sha256=BZsi4sYBjm3VK5zb_pBQSYQuKo3ZntmtEFoVPZHg4QI,4982
61
58
  rbx/box/sanitizers/warning_stack.py,sha256=6-rr3dkMq6MpfjrVZ8lSQjF4RZ5YzZSAPMzHCfm-6h4,2876
62
- rbx/box/schema.py,sha256=kOWMe0lrAJBEhU5gBAWvhwMHHzWx17PBwThou4zuo1A,18834
63
- rbx/box/setter_config.py,sha256=WHlWjjdHNoBbCdZqYokctTSxvtPqQXGmrgDHyaK4FKk,4985
64
- rbx/box/solutions.py,sha256=CmwLS7EJsZ6_4HqU0bKV8oy2Vd6wKwdQS3R9AH3XNZQ,53696
65
- rbx/box/solutions_test.py,sha256=PX1TQoRzNd9mi1SGsG7WFrpqFgNrNX5Kwt0mkwFdoOA,1749
59
+ rbx/box/schema.py,sha256=YLziLE5X-gI76844cCARHo0EmnUZSpr_ngEWzS8M5uM,18187
60
+ rbx/box/setter_config.py,sha256=vyZbsbgkjelZOblMLX5A1j4CLqPNQkrv83IZr_3-46Y,5301
61
+ rbx/box/solutions.py,sha256=uTODZEvdb6H8hKhrmD-KrRg1hhmwiExq33tN3oh1vXg,54036
66
62
  rbx/box/state.py,sha256=MMf3DvfQji0jKEliCHct2Tpp_0epL1tvP8HbHNArQIc,166
67
63
  rbx/box/statements/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
68
- rbx/box/statements/build_statements.py,sha256=-pUQAS8CEnWqHtpKW6wH338rQg3FKmb9qYxilzcwJFA,12693
69
- rbx/box/statements/builders.py,sha256=Qb_rfkFOqghFZfEf2zPSEoDPc-lCBNb5CcPoOkV7HMk,13747
64
+ rbx/box/statements/build_statements.py,sha256=gzhYVtxO0Pk3AgWr9cOXU7dYo_U-eSk_vpt-Ld8UXg8,12841
65
+ rbx/box/statements/builders.py,sha256=t3q1BX1SaELQVZB0tynuhAs_0UI3yzpUcvsQEEaUE-w,13666
70
66
  rbx/box/statements/expander.py,sha256=sdbMtNcJQCbXGIkFIl9h24pGr77vhFLnM31V5AfuduI,1715
71
67
  rbx/box/statements/joiners.py,sha256=jItNXkAbTjFQpPMgfDMW86n3vMTbaE8sgo9I8Yf4Txg,2886
72
68
  rbx/box/statements/latex.py,sha256=ipTGjL4kjAsnqgiH6Pk1PwKFegBumQP4-y0pFAbNN8I,1584
73
69
  rbx/box/statements/latex_jinja.py,sha256=iMx47ynKMjLNcfymzHV24jtWrRVnit0Va9H8yTfgmiA,10379
74
- rbx/box/statements/schema.py,sha256=5_qrY1KztCLSe4t-rJ7zdv3cBjcaO-FnFc45ZRUotfs,5127
70
+ rbx/box/statements/schema.py,sha256=n1OXbcmte-cGQn7PlSGOzBEYi0gRYUNDSubgYFKxo7I,5429
75
71
  rbx/box/stats.py,sha256=rUAnmp7kTgUvIQ56NLpQaIQkazB37MVcUos5en3xUQw,3258
76
72
  rbx/box/stresses.py,sha256=SV0Hx7SPZZEIhwasWDVpTWuMhWWTjfJs2IEW-H0xJZw,12092
77
73
  rbx/box/stressing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
78
74
  rbx/box/stressing/finder_parser.py,sha256=PnONJD2yun5X5EmHqkaz-rh3DHhn_BkTPHZrIXRKZbw,11898
79
75
  rbx/box/stressing/generator_parser.py,sha256=oHZryjR3YohgaSO9WEirQ7b2e-98WgZStF0N99W4Thw,7380
80
- rbx/box/tasks.py,sha256=VpmQcOEPvcnQ8fh4nrZGnkGDIoJOHZzHoa9x_HNG1P0,11239
76
+ rbx/box/tasks.py,sha256=CJ7TqzhVMPP4VUSrMpp3ofSDJn0rbuwIUWgFOiup_vE,11426
81
77
  rbx/box/testcase_extractors.py,sha256=J43eG7vpxc5nP_2yhrXJODkd4EYlV4WiYVbM6hzipY4,11944
82
- rbx/box/testcase_utils.py,sha256=MzrLq038hp-NvSrfej0_1D98akWq39HxbaFOKi9kOWM,6877
78
+ rbx/box/testcase_utils.py,sha256=HoDr_RxWpfviLd2oTj_m2wg1e4XaY9LD-QBqx_QjDI0,6899
83
79
  rbx/box/testcases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
84
80
  rbx/box/testcases/main.py,sha256=_I7h_obRcpNLRQ6dDJDIE5NAvTyn5nBOhdsBhRA_PvU,5442
81
+ rbx/box/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
82
+ rbx/box/testing/testing_package.py,sha256=kEQn22CwyYK_KbeY6eEG_FeVdQ_Is61Xb1QNdqNYmjY,7947
83
+ rbx/box/testing/testing_preset.py,sha256=7TxfL4fT9JetRMRkQ3Iko99N5gzfKz8_lPM0rkkQx_k,1135
84
+ rbx/box/testing/testing_shared.py,sha256=rX7w5VrCzf4l9zYhq3eFW1iHaWDLU-Xkn5oCjnAavhA,2558
85
85
  rbx/box/tooling/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
86
86
  rbx/box/tooling/boca/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
87
87
  rbx/box/tooling/boca/main.py,sha256=knl1rpaHIwA63KkzMJMZQrejzMpbTPBhYqGx1IpuNm4,289
@@ -100,55 +100,43 @@ rbx/box/ui/screens/differ.py,sha256=Sp6xQwsFiqMl0tvbdhiPdh8AWUNPT8jshce3H7DhPrw,
100
100
  rbx/box/ui/screens/error.py,sha256=k6Rs5maR_APKepMtPcDMSXo6BDKrP-pAnFFJgqmXDKE,496
101
101
  rbx/box/ui/screens/rich_log_modal.py,sha256=ciKC7_3SLKToDvQA9mrcNNdKBX85f2B1ASgrtyDvn38,799
102
102
  rbx/box/ui/screens/run.py,sha256=eKIfFRi-VbqKDxlhZDuOEdVl91XCndnmNIZyj_LMV0c,6028
103
- rbx/box/ui/screens/run_explorer.py,sha256=SC0GqUTqVFoaXKRPConMltUgDBC2QSBeN3xuN0KS8m4,3396
103
+ rbx/box/ui/screens/run_explorer.py,sha256=wAWsyhoZHnK115Yw9cceSlJa8bb8IzaiJj14mjKZR0c,2955
104
104
  rbx/box/ui/screens/run_test_explorer.py,sha256=D6sXTEbqzXI7uPu3EXZoFyIBxlGFbkdeyWj9OwYFHS8,6681
105
105
  rbx/box/ui/screens/selector.py,sha256=s9JR74anCt8NAlkk7GeNvqyqz2YEhCWTebOUNQ7HrXg,856
106
106
  rbx/box/ui/screens/test_explorer.py,sha256=Iv6yDqELr4-Ouo9PSD5Wr3bTdbmx8VfrK9zj5ULhPlg,4078
107
107
  rbx/box/ui/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
108
- rbx/box/ui/utils/run_ui.py,sha256=0dr18mfRSPIu7JmR9OGIh87OvNmwqDL_zhhdpKtnD_g,3772
108
+ rbx/box/ui/utils/run_ui.py,sha256=S8pQ26yDpkh8SNC5m-lehb-Zh6c-8Ip1q_sMQmLcETA,3889
109
109
  rbx/box/ui/widgets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
110
110
  rbx/box/ui/widgets/diff_box.py,sha256=4OxgwOvdm9nSVUKeKLzOQBlBweFu8LiTfp6g4ZkS5nM,1125
111
111
  rbx/box/ui/widgets/file_log.py,sha256=3wlrmkWR-EMibwlwXOJ5sGpTFwFEkRaGYo5fdmf8L3w,1704
112
112
  rbx/box/ui/widgets/interaction_box.py,sha256=mJoQjHegxkIL00OgiCULmV0_w-2ZcwsQEa-Y8NrDlZM,2252
113
113
  rbx/box/ui/widgets/rich_log_box.py,sha256=mF565c_Y3RYUZ_GJEFj5Eb86SFjsib31wE5qu1K0UBM,91
114
- rbx/box/ui/widgets/test_output_box.py,sha256=yqeAb-JFvVx1Q7w_qJbDMWQigyGy4ofGECDxQ7P0_2s,3864
114
+ rbx/box/ui/widgets/test_output_box.py,sha256=ws7Oa2E8ZABM6Q4ZtL2UQiq59sJzKYPe-STrqhZJI8M,3871
115
115
  rbx/box/ui/widgets/two_sided_test_output_box.py,sha256=L-ORiDwd6CP5DFpavrKGBaX0ZHkSoQqbJrGZ4BdFUWc,2289
116
116
  rbx/box/unit.py,sha256=oIXbQDidrt-DlDjhM1C-WW2jBr7xjsZrRBO6YXP3sJo,7891
117
- rbx/box/validators.py,sha256=oqlNhw7jivbbH5l8g3xwihPRy76AM7MA3G4A8nyI_V0,10416
118
- rbx/box/validators_test.py,sha256=WY4Ho-wlsPHc0YNuz0KFVd6KQ9ouuiou3w5_zMOZ4Fs,362
119
- rbx/checker.py,sha256=pj1jO3my48ru-qugbER5onccANCjoR0-PaFe3H3VGEY,4118
120
- rbx/clone.py,sha256=wpHyED0_7ST7LD3vj7HjXhzqEzlwh6dRQvKQVDYhGeU,6744
117
+ rbx/box/validators.py,sha256=z34cUMkuSlCPWnaCqaHqegCxuvmfhAvWlsqSeaduL6s,10580
121
118
  rbx/config.py,sha256=Tj0NHSf13fXxbNpif5C4qnaL1k3S-G87OnzuykEAcNQ,8463
122
- rbx/conftest.py,sha256=ouilbOIpvX8jTEdCAiWT85CbdBQKUUf41BjmDI82u-Y,967
123
119
  rbx/console.py,sha256=X8EJy68OROgh6ao3ZcUjZm5Y56VFMzen58ywAuQ7pAU,990
124
- rbx/create.py,sha256=ezUq9KiSA-88ASd8CtjWXw8UB4LCaQ3Gib3OgvsLK-Q,986
125
- rbx/edit.py,sha256=Zqnx_Pt06ijCxV-pZKGCJhjKB-nVO0QCM6xSBwPWGoE,798
126
120
  rbx/grading/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
127
- rbx/grading/caching.py,sha256=Inu9IYtjO6reg7XGCP44AcaJ5Ax1McfkfNwcpjTCzrw,15376
128
- rbx/grading/conftest.py,sha256=820Uw3AE-dwAfwLhXjgq_PixpDI1-JEXsOPYf4VT5H8,971
121
+ rbx/grading/caching.py,sha256=p9ZTz9Y1ZdkcPTIjPH8hEK_LHFtLMWY5z5YIVCkhi3k,16931
129
122
  rbx/grading/debug_context.py,sha256=kuAXEI8yRG8xfhS9WKKIRh9X0e5JUD8zvl_cpczJTC8,699
130
123
  rbx/grading/grading_context.py,sha256=TaRyLwPkkxvspQIFUFk8Ok0T8EST2pHMMNoVDx9lbFU,3416
131
124
  rbx/grading/judge/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
132
125
  rbx/grading/judge/cacher.py,sha256=wtRnVE_Es9xcqIgrhn6WzUoB90aihUuKaFyuVsusngg,20323
133
126
  rbx/grading/judge/digester.py,sha256=gtOIe_iL4PEWA7OKelW1gjSI-nBvbOpDPJGV8VQyjSg,912
134
- rbx/grading/judge/sandbox.py,sha256=m0Or5UWnKyPuaJNfb-OiVucHT04ZPIb9_QJrkie1Pok,26340
127
+ rbx/grading/judge/program.py,sha256=ejjmnAN2evN9FiPsmEUrsDeOvM4uccB_0oyJVaUzWQw,8465
128
+ rbx/grading/judge/sandbox.py,sha256=STsDJH-PEhSJ9hGvwxApHDX7jCAa797FV7hZQBmFOSo,21537
135
129
  rbx/grading/judge/sandboxes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
136
- rbx/grading/judge/sandboxes/isolate.py,sha256=SbzmvjnbMRIHWV68_6jdZ7dZRnC-Hp9ACNyv8OS_Npg,25991
137
- rbx/grading/judge/sandboxes/stupid_sandbox.py,sha256=_5p3IFmrDhyky8RCyc6fjUCiBf2SFSJ99O_4sj7xzTE,11342
130
+ rbx/grading/judge/sandboxes/stupid_sandbox.py,sha256=Q3UyFiwMpJ36tlU_oesNJ3lTzL4iNVmcWlazA0Yq4r4,11368
131
+ rbx/grading/judge/sandboxes/tee.py,sha256=fLulB8fV7k5cO-ikRgURpsETrvr6LoUSjGxFM3GZs5U,672
138
132
  rbx/grading/judge/sandboxes/timeit.py,sha256=V4Nu7YAU85jJp2_MtUbh4g8Fx5Wf3hax-4_UTNCorEs,11355
139
133
  rbx/grading/judge/storage.py,sha256=T1r3g8NKzF6IpW2K2gCJSBz81NBAQ_j_0cwq58gqZFA,14373
140
134
  rbx/grading/judge/test.py,sha256=ll0Iw7zyOpGdKPD_PGH7dvUkb4stQLu-ikbQnqJvuAc,944
141
- rbx/grading/judge/testiso.py,sha256=v14DtkWiZFJ9AKMzrb0_vZKPWDt8jz8iIw1Z2O-Advk,1397
142
135
  rbx/grading/limits.py,sha256=ev312UTOo8S4-3AAVibQdXZclWCxS96CdbZxqW4y1kE,770
143
136
  rbx/grading/processing_context.py,sha256=Jg9kNnkH3hi2hiE6Gh23QwS89r9Zj230NMl1CUEHSfo,1866
144
137
  rbx/grading/profiling.py,sha256=OEdtoAzjYjLfi-QI5Ke7tLZzJeqvGpMB2utQBNuH3E4,3369
145
- rbx/grading/steps.py,sha256=JlR72UvEdvJGFZGA0Jd_2qUoEnElhiIOQAzbUrOhidk,30185
146
- rbx/grading/steps_with_caching.py,sha256=b6NVZN46IG2r49uQ6u19Jj6AJ_nQFO6_pcKq4dWTwuQ,4579
147
- rbx/grading/steps_with_caching_run_test.py,sha256=Ldrs1VS01TWYpqg1x9LeiF7_TejsE_suL3y1MI5pAlU,26599
148
- rbx/grading_utils.py,sha256=lL2KtSkOsMElqrRoApQTbFcqVOeHVWUDTMCa3IsLpC4,4484
149
- rbx/hydration.py,sha256=WqbgIfCZNwqspVhMuUlx8-sNOYhq_ZWbeZnkcetuAZI,3669
150
- rbx/main.py,sha256=pFZreQhcoq-vIvWuVVeJEa8s_ka24dxF0WmaasarscE,2865
151
- rbx/metadata.py,sha256=4eIHWlwwq-eAbpRDZkCovcGMbwOVVy-5JMmbLtk429w,3116
138
+ rbx/grading/steps.py,sha256=PLnuORN-11W9ARSLOrZ0Di30Pl9oSKVfRUGLQoCfeow,26606
139
+ rbx/grading/steps_with_caching.py,sha256=RWHtmlEfszKnKM9ADrfbCUZbxZSTD-BiHV3XSiGW8WY,4797
152
140
  rbx/providers/__init__.py,sha256=gHXg1BTiXJ_0Z_HoVTZrqhi5IIZ57Dhy0pt7K2ETbA4,1378
153
141
  rbx/providers/codeforces.py,sha256=HWQN3Zb9UfXgCfwcNMEk6m1HoXQ-UE2odVfZoPukyCg,2294
154
142
  rbx/providers/provider.py,sha256=CNRB-uJZkNFIWv8xhW2s8PY9EwUSK8Ey1Yvxk4YLvcg,688
@@ -158,7 +146,6 @@ rbx/resources/default_config.json,sha256=8GZVHns4nci0-e5ALk9C1lfO6TO9W2ZlmZtxHkL
158
146
  rbx/resources/default_setter_config.mac.yml,sha256=UWRvdsFp-6I9dU1b1q9hYNAday9TXvyVd_5gquIkcFQ,1438
159
147
  rbx/resources/default_setter_config.yml,sha256=cYTiQqxadRyOmgI9aS6LlG3Cn-azKhOmaZlpZBXvBow,1409
160
148
  rbx/resources/envs/default.rbx.yml,sha256=quSPG5Xs9KroYLATNLPNtORLGRWtrLLt2Fx81T1enAM,1692
161
- rbx/resources/envs/isolate.rbx.yml,sha256=iY7wHco2JYN0LEmZ-ErmjKLz7beyNMUxRkSbhB-Y6bY,867
162
149
  rbx/resources/packagers/boca/checker.sh,sha256=kesoIYeCttAtuQBq-7HvfXK8cAFTJhFbqHm9rNd_udg,1272
163
150
  rbx/resources/packagers/boca/compare.sh,sha256=a6AmQqwrIq616DHjp_S2l95wO7UiMVy0LQ9EajZKDDk,1201
164
151
  rbx/resources/packagers/boca/compile/c,sha256=DZ9PWjgDTuauwY4my8Y8WXz0gZCBd4I7n0k0QxBaAUs,4466
@@ -216,34 +203,27 @@ rbx/resources/presets/default/problem/.gitignore,sha256=CMwGD717vKcbQrXjha2D4LMw
216
203
  rbx/resources/presets/default/problem/gens/gen.cpp,sha256=rn6sGRjZ1sFE1Rq02r6488iquY9xTrutcvLv4d1sohA,178
217
204
  rbx/resources/presets/default/problem/manual_tests/samples/000.in,sha256=w66OEtCJGqjUNj8cJrqgImgGVm8W_OlIUtF255ds-ow,4
218
205
  rbx/resources/presets/default/problem/manual_tests/samples/001.in,sha256=P4QInDX87xXoDWu4PVIzUeNW5LtTlUKbMCvJ9uZOPGw,20
219
- rbx/resources/presets/default/problem/problem.rbx.yml,sha256=U7RV_vLHWUHwRhjKgVPoPncmCeyObapr9lXGACzpL28,1760
206
+ rbx/resources/presets/default/problem/problem.rbx.yml,sha256=SX8ohULvaRiFI9kIpLQ0hDEx8r5ozsfraK9PYr4YmQM,1691
220
207
  rbx/resources/presets/default/problem/rbx.h,sha256=LBkbC3gbDPW2Fdm1p99hNhF7oKpZLLSY7dE4zpepp5w,2161
221
208
  rbx/resources/presets/default/problem/sols/main.cpp,sha256=AW-j65DiFYUN18rddTKCWc_VyYCMgCbjZ0jAJ-0JLuA,124
222
- rbx/resources/presets/default/problem/sols/slow.cpp,sha256=at9iXQjROaxG5f6OWH__phENb2SOK3crRfU7AwYT6hM,229
223
209
  rbx/resources/presets/default/problem/sols/wa.cpp,sha256=Bj7tejPIlXG_JqUHWY1zi9TDbHdRZzgT_JDbCLRdhbQ,136
224
210
  rbx/resources/presets/default/problem/statement/statement.rbx.tex,sha256=JHdiMN3NQQsysDA1w3RfOGmDFobCc68YCB6SURy2hHo,360
225
211
  rbx/resources/presets/default/problem/testplan/random.py,sha256=XclCB6pw9NT1ahu9bjr3fLZidNGi1E8OnNAPYZEY-Yk,103
226
212
  rbx/resources/presets/default/problem/testplan/random.txt,sha256=XDrow4p79owKnjqyvaIVSNTXwWQDe3X1k_9-2zH43O8,34
227
213
  rbx/resources/presets/default/problem/validator.cpp,sha256=I_Vs12xQnJnwkRtCu4EjazdaERms4GktZhME7zGaQjU,337
228
214
  rbx/resources/presets/default/problem/wcmp.cpp,sha256=gbjJe3Vf9-YzHCEqBUq30aI3jMZXhqBDn3jjecYOn-w,902
229
- rbx/resources/presets/default/shared/contest_template.rbx.tex,sha256=-sExA0H7vo08I6P0dT78_xNN5Q9wiu6KZzB75s12Xm4,1293
215
+ rbx/resources/presets/default/shared/contest_template.rbx.tex,sha256=bEbsVybLJ18V7Ez1i5g8H6-5Aru2Bk1qPsDly_c26lw,1301
230
216
  rbx/resources/presets/default/shared/icpc.sty,sha256=04feEwL7LRRvUFopwVAVjxdTvzE5gQtFsSkm6iJ5hLo,8042
231
- rbx/resources/presets/default/shared/problem_template.rbx.tex,sha256=AjziXNWluAGsQiPQ2r477RkrMpNQJ1kcgidU8T_C4KA,1281
232
- rbx/resources/templates/rbx.h,sha256=Iwtmr2gdDYmZ2VlIurmleBb_uEpriWd4EX0dJta8xUA,2179
217
+ rbx/resources/presets/default/shared/problem_template.rbx.tex,sha256=SfBxSwz1sVBUV5P6JmROXvlIqRfzt7muJwGtZhtCM7E,1427
218
+ rbx/resources/templates/rbx.h,sha256=0AZds9R0PmuPgnlTENb33Y81LW0LlnmOJFaoN8oG3Yo,3638
233
219
  rbx/resources/templates/template.cpp,sha256=xXWpWo7fa7HfmPNqkmHcmv3i46Wm0ZL-gPmkRfGvLn4,317
234
- rbx/run.py,sha256=8WsEAdj7FwYSc9itfJ977n5HN5CYN63T__HRYI6IB1A,1515
235
- rbx/schema.py,sha256=qcxuuxUJ0KwHR03CEYvdoP1SYW7yes3QyuI_0lnVMl0,1494
236
- rbx/submit.py,sha256=7AMqiPyfQRdeO8UPRZqs_gQ88ws5lJrJ_0u40PoVJbQ,2246
237
220
  rbx/submitors/__init__.py,sha256=sVcRNnuKMZatmpGkQURaEVHK-MfU2U0nH4nOatuqywE,620
238
221
  rbx/submitors/codeforces.py,sha256=s8c7sXfm5k76SKMC8g0Y93-RRf8wY2uWbBtA8ODD5eM,4030
239
222
  rbx/submitors/submitor.py,sha256=8q-Hbdahxt30ciT_R9j_xF6lEPUh9IcfAUnzjQjbvHU,457
240
- rbx/test.py,sha256=lrjIWESMedaDLX_knikPsJT322oI2nvy8weCslEuHLU,11810
241
- rbx/testcase.py,sha256=yKOq3CAJZ1YTmInvnoIs0u1iJnRj_X85XiWbLI-p9d8,1951
242
- rbx/testcase_rendering.py,sha256=nfmv6dSEqd4aR3TsaODwkKGK6AXty_DDKtWf_ejiQpI,2084
243
- rbx/testing_utils.py,sha256=x_PqD8Zd2PkN91NxVHUnSTs044-1WK5KKtttKQBXpFs,2083
244
- rbx/utils.py,sha256=SZW_bqU33CkHRrInnGN36QfQA0dQx2zdWO32fxlDy-w,5264
245
- rbx_cp-0.13.3.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
246
- rbx_cp-0.13.3.dist-info/METADATA,sha256=5q0W492nuXldJJbMFEZPSpsjwsuIF2AN0q-WOxo7RR4,4616
247
- rbx_cp-0.13.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
248
- rbx_cp-0.13.3.dist-info/entry_points.txt,sha256=qBTLBOeifT1F00LWaEewRRE_jQPgvH7BUdJfZ-dYsFU,57
249
- rbx_cp-0.13.3.dist-info/RECORD,,
223
+ rbx/testing_utils.py,sha256=965vlkQpUW8cEqjB6S2g_C_avL5fn503mJPbqjY_zt4,2317
224
+ rbx/utils.py,sha256=8f53t5AdonCi20Xxm3hjBZ8fdg9hNpt0-xUhSTfE7u4,6929
225
+ rbx_cp-0.13.5.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
226
+ rbx_cp-0.13.5.dist-info/METADATA,sha256=lKzIg6at_3DbPTYFqMgkGU2FOsrnRTzojlgvS6x6aXk,4659
227
+ rbx_cp-0.13.5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
228
+ rbx_cp-0.13.5.dist-info/entry_points.txt,sha256=qBTLBOeifT1F00LWaEewRRE_jQPgvH7BUdJfZ-dYsFU,57
229
+ rbx_cp-0.13.5.dist-info/RECORD,,
rbx/box/conftest.py DELETED
@@ -1,42 +0,0 @@
1
- import os
2
- import pathlib
3
- import shutil
4
- from collections.abc import Iterator
5
-
6
- import pytest
7
-
8
- from rbx import testing_utils
9
- from rbx.box import package
10
-
11
-
12
- @pytest.fixture
13
- def pkg_cleandir(cleandir: pathlib.Path) -> Iterator[pathlib.Path]:
14
- old_temp_dir = package.TEMP_DIR
15
- package.TEMP_DIR = cleandir
16
-
17
- pkgdir = cleandir / 'pkg'
18
- pkgdir.mkdir(exist_ok=True, parents=True)
19
- lwd = pathlib.Path.cwd()
20
- os.chdir(str(pkgdir))
21
- try:
22
- yield pkgdir.absolute()
23
- finally:
24
- os.chdir(str(lwd))
25
- package.TEMP_DIR = old_temp_dir
26
-
27
-
28
- @pytest.fixture
29
- def pkg_from_testdata(
30
- request, testdata_path: pathlib.Path, pkg_cleandir: pathlib.Path
31
- ) -> Iterator[pathlib.Path]:
32
- marker = request.node.get_closest_marker('test_pkg')
33
- if marker is None:
34
- raise ValueError('test_pkg marker not found')
35
- testdata = testdata_path / marker.args[0]
36
- shutil.copytree(str(testdata), str(pkg_cleandir), dirs_exist_ok=True)
37
- yield pkg_cleandir
38
-
39
-
40
- @pytest.fixture(autouse=True)
41
- def clear_cache():
42
- testing_utils.clear_all_functools_cache()
@@ -1,67 +0,0 @@
1
- import pathlib
2
-
3
- import pytest
4
-
5
- from rbx.box import package
6
- from rbx.box.generators import (
7
- generate_outputs_for_testcases,
8
- generate_testcases,
9
- )
10
- from rbx.box.testcase_extractors import extract_generation_testcases_from_groups
11
- from rbx.testing_utils import print_directory_tree
12
-
13
-
14
- @pytest.mark.test_pkg('box1')
15
- async def test_generator_works(pkg_from_testdata: pathlib.Path):
16
- await generate_testcases()
17
- entries = [
18
- entry.group_entry for entry in await extract_generation_testcases_from_groups()
19
- ]
20
- await generate_outputs_for_testcases(entries)
21
-
22
- # Debug when fail.
23
- print_directory_tree(pkg_from_testdata)
24
-
25
- assert (
26
- package.get_build_testgroup_path('gen1') / '0-000.in'
27
- ).read_text() == '777\n'
28
- assert (
29
- package.get_build_testgroup_path('gen1') / '1-gen-000.in'
30
- ).read_text() == '123\n'
31
- assert (
32
- package.get_build_testgroup_path('gen1') / '1-gen-001.in'
33
- ).read_text() == '424242\n'
34
- assert (
35
- package.get_build_testgroup_path('gen1') / '2-genScript-000.in'
36
- ).read_text() == '25\n'
37
-
38
-
39
- @pytest.mark.test_pkg('box1')
40
- async def test_generator_cache_works(
41
- pkg_from_testdata: pathlib.Path,
42
- ):
43
- # Run the first time.
44
- await generate_testcases()
45
- assert (
46
- package.get_build_testgroup_path('gen1') / '1-gen-000.in'
47
- ).read_text() == '123\n'
48
- assert (
49
- package.get_build_testgroup_path('gen1') / '1-gen-001.in'
50
- ).read_text() == '424242\n'
51
-
52
- # Change the generator `gen1`, but keep `gen2` as is.
53
- gen_path = pkg_from_testdata / 'gen1.cpp'
54
- gen_path.write_text(gen_path.read_text().replace('123', '4567'))
55
-
56
- # Run the second time.
57
- await generate_testcases()
58
-
59
- # Debug when fail.
60
- print_directory_tree(pkg_from_testdata)
61
-
62
- assert (
63
- package.get_build_testgroup_path('gen1') / '1-gen-000.in'
64
- ).read_text() == '4567\n'
65
- assert (
66
- package.get_build_testgroup_path('gen1') / '1-gen-001.in'
67
- ).read_text() == '424242\n'
@@ -1,25 +0,0 @@
1
- import subprocess
2
- import sys
3
- from pathlib import Path
4
-
5
- LAZY_MODULES = {
6
- 'gitpython',
7
- 'questionary',
8
- 'fastapi',
9
- 'requests',
10
- 'pydantic_xml',
11
- 'rbx.box.packaging.polygon.packager',
12
- 'rbx.box.stresses',
13
- }
14
-
15
-
16
- def test_rich_not_imported_unnecessary():
17
- file_path = Path(__file__).parent / 'lazy_importing_main.py'
18
- result = subprocess.run(
19
- [sys.executable, '-m', 'coverage', 'run', str(file_path)],
20
- capture_output=True,
21
- encoding='utf-8',
22
- )
23
- modules = result.stdout.splitlines()
24
- modules = [module for module in modules if module in LAZY_MODULES]
25
- assert not modules
rbx/box/solutions_test.py DELETED
@@ -1,47 +0,0 @@
1
- import pathlib
2
-
3
- import pytest
4
-
5
- from rbx.box.environment import VerificationLevel
6
- from rbx.box.generators import (
7
- generate_outputs_for_testcases,
8
- generate_testcases,
9
- )
10
- from rbx.box.solutions import (
11
- convert_list_of_solution_evaluations_to_dict,
12
- run_solutions,
13
- )
14
- from rbx.box.testcase_extractors import extract_generation_testcases_from_groups
15
- from rbx.grading.steps import Outcome
16
-
17
-
18
- @pytest.mark.test_pkg('box1')
19
- async def test_solutions(pkg_from_testdata: pathlib.Path):
20
- await generate_testcases()
21
- entries = [
22
- entry.group_entry for entry in await extract_generation_testcases_from_groups()
23
- ]
24
- await generate_outputs_for_testcases(entries)
25
-
26
- result = run_solutions(verification=VerificationLevel.FULL)
27
- res = await convert_list_of_solution_evaluations_to_dict(
28
- result.skeleton, result.items
29
- )
30
-
31
- # First solution should pass all tests.
32
- assert all(chk.result.outcome == Outcome.ACCEPTED for chk in res[0]['gen1'])
33
- # 25 test should be WA for the second solution.
34
- assert res[1]['gen1'][3].result.outcome == Outcome.WRONG_ANSWER
35
- # Runtime error for third solution.
36
- assert all(chk.result.outcome == Outcome.RUNTIME_ERROR for chk in res[2]['gen1'])
37
- # 1e9 test should be TLE for the fourth solution (soft TLE)
38
- assert res[3]['gen1'][4].result.outcome == Outcome.TIME_LIMIT_EXCEEDED
39
- # no TLE outcome should be WA (soft TLE)
40
- assert res[4]['gen1'][4].result.no_tle_outcome == Outcome.WRONG_ANSWER
41
- # hard TLE
42
- assert res[5]['gen1'][4].result.outcome == Outcome.TIME_LIMIT_EXCEEDED
43
- assert res[5]['gen1'][4].result.no_tle_outcome is None
44
- # OLE
45
- assert all(
46
- chk.result.outcome == Outcome.OUTPUT_LIMIT_EXCEEDED for chk in res[6]['gen1']
47
- )
@@ -1,15 +0,0 @@
1
- import pathlib
2
-
3
- import pytest
4
-
5
- from rbx.box.generators import generate_testcases
6
- from rbx.box.validators import validate_testcases
7
-
8
-
9
- @pytest.mark.test_pkg('box1')
10
- async def test_validators(pkg_from_testdata: pathlib.Path):
11
- await generate_testcases()
12
- validation_infos = await validate_testcases()
13
-
14
- for info in validation_infos:
15
- assert info.ok
rbx/checker.py DELETED
@@ -1,128 +0,0 @@
1
- import pathlib
2
- from typing import Optional
3
-
4
- import typer
5
- from typing_extensions import Annotated
6
-
7
- from rbx import annotations, config, metadata, utils
8
- from rbx.config import get_builtin_checker, get_testlib
9
- from rbx.console import console
10
-
11
- app = typer.Typer(no_args_is_help=True)
12
-
13
-
14
- @app.command('add, a')
15
- def add(
16
- problem: annotations.Problem,
17
- template: Annotated[
18
- Optional[str],
19
- typer.Option(
20
- '--template', '-t', help='Checker that should be used as template.'
21
- ),
22
- ] = None,
23
- ):
24
- """
25
- Add a new checker for the problem.
26
- """
27
- dumped_problem = metadata.find_problem_by_anything(problem)
28
- if dumped_problem is None:
29
- console.print(f'[error]Problem [item]{problem}[/item] not found.[/error]')
30
- return
31
-
32
- template_path = get_builtin_checker(template or 'boilerplate.cpp')
33
-
34
- if not template_path.is_file():
35
- console.print(f'[error]Template file {template} not found.[/error]')
36
- return
37
-
38
- testlib_path = get_testlib()
39
- if not testlib_path.is_file():
40
- console.print('[error]Testlib file not found.[/error]')
41
- return
42
-
43
- checker_name = f'{dumped_problem.code}.checker.cpp'
44
- checker_path = pathlib.Path() / checker_name
45
-
46
- # Create both files.
47
- checker_path.write_text(template_path.read_text())
48
- (checker_path.parent / 'testlib.h').write_text(testlib_path.read_text())
49
-
50
- # Set checker.
51
- problem_to_dump = dumped_problem.model_copy()
52
- problem_to_dump.checker = checker_name
53
- problem_path = metadata.find_problem_path_by_code(dumped_problem.code)
54
- if not problem_path:
55
- raise typer.Exit(1)
56
- problem_path.write_text(utils.model_json(problem_to_dump))
57
- console.print(
58
- f'Checker [item]{checker_name}[/item] added to problem [item]{dumped_problem.pretty_name()}[/item].'
59
- )
60
-
61
-
62
- @app.command('set, s')
63
- def set(problem: annotations.Problem, checker: annotations.Checker):
64
- """
65
- Set a checker for the problem.
66
- """
67
- dumped_problem = metadata.find_problem_by_anything(problem)
68
- if dumped_problem is None:
69
- console.print(f'[error]Problem [item]{problem}[/item] not found.[/error]')
70
- return
71
-
72
- problem_to_dump = dumped_problem.model_copy()
73
- problem_to_dump.checker = checker
74
- problem_path = metadata.find_problem_path_by_code(dumped_problem.code)
75
- if not problem_path:
76
- raise typer.Exit(1)
77
- problem_path.write_text(utils.model_json(problem_to_dump))
78
- console.print(
79
- f'Checker [item]{checker}[/item] will be used for problem [item]{dumped_problem.pretty_name()}[/item].'
80
- )
81
-
82
-
83
- @app.command('unset, u')
84
- def unset(problem: annotations.Problem):
85
- """
86
- Use the default checker for a problem.
87
- """
88
- dumped_problem = metadata.find_problem_by_anything(problem)
89
- if dumped_problem is None:
90
- console.print(f'[error]Problem [item]{problem}[/item] not found.[/error]')
91
- return
92
-
93
- problem_to_dump = dumped_problem.model_copy()
94
- problem_to_dump.checker = None
95
- problem_path = metadata.find_problem_path_by_code(dumped_problem.code)
96
- if not problem_path:
97
- raise typer.Exit(1)
98
- problem_path.write_text(utils.model_json(problem_to_dump))
99
- console.print(
100
- f'Default checker will be used for problem [item]{dumped_problem.pretty_name()}[/item].'
101
- )
102
-
103
-
104
- @app.command('edit, e')
105
- def edit(problem: annotations.Problem):
106
- """
107
- Edit the checker for a problem.
108
- """
109
- dumped_problem = metadata.find_problem_by_anything(problem)
110
- if dumped_problem is None:
111
- console.print(f'[error]Problem [item]{problem}[/item] not found.[/error]')
112
- return
113
-
114
- checker = dumped_problem.checker
115
- if checker is None:
116
- console.print(
117
- f'[error]No checker set for problem [item]{dumped_problem.pretty_name()}[/item].[/error]'
118
- )
119
- return
120
-
121
- checker_path = pathlib.Path() / checker
122
- if not checker_path.is_file():
123
- console.print(
124
- f'[error]Checker [item]{checker}[/item] not found in the problems folder. You cannot edit a builtin checker.[/error]'
125
- )
126
- return
127
-
128
- config.open_editor(checker_path)