|
36 | 36 | import logging |
37 | 37 | from typing import Self |
38 | 38 |
|
39 | | -from cms.db import Dataset, Evaluation, Executable, File, Manager, Submission, \ |
40 | | - UserTest, UserTestExecutable, Contest, SubmissionResult, UserTestResult |
| 39 | +from cms.db import ( |
| 40 | + Dataset, |
| 41 | + Evaluation, |
| 42 | + Executable, |
| 43 | + File, |
| 44 | + Manager, |
| 45 | + Submission, |
| 46 | + UserTest, |
| 47 | + UserTestExecutable, |
| 48 | + Contest, |
| 49 | + SubmissionResult, |
| 50 | + UserTestResult, |
| 51 | +) |
41 | 52 | from cms.grading.languagemanager import get_language |
42 | 53 | from cms.service.esoperations import ESOperation |
43 | 54 |
|
@@ -67,15 +78,23 @@ class Job: |
67 | 78 |
|
68 | 79 | """ |
69 | 80 |
|
70 | | - def __init__(self, operation: ESOperation | None = None, |
71 | | - task_type: str | None = None, task_type_parameters: object = None, |
72 | | - language: str | None = None, multithreaded_sandbox: bool = False, |
73 | | - shard: int | None = None, keep_sandbox: bool = False, |
74 | | - sandboxes: list[str] | None = None, info: str | None = None, |
75 | | - success: bool | None = None, text: list[str] | None = None, |
76 | | - files: dict[str, File] | None = None, |
77 | | - managers: dict[str, Manager] | None = None, |
78 | | - executables: dict[str, Executable] | None = None): |
| 81 | + def __init__( |
| 82 | + self, |
| 83 | + operation: ESOperation | None = None, |
| 84 | + task_type: str | None = None, |
| 85 | + task_type_parameters: object = None, |
| 86 | + language: str | None = None, |
| 87 | + multithreaded_sandbox: bool = False, |
| 88 | + shard: int | None = None, |
| 89 | + keep_sandbox: bool = False, |
| 90 | + sandboxes: list[str] | None = None, |
| 91 | + info: str | None = None, |
| 92 | + success: bool | None = None, |
| 93 | + text: list[str] | None = None, |
| 94 | + files: dict[str, File] | None = None, |
| 95 | + managers: dict[str, Manager] | None = None, |
| 96 | + executables: dict[str, Executable] | None = None, |
| 97 | + ): |
79 | 98 | """Initialization. |
80 | 99 |
|
81 | 100 | operation: the operation. |
@@ -192,7 +211,9 @@ def import_from_dict(cls, data: dict) -> Self: |
192 | 211 | return cls(**data) |
193 | 212 |
|
194 | 213 | @staticmethod |
195 | | - def from_operation(operation: ESOperation, object_: Submission | UserTest, dataset: Dataset) -> "Job": |
| 214 | + def from_operation( |
| 215 | + operation: ESOperation, object_: Submission | UserTest, dataset: Dataset |
| 216 | + ) -> "Job": |
196 | 217 | """Produce the job for the operation in the argument. |
197 | 218 |
|
198 | 219 | Return the Job object that has to be sent to Workers to have |
@@ -245,22 +266,25 @@ class CompilationJob(Job): |
245 | 266 |
|
246 | 267 | """ |
247 | 268 |
|
248 | | - def __init__(self, operation: ESOperation | None = None, |
249 | | - task_type: str | None = None, |
250 | | - task_type_parameters: object = None, |
251 | | - shard: int | None = None, |
252 | | - keep_sandbox: bool = False, |
253 | | - sandboxes: list[str] | None = None, |
254 | | - info: str | None = None, |
255 | | - language: str | None = None, |
256 | | - multithreaded_sandbox: bool = False, |
257 | | - files: dict[str, File] | None = None, |
258 | | - managers: dict[str, Manager] | None = None, |
259 | | - success: bool | None = None, |
260 | | - compilation_success: bool | None = None, |
261 | | - executables: dict[str, Executable] | None = None, |
262 | | - text: list[str] | None = None, |
263 | | - plus: dict | None = None): |
| 269 | + def __init__( |
| 270 | + self, |
| 271 | + operation: ESOperation | None = None, |
| 272 | + task_type: str | None = None, |
| 273 | + task_type_parameters: object = None, |
| 274 | + shard: int | None = None, |
| 275 | + keep_sandbox: bool = False, |
| 276 | + sandboxes: list[str] | None = None, |
| 277 | + info: str | None = None, |
| 278 | + language: str | None = None, |
| 279 | + multithreaded_sandbox: bool = False, |
| 280 | + files: dict[str, File] | None = None, |
| 281 | + managers: dict[str, Manager] | None = None, |
| 282 | + success: bool | None = None, |
| 283 | + compilation_success: bool | None = None, |
| 284 | + executables: dict[str, Executable] | None = None, |
| 285 | + text: list[str] | None = None, |
| 286 | + plus: dict | None = None, |
| 287 | + ): |
264 | 288 | """Initialization. |
265 | 289 |
|
266 | 290 | See base class for the remaining arguments. |
@@ -288,7 +312,9 @@ def export_to_dict(self) -> dict: |
288 | 312 | return res |
289 | 313 |
|
290 | 314 | @staticmethod |
291 | | - def from_submission(operation: ESOperation, submission: Submission, dataset: Dataset) -> "CompilationJob": |
| 315 | + def from_submission( |
| 316 | + operation: ESOperation, submission: Submission, dataset: Dataset |
| 317 | + ) -> "CompilationJob": |
292 | 318 | """Create a CompilationJob from a submission. |
293 | 319 |
|
294 | 320 | operation: a COMPILATION operation. |
@@ -346,7 +372,9 @@ def to_submission(self, sr: SubmissionResult): |
346 | 372 | sr.executables.set(executable) |
347 | 373 |
|
348 | 374 | @staticmethod |
349 | | - def from_user_test(operation: ESOperation, user_test: UserTest, dataset: Dataset) -> "CompilationJob": |
| 375 | + def from_user_test( |
| 376 | + operation: ESOperation, user_test: UserTest, dataset: Dataset |
| 377 | + ) -> "CompilationJob": |
350 | 378 | """Create a CompilationJob from a user test. |
351 | 379 |
|
352 | 380 | operation: a USER_TEST_COMPILATION operation. |
@@ -449,29 +477,32 @@ class EvaluationJob(Job): |
449 | 477 | only_execution, get_output. |
450 | 478 |
|
451 | 479 | """ |
452 | | - def __init__(self, operation: ESOperation | None = None, |
453 | | - task_type: str | None = None, |
454 | | - task_type_parameters: object = None, |
455 | | - shard: int | None = None, |
456 | | - keep_sandbox: bool = False, |
457 | | - sandboxes: list[str] | None = None, |
458 | | - info: str | None = None, |
459 | | - language: str | None = None, |
460 | | - multithreaded_sandbox: bool = False, |
461 | | - files: dict[str, File] | None = None, |
462 | | - managers: dict[str, Manager] | None = None, |
463 | | - executables: dict[str, Executable] | None = None, |
464 | | - input: str | None = None, |
465 | | - output: str | None = None, |
466 | | - time_limit: float | None = None, |
467 | | - memory_limit: int | None = None, |
468 | | - success: bool | None = None, |
469 | | - outcome: str | None = None, |
470 | | - text: list[str] | None = None, |
471 | | - user_output: str | None = None, |
472 | | - plus: dict | None = None, |
473 | | - only_execution: bool | None = False, |
474 | | - get_output: bool | None = False): |
| 480 | + def __init__( |
| 481 | + self, |
| 482 | + operation: ESOperation | None = None, |
| 483 | + task_type: str | None = None, |
| 484 | + task_type_parameters: object = None, |
| 485 | + shard: int | None = None, |
| 486 | + keep_sandbox: bool = False, |
| 487 | + sandboxes: list[str] | None = None, |
| 488 | + info: str | None = None, |
| 489 | + language: str | None = None, |
| 490 | + multithreaded_sandbox: bool = False, |
| 491 | + files: dict[str, File] | None = None, |
| 492 | + managers: dict[str, Manager] | None = None, |
| 493 | + executables: dict[str, Executable] | None = None, |
| 494 | + input: str | None = None, |
| 495 | + output: str | None = None, |
| 496 | + time_limit: float | None = None, |
| 497 | + memory_limit: int | None = None, |
| 498 | + success: bool | None = None, |
| 499 | + outcome: str | None = None, |
| 500 | + text: list[str] | None = None, |
| 501 | + user_output: str | None = None, |
| 502 | + plus: dict | None = None, |
| 503 | + only_execution: bool | None = False, |
| 504 | + get_output: bool | None = False, |
| 505 | + ): |
475 | 506 | """Initialization. |
476 | 507 |
|
477 | 508 | See base class for the remaining arguments. |
@@ -525,7 +556,9 @@ def export_to_dict(self) -> dict: |
525 | 556 | return res |
526 | 557 |
|
527 | 558 | @staticmethod |
528 | | - def from_submission(operation: ESOperation, submission: Submission, dataset: Dataset) -> "EvaluationJob": |
| 559 | + def from_submission( |
| 560 | + operation: ESOperation, submission: Submission, dataset: Dataset |
| 561 | + ) -> "EvaluationJob": |
529 | 562 | """Create an EvaluationJob from a submission. |
530 | 563 |
|
531 | 564 | operation: an EVALUATION operation. |
@@ -590,7 +623,9 @@ def to_submission(self, sr: SubmissionResult): |
590 | 623 | testcase=sr.dataset.testcases[self.operation.testcase_codename])] |
591 | 624 |
|
592 | 625 | @staticmethod |
593 | | - def from_user_test(operation: ESOperation, user_test: UserTest, dataset: Dataset) -> "EvaluationJob": |
| 626 | + def from_user_test( |
| 627 | + operation: ESOperation, user_test: UserTest, dataset: Dataset |
| 628 | + ) -> "EvaluationJob": |
594 | 629 | """Create an EvaluationJob from a user test. |
595 | 630 |
|
596 | 631 | operation: an USER_TEST_EVALUATION operation. |
|
0 commit comments