@@ -130,11 +130,11 @@ def refresh(self) -> None:
130
130
"""Synchronizes values of all fields with the database.
131
131
"""
132
132
cls = type (self )
133
- res = cls .from_name (self .client , self .parent_id , self .name )
133
+ res = cls .from_name (self .client , self .parent_id , self .name , as_json = True )
134
134
self ._set_field_values (res )
135
135
136
136
@classmethod
137
- def from_name (cls , client : "labelbox.Client" , parent_id : str , name : str ):
137
+ def from_name (cls , client : "labelbox.Client" , parent_id : str , name : str , as_json : bool = False ):
138
138
raise NotImplementedError ("Inheriting class must override" )
139
139
140
140
@property
@@ -225,7 +225,7 @@ def create_from_url(cls, client: "labelbox.Client", model_run_id: str,
225
225
226
226
@classmethod
227
227
def from_name (cls , client : "labelbox.Client" , model_run_id : str ,
228
- name : str ) -> "MEAPredictionImport" :
228
+ name : str , as_json : bool = False ) -> "MEAPredictionImport" :
229
229
"""
230
230
Retrieves an MEA import job.
231
231
@@ -249,7 +249,9 @@ def from_name(cls, client: "labelbox.Client", model_run_id: str,
249
249
if response is None :
250
250
raise labelbox .exceptions .ResourceNotFoundError (
251
251
MEAPredictionImport , params )
252
-
252
+ response = response ["modelErrorAnalysisPredictionImport" ]
253
+ if as_json :
254
+ return response
253
255
return cls (client , response ["modelErrorAnalysisPredictionImport" ])
254
256
255
257
@classmethod
@@ -264,7 +266,7 @@ def _get_url_mutation(cls) -> str:
264
266
265
267
@classmethod
266
268
def _get_file_mutation (cls ) -> str :
267
- return """mutation create%sPyApi ($modelRunId : ID!, $name: String!, $file: Upload!, $contentLength: Int!) {
269
+ return """mutation createMeaPredictionImportPyApi ($modelRunId : ID!, $name: String!, $file: Upload!, $contentLength: Int!) {
268
270
createModelErrorAnalysisPredictionImport(data: {
269
271
modelRunId: $modelRunId name: $name filePayload: { file: $file, contentLength: $contentLength}
270
272
}) {%s}
@@ -377,7 +379,7 @@ def create_from_url(cls, client: "labelbox.Client", project_id: str,
377
379
378
380
@classmethod
379
381
def from_name (cls , client : "labelbox.Client" , project_id : str ,
380
- name : str ) -> "MALPredictionImport" :
382
+ name : str , as_json : bool = False ) -> "MALPredictionImport" :
381
383
"""
382
384
Retrieves an MAL import job.
383
385
@@ -401,12 +403,14 @@ def from_name(cls, client: "labelbox.Client", project_id: str,
401
403
if response is None :
402
404
raise labelbox .exceptions .ResourceNotFoundError (
403
405
MALPredictionImport , params )
404
-
406
+ response = response ["modelAssistedLabelingPredictionImport" ]
407
+ if as_json :
408
+ return response
405
409
return cls (client , response ["modelAssistedLabelingPredictionImport" ])
406
410
407
411
@classmethod
408
412
def _get_url_mutation (cls ) -> str :
409
- return """mutation createMeaPredictionImportPyApi ($projectId : ID!, $name: String!, $fileUrl: String!) {
413
+ return """mutation createMALPredictionImportPyApi ($projectId : ID!, $name: String!, $fileUrl: String!) {
410
414
createModelAssistedLabelingPredictionImport(data: {
411
415
projectId: $projectId
412
416
name: $name
@@ -416,7 +420,7 @@ def _get_url_mutation(cls) -> str:
416
420
417
421
@classmethod
418
422
def _get_file_mutation (cls ) -> str :
419
- return """mutation create%sPyApi ($projectId : ID!, $name: String!, $file: Upload!, $contentLength: Int!) {
423
+ return """mutation createMALPredictionImportPyApi ($projectId : ID!, $name: String!, $file: Upload!, $contentLength: Int!) {
420
424
createModelAssistedLabelingPredictionImport(data: {
421
425
projectId: $projectId name: $name filePayload: { file: $file, contentLength: $contentLength}
422
426
}) {%s}
0 commit comments