rbx.cp 0.13.4__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.
@@ -1,54 +0,0 @@
1
- import atexit
2
- import pathlib
3
-
4
- from rich.console import Console
5
-
6
- from rbx import grading_utils
7
- from rbx.grading.judge import cacher, storage
8
- from rbx.grading.judge.sandboxes.isolate import IsolateSandbox
9
-
10
- console = Console()
11
-
12
-
13
- def main():
14
- fs = storage.FilesystemStorage(pathlib.PosixPath('/tmp/rbx-storage'))
15
- cache = cacher.FileCacher(fs)
16
-
17
- python_file = cache.put_file_text(
18
- """
19
- #include <bits/stdc++.h>
20
-
21
- int main() {
22
- std::cout << "Hello, World!" << std::endl;
23
- return 0;
24
- }
25
- """
26
- )
27
-
28
- sandbox = IsolateSandbox(
29
- cache, params=grading_utils.build_preprocess_sandbox_params(), debug=True
30
- )
31
- atexit.register(sandbox.cleanup)
32
- sandbox.create_file_from_storage(pathlib.PosixPath('run.cpp'), python_file)
33
-
34
- sandbox.params.stdout_file = pathlib.PosixPath('run.out')
35
- sandbox.params.stderr_file = pathlib.PosixPath('run.err')
36
-
37
- sandbox.execute_without_std(
38
- ['/usr/bin/g++', '-std=c++17', '-o', 'executable', 'run.cpp'],
39
- )
40
- try:
41
- sandbox.hydrate_logs()
42
- except Exception:
43
- console.print_exception()
44
-
45
- print(sandbox.log)
46
- print(sandbox.get_human_exit_description())
47
- print(sandbox.get_stats())
48
-
49
- print(sandbox.get_file_to_string(pathlib.PosixPath('run.out')))
50
- print(sandbox.get_file_to_string(pathlib.PosixPath('run.err')))
51
-
52
-
53
- if __name__ == '__main__':
54
- main()
@@ -1,36 +0,0 @@
1
- ---
2
- sandbox: "isolate"
3
- defaultCompilation:
4
- sandbox:
5
- maxProcesses: null
6
- timeLimit: null # 10 seconds
7
- wallTimeLimit: null # 10 seconds
8
- memoryLimit: null # 1gb
9
- preserveEnv: true
10
- mirrorDirs:
11
- - "/etc"
12
- - "/usr"
13
- defaultExecution:
14
- sandbox:
15
- # Useful for checkers, validators, etc.
16
- timeLimit: 10000 # 10 seconds
17
- wallTimeLimit: 10000 # 10 seconds
18
- memoryLimit: 1024 # 1gb
19
- languages:
20
- - name: "cpp"
21
- readableName: "C++17"
22
- extension: "cpp"
23
- compilation:
24
- commands:
25
- - "/usr/bin/g++ -std=c++17 -O2 -o {executable} {compilable}"
26
- execution:
27
- command: "./{executable}"
28
- fileMapping:
29
- compilable: "compilable.cpp"
30
- - name: "py"
31
- readableName: "Python3"
32
- extension: "py"
33
- execution:
34
- command: "/usr/bin/python3 {executable}"
35
- fileMapping:
36
- executable: "executable.py"
@@ -1,15 +0,0 @@
1
- #include <bits/stdc++.h>
2
-
3
- using namespace std;
4
-
5
- int32_t main() {
6
- int64_t a, b;
7
- cin >> a >> b;
8
-
9
- int64_t i;
10
- // Unncessarily slow.
11
- for (int k = 0; k < 10; k++)
12
- for (i = 0; i < a + b; i++) {}
13
-
14
- cout << i << endl;
15
- }