77 from synapseclient import Synapse
88
99
10- async def create_submission (request_body : dict , synapse_client : Optional ["Synapse" ] = None ) -> dict :
10+ async def create_submission (
11+ request_body : dict , synapse_client : Optional ["Synapse" ] = None
12+ ) -> dict :
1113 """
1214 Creates a Submission and sends a submission notification email to the submitter's team members.
1315
@@ -23,13 +25,15 @@ async def create_submission(request_body: dict, synapse_client: Optional["Synaps
2325 client = Synapse .get_client (synapse_client = synapse_client )
2426
2527 uri = "/evaluation/submission"
26-
28+
2729 response = await client .rest_post_async (uri , body = json .dumps (request_body ))
2830
2931 return response
3032
3133
32- async def get_submission (submission_id : str , synapse_client : Optional ["Synapse" ] = None ) -> dict :
34+ async def get_submission (
35+ submission_id : str , synapse_client : Optional ["Synapse" ] = None
36+ ) -> dict :
3337 """
3438 Retrieves a Submission by its ID.
3539
@@ -39,7 +43,7 @@ async def get_submission(submission_id: str, synapse_client: Optional["Synapse"]
3943 submission_id: The ID of the submission to fetch.
4044 synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)` this will use the last created
4145 instance from the Synapse class constructor.
42-
46+
4347 Returns:
4448 The requested Submission.
4549 """
@@ -48,18 +52,18 @@ async def get_submission(submission_id: str, synapse_client: Optional["Synapse"]
4852 client = Synapse .get_client (synapse_client = synapse_client )
4953
5054 uri = f"/evaluation/submission/{ submission_id } "
51-
55+
5256 response = await client .rest_get_async (uri )
5357
5458 return response
5559
5660
5761async def get_evaluation_submissions (
58- evaluation_id : str ,
62+ evaluation_id : str ,
5963 status : Optional [str ] = None ,
6064 limit : int = 20 ,
6165 offset : int = 0 ,
62- synapse_client : Optional ["Synapse" ] = None
66+ synapse_client : Optional ["Synapse" ] = None ,
6367) -> dict :
6468 """
6569 Retrieves all Submissions for a specified Evaluation queue.
@@ -68,14 +72,14 @@ async def get_evaluation_submissions(
6872
6973 Arguments:
7074 evaluation_id: The ID of the evaluation queue.
71- status: Optionally filter submissions by a submission status, such as SCORED, VALID,
75+ status: Optionally filter submissions by a submission status, such as SCORED, VALID,
7276 INVALID, OPEN, CLOSED or EVALUATION_IN_PROGRESS.
7377 limit: Limits the number of submissions in a single response. Default to 20.
74- offset: The offset index determines where this page will start from.
78+ offset: The offset index determines where this page will start from.
7579 An index of 0 is the first submission. Default to 0.
76- synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)`
80+ synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)`
7781 this will use the last created instance from the Synapse class constructor.
78-
82+
7983 Returns:
8084 # TODO: Support pagination in the return type.
8185 A response JSON containing a paginated list of submissions for the evaluation queue.
@@ -85,14 +89,11 @@ async def get_evaluation_submissions(
8589 client = Synapse .get_client (synapse_client = synapse_client )
8690
8791 uri = f"/evaluation/{ evaluation_id } /submission/all"
88- query_params = {
89- "limit" : limit ,
90- "offset" : offset
91- }
92-
92+ query_params = {"limit" : limit , "offset" : offset }
93+
9394 if status :
9495 query_params ["status" ] = status
95-
96+
9697 response = await client .rest_get_async (uri , ** query_params )
9798
9899 return response
@@ -103,7 +104,7 @@ async def get_user_submissions(
103104 user_id : Optional [str ] = None ,
104105 limit : int = 20 ,
105106 offset : int = 0 ,
106- synapse_client : Optional ["Synapse" ] = None
107+ synapse_client : Optional ["Synapse" ] = None ,
107108) -> dict :
108109 """
109110 Retrieves Submissions for a specified Evaluation queue and user.
@@ -113,14 +114,14 @@ async def get_user_submissions(
113114
114115 Arguments:
115116 evaluation_id: The ID of the evaluation queue.
116- user_id: Optionally specify the ID of the user whose submissions will be returned.
117+ user_id: Optionally specify the ID of the user whose submissions will be returned.
117118 If omitted, this returns the submissions of the caller.
118119 limit: Limits the number of submissions in a single response. Default to 20.
119- offset: The offset index determines where this page will start from.
120+ offset: The offset index determines where this page will start from.
120121 An index of 0 is the first submission. Default to 0.
121- synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)`
122+ synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)`
122123 this will use the last created instance from the Synapse class constructor.
123-
124+
124125 Returns:
125126 A response JSON containing a paginated list of user submissions for the evaluation queue.
126127 """
@@ -129,14 +130,11 @@ async def get_user_submissions(
129130 client = Synapse .get_client (synapse_client = synapse_client )
130131
131132 uri = f"/evaluation/{ evaluation_id } /submission"
132- query_params = {
133- "limit" : limit ,
134- "offset" : offset
135- }
136-
133+ query_params = {"limit" : limit , "offset" : offset }
134+
137135 if user_id :
138136 query_params ["userId" ] = user_id
139-
137+
140138 response = await client .rest_get_async (uri , ** query_params )
141139
142140 return response
@@ -145,7 +143,7 @@ async def get_user_submissions(
145143async def get_submission_count (
146144 evaluation_id : str ,
147145 status : Optional [str ] = None ,
148- synapse_client : Optional ["Synapse" ] = None
146+ synapse_client : Optional ["Synapse" ] = None ,
149147) -> dict :
150148 """
151149 Gets the number of Submissions for a specified Evaluation queue, optionally filtered by submission status.
@@ -154,11 +152,11 @@ async def get_submission_count(
154152
155153 Arguments:
156154 evaluation_id: The ID of the evaluation queue.
157- status: Optionally filter submissions by a submission status, such as SCORED, VALID,
155+ status: Optionally filter submissions by a submission status, such as SCORED, VALID,
158156 INVALID, OPEN, CLOSED or EVALUATION_IN_PROGRESS.
159- synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)`
157+ synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)`
160158 this will use the last created instance from the Synapse class constructor.
161-
159+
162160 Returns:
163161 A response JSON containing the submission count.
164162 """
@@ -168,18 +166,17 @@ async def get_submission_count(
168166
169167 uri = f"/evaluation/{ evaluation_id } /submission/count"
170168 query_params = {}
171-
169+
172170 if status :
173171 query_params ["status" ] = status
174-
172+
175173 response = await client .rest_get_async (uri , ** query_params )
176174
177175 return response
178176
179177
180178async def delete_submission (
181- submission_id : str ,
182- synapse_client : Optional ["Synapse" ] = None
179+ submission_id : str , synapse_client : Optional ["Synapse" ] = None
183180) -> None :
184181 """
185182 Deletes a Submission and its SubmissionStatus.
@@ -188,21 +185,20 @@ async def delete_submission(
188185
189186 Arguments:
190187 submission_id: The ID of the submission to delete.
191- synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)`
188+ synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)`
192189 this will use the last created instance from the Synapse class constructor.
193190 """
194191 from synapseclient import Synapse
195192
196193 client = Synapse .get_client (synapse_client = synapse_client )
197194
198195 uri = f"/evaluation/submission/{ submission_id } "
199-
196+
200197 await client .rest_delete_async (uri )
201198
202199
203200async def cancel_submission (
204- submission_id : str ,
205- synapse_client : Optional ["Synapse" ] = None
201+ submission_id : str , synapse_client : Optional ["Synapse" ] = None
206202) -> dict :
207203 """
208204 Cancels a Submission. Only the user who created the Submission may cancel it.
@@ -211,18 +207,18 @@ async def cancel_submission(
211207
212208 Arguments:
213209 submission_id: The ID of the submission to cancel.
214- synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)`
210+ synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)`
215211 this will use the last created instance from the Synapse class constructor.
216-
212+
217213 Returns:
218- The canceled Submission .
214+ The Submission response object for the canceled submission as a JSON dict .
219215 """
220216 from synapseclient import Synapse
221217
222218 client = Synapse .get_client (synapse_client = synapse_client )
223219
224220 uri = f"/evaluation/submission/{ submission_id } /cancellation"
225-
221+
226222 response = await client .rest_put_async (uri )
227223
228- return response
224+ return response
0 commit comments