rbx.cp 0.5.35__py3-none-any.whl → 0.5.36__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.
- rbx/box/contest/main.py +2 -1
- rbx/box/creation.py +7 -12
- rbx/box/main.py +10 -0
- rbx/box/package.py +2 -2
- rbx/box/testcase_utils.py +7 -7
- rbx/box/testcases/main.py +4 -4
- rbx/config.py +16 -2
- {rbx_cp-0.5.35.dist-info → rbx_cp-0.5.36.dist-info}/METADATA +1 -1
- {rbx_cp-0.5.35.dist-info → rbx_cp-0.5.36.dist-info}/RECORD +12 -12
- {rbx_cp-0.5.35.dist-info → rbx_cp-0.5.36.dist-info}/LICENSE +0 -0
- {rbx_cp-0.5.35.dist-info → rbx_cp-0.5.36.dist-info}/WHEEL +0 -0
- {rbx_cp-0.5.35.dist-info → rbx_cp-0.5.36.dist-info}/entry_points.txt +0 -0
rbx/box/contest/main.py
CHANGED
@@ -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
|
-
|
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
|
|
rbx/box/creation.py
CHANGED
@@ -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)
|
rbx/box/main.py
CHANGED
@@ -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
|
rbx/box/package.py
CHANGED
@@ -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'
|
rbx/box/testcase_utils.py
CHANGED
@@ -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
|
-
|
80
|
-
if
|
81
|
-
|
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
|
-
|
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():
|
rbx/box/testcases/main.py
CHANGED
@@ -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(
|
rbx/config.py
CHANGED
@@ -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
|
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
|
-
|
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
|
|
@@ -12,10 +12,10 @@ rbx/box/contest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
rbx/box/contest/build_contest_statements.py,sha256=H2MwmkiPO_cHUEenzfPxHuJ3XcwjHakGZwKojNJQt74,11380
|
13
13
|
rbx/box/contest/contest_package.py,sha256=OaUbpBtkhkgOPzJ1ccI_Vq4FMSaJvZm3gMOKfVY8oy4,3032
|
14
14
|
rbx/box/contest/contest_utils.py,sha256=TDE7I6YQJlu4dQd68wzOp019bNgqiT0RlM-LMQMjL9w,301
|
15
|
-
rbx/box/contest/main.py,sha256=
|
15
|
+
rbx/box/contest/main.py,sha256=oL-GbyLKdpMjIWiSuWTQgRhQ9hcb7DuNn0axkunx0io,7436
|
16
16
|
rbx/box/contest/schema.py,sha256=JMAig5WpaOahNgAHxA9vX4zYeVYDxpjKP_PFGvmmkE0,4954
|
17
17
|
rbx/box/contest/statements.py,sha256=Pe4uo1hxvEON8O11VAzsOP3DxUel0vmwiAmolh4ltEs,2910
|
18
|
-
rbx/box/creation.py,sha256=
|
18
|
+
rbx/box/creation.py,sha256=Evz7K6JoarD-4JJQsZsgoxU9FgCF9Z7-LfuroG4Cqls,2444
|
19
19
|
rbx/box/deferred.py,sha256=II3X9e87JCOZtmspnHh-n4PFqh-FsH_oc0XJHZ9ZYVQ,691
|
20
20
|
rbx/box/download.py,sha256=MFP-R26JiYGAP89I0TK-0fYc69Fsd20tsBqgtRCy5AE,2234
|
21
21
|
rbx/box/environment.py,sha256=47NtyuVC6zSQKAtQaXPEXvqcD-KJiuWRpWF8pYvcG4c,11158
|
@@ -23,8 +23,8 @@ rbx/box/extensions.py,sha256=Von8kIeXvNFTkGlMRMTvL2HIHPwlkuiMswr-ydbGV1w,519
|
|
23
23
|
rbx/box/formatting.py,sha256=3phFRHzqVXj4Ok1yDhCq6Clbw6KlqwJNpMhs--oTWFI,405
|
24
24
|
rbx/box/generators.py,sha256=OYAOhLQJMQFoQ2Tl-o2QO5sJL_HaWFPH9vnISr9rMno,22404
|
25
25
|
rbx/box/generators_test.py,sha256=WvS5GH8QMInAXvR2nyeEfgtx8FHIH1ZSqYGkyEa1sqE,1910
|
26
|
-
rbx/box/main.py,sha256=
|
27
|
-
rbx/box/package.py,sha256=
|
26
|
+
rbx/box/main.py,sha256=0lrPLJTGvatcGZCYgLRKKaRkWKEFmNKyA48Shm-uof8,24308
|
27
|
+
rbx/box/package.py,sha256=80SDHvSzfraCUYutMn_kwsFsmmrSZiaeRHhhrWGmIY4,12081
|
28
28
|
rbx/box/packaging/boca/extension.py,sha256=hQhcbocNfW2ESv5RalS1wf6uvOoOfOnR_gHvbXUbSzY,852
|
29
29
|
rbx/box/packaging/boca/packager.py,sha256=FOhSRg5K5Y4qNB0WyTR3DKgrpObf9I0JbyGpJHOtxpo,10673
|
30
30
|
rbx/box/packaging/contest_main.py,sha256=Hbxh7geNqrePs5tWhPgdg5W2qhaW5yoreK_VP0Sm19k,2727
|
@@ -55,9 +55,9 @@ rbx/box/stresses.py,sha256=ceFpkZVKBfKKVrKFjeARdub5VGKmU9JPZwj-FxcqYjQ,11771
|
|
55
55
|
rbx/box/stressing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
56
56
|
rbx/box/stressing/finder_parser.py,sha256=jXpYNa4FyugzmHi3r96Uv4rU1krRQJc5Ihr9jf1cvNo,11918
|
57
57
|
rbx/box/stressing/generator_parser.py,sha256=oHZryjR3YohgaSO9WEirQ7b2e-98WgZStF0N99W4Thw,7380
|
58
|
-
rbx/box/testcase_utils.py,sha256=
|
58
|
+
rbx/box/testcase_utils.py,sha256=hlVvrmf7lp6DiRd2E-sFHVsvbctQujXCr7DrGi0040I,4035
|
59
59
|
rbx/box/testcases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
60
|
-
rbx/box/testcases/main.py,sha256=
|
60
|
+
rbx/box/testcases/main.py,sha256=6ywg3fSMW1hllHobg6Wcgw1pQczwjlJ3J10dgQtCdss,5212
|
61
61
|
rbx/box/ui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
62
62
|
rbx/box/ui/captured_log.py,sha256=ptICDPViVnz-_2NfrcB0SSBXNW5L74zI-vAZNN7kSok,11319
|
63
63
|
rbx/box/ui/css/app.tcss,sha256=apd5PkPEvl5jK3kE2qrxPyVED1VnvSsj08QQwzUPwEA,786
|
@@ -67,7 +67,7 @@ rbx/box/validators.py,sha256=RtXyuiBDourcBp__YEibWLpr4Wj7YcIYOpkR8Vk6oro,9028
|
|
67
67
|
rbx/box/validators_test.py,sha256=hriR6rD32Ouu64eKYYTPLZVvqMxXj7Q2h1l_JAefL7U,344
|
68
68
|
rbx/checker.py,sha256=pj1jO3my48ru-qugbER5onccANCjoR0-PaFe3H3VGEY,4118
|
69
69
|
rbx/clone.py,sha256=wpHyED0_7ST7LD3vj7HjXhzqEzlwh6dRQvKQVDYhGeU,6744
|
70
|
-
rbx/config.py,sha256=
|
70
|
+
rbx/config.py,sha256=78xKH0zddEF32uIbIs10snqvACx20DmzjQTCex7w95Y,8136
|
71
71
|
rbx/conftest.py,sha256=ouilbOIpvX8jTEdCAiWT85CbdBQKUUf41BjmDI82u-Y,967
|
72
72
|
rbx/console.py,sha256=X8EJy68OROgh6ao3ZcUjZm5Y56VFMzen58ywAuQ7pAU,990
|
73
73
|
rbx/create.py,sha256=ezUq9KiSA-88ASd8CtjWXw8UB4LCaQ3Gib3OgvsLK-Q,986
|
@@ -167,8 +167,8 @@ rbx/testdata/caching/executable.py,sha256=WKRHNf_fprFJd1Fq1ubmQtR3mZzTYVNwKPLWuZ
|
|
167
167
|
rbx/testdata/compatible,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
168
168
|
rbx/testing_utils.py,sha256=ZZLKMUHlZ4HwsuNY50jqSBJ9HhpnFdba7opjDsvXE1U,2084
|
169
169
|
rbx/utils.py,sha256=AITbkWpWtSp-x3Xept_aObfj_jPL7XL0JJoz5-F9Fp8,4671
|
170
|
-
rbx_cp-0.5.
|
171
|
-
rbx_cp-0.5.
|
172
|
-
rbx_cp-0.5.
|
173
|
-
rbx_cp-0.5.
|
174
|
-
rbx_cp-0.5.
|
170
|
+
rbx_cp-0.5.36.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
171
|
+
rbx_cp-0.5.36.dist-info/METADATA,sha256=5_8xG48aXtFz3-953WgYq5CUXpHu4snzLQ5iQKmbdhA,3263
|
172
|
+
rbx_cp-0.5.36.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
173
|
+
rbx_cp-0.5.36.dist-info/entry_points.txt,sha256=qBTLBOeifT1F00LWaEewRRE_jQPgvH7BUdJfZ-dYsFU,57
|
174
|
+
rbx_cp-0.5.36.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|