@@ -130,11 +130,11 @@ def refresh(self) -> None:
130130 """Synchronizes values of all fields with the database.
131131 """
132132 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 )
134134 self ._set_field_values (res )
135135
136136 @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 ):
138138 raise NotImplementedError ("Inheriting class must override" )
139139
140140 @property
@@ -225,7 +225,7 @@ def create_from_url(cls, client: "labelbox.Client", model_run_id: str,
225225
226226 @classmethod
227227 def from_name (cls , client : "labelbox.Client" , model_run_id : str ,
228- name : str ) -> "MEAPredictionImport" :
228+ name : str , as_json : bool = False ) -> "MEAPredictionImport" :
229229 """
230230 Retrieves an MEA import job.
231231
@@ -249,7 +249,9 @@ def from_name(cls, client: "labelbox.Client", model_run_id: str,
249249 if response is None :
250250 raise labelbox .exceptions .ResourceNotFoundError (
251251 MEAPredictionImport , params )
252-
252+ response = response ["modelErrorAnalysisPredictionImport" ]
253+ if as_json :
254+ return response
253255 return cls (client , response ["modelErrorAnalysisPredictionImport" ])
254256
255257 @classmethod
@@ -264,7 +266,7 @@ def _get_url_mutation(cls) -> str:
264266
265267 @classmethod
266268 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!) {
268270 createModelErrorAnalysisPredictionImport(data: {
269271 modelRunId: $modelRunId name: $name filePayload: { file: $file, contentLength: $contentLength}
270272 }) {%s}
@@ -377,7 +379,7 @@ def create_from_url(cls, client: "labelbox.Client", project_id: str,
377379
378380 @classmethod
379381 def from_name (cls , client : "labelbox.Client" , project_id : str ,
380- name : str ) -> "MALPredictionImport" :
382+ name : str , as_json : bool = False ) -> "MALPredictionImport" :
381383 """
382384 Retrieves an MAL import job.
383385
@@ -401,12 +403,14 @@ def from_name(cls, client: "labelbox.Client", project_id: str,
401403 if response is None :
402404 raise labelbox .exceptions .ResourceNotFoundError (
403405 MALPredictionImport , params )
404-
406+ response = response ["modelAssistedLabelingPredictionImport" ]
407+ if as_json :
408+ return response
405409 return cls (client , response ["modelAssistedLabelingPredictionImport" ])
406410
407411 @classmethod
408412 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!) {
410414 createModelAssistedLabelingPredictionImport(data: {
411415 projectId: $projectId
412416 name: $name
@@ -416,7 +420,7 @@ def _get_url_mutation(cls) -> str:
416420
417421 @classmethod
418422 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!) {
420424 createModelAssistedLabelingPredictionImport(data: {
421425 projectId: $projectId name: $name filePayload: { file: $file, contentLength: $contentLength}
422426 }) {%s}
0 commit comments