Skip to content

Commit 66a9436

Browse files
committed
Fix bug in calling resolve_client in async_execute. Add skip fields to Submission.
1 parent f285cb0 commit 66a9436

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/judge0/api.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from .clients import Client
44
from .common import Flavor
5-
from .data import LANGUAGE_TO_LANGUAGE_ID
65
from .retry import RegularPeriodRetry, RetryMechanism
76
from .submission import Submission
87

@@ -105,7 +104,7 @@ def async_execute(
105104
client: Optional[Union[Client, Flavor]] = None,
106105
submissions: Optional[Union[Submission, list[Submission]]] = None,
107106
) -> Union[Submission, list[Submission]]:
108-
client = resolve_client(client)
107+
client = resolve_client(client, submissions=submissions)
109108

110109
if isinstance(submissions, (list, tuple)):
111110
return client.create_submissions(submissions)

src/judge0/submission.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from base64 import b64decode, b64encode
22

3-
from .common import Status
3+
from typing import Union
44

5+
from .common import Language, Status
56

67
ENCODED_REQUEST_FIELDS = {
78
"source_code",
@@ -39,10 +40,12 @@
3940
"time",
4041
"wall_time",
4142
"memory",
43+
"post_execution_filesystem",
4244
}
4345
REQUEST_FIELDS = ENCODED_REQUEST_FIELDS | EXTRA_REQUEST_FIELDS
4446
RESPONSE_FIELDS = ENCODED_RESPONSE_FIELDS | EXTRA_RESPONSE_FIELDS
4547
FIELDS = REQUEST_FIELDS | RESPONSE_FIELDS
48+
SKIP_FIELDS = {"language_id", "language", "status_id"}
4649

4750

4851
def encode(text: str) -> str:
@@ -60,8 +63,8 @@ class Submission:
6063

6164
def __init__(
6265
self,
63-
source_code,
64-
language_id,
66+
source_code: str,
67+
language_id: Union[Language, int],
6568
*,
6669
additional_files=None,
6770
compiler_options=None,
@@ -123,9 +126,13 @@ def __init__(
123126
self.time = None
124127
self.wall_time = None
125128
self.memory = None
129+
self.post_execution_filesystem = None
126130

127131
def set_attributes(self, attributes):
128132
for attr, value in attributes.items():
133+
if attr in SKIP_FIELDS:
134+
continue
135+
129136
if attr in ENCODED_FIELDS:
130137
setattr(self, attr, decode(value) if value else None)
131138
else:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy