|
14 | 14 | Union, |
15 | 15 | cast, |
16 | 16 | ) |
| 17 | +import warnings |
17 | 18 |
|
18 | 19 | import requests |
19 | 20 | from google.api_core import retry |
@@ -72,7 +73,7 @@ def errors(self) -> List[Dict[str, Any]]: |
72 | 73 | See `AnnotationImport.statuses` for more details. |
73 | 74 | * This information will expire after 24 hours. |
74 | 75 | """ |
75 | | - self.wait_until_done() |
| 76 | + self.wait_till_done() |
76 | 77 | return self._fetch_remote_ndjson(self.error_file_url) |
77 | 78 |
|
78 | 79 | @property |
@@ -101,15 +102,20 @@ def statuses(self) -> List[Dict[str, Any]]: |
101 | 102 |
|
102 | 103 | * This information will expire after 24 hours. |
103 | 104 | """ |
104 | | - self.wait_until_done() |
| 105 | + self.wait_till_done() |
105 | 106 | return self._fetch_remote_ndjson(self.status_file_url) |
106 | 107 |
|
107 | | - def wait_till_done( |
| 108 | + def wait_until_done( |
108 | 109 | self, sleep_time_seconds: int = 10, show_progress: bool = False |
109 | 110 | ) -> None: |
110 | | - self.wait_until_done(sleep_time_seconds, show_progress) |
| 111 | + warnings.warn( |
| 112 | + "The method wait_until_done for AnnotationImport is deprecated and will be removed in the next major release. Use the wait_till_done method instead.", |
| 113 | + DeprecationWarning, |
| 114 | + stacklevel=2, |
| 115 | + ) |
| 116 | + self.wait_till_done(sleep_time_seconds, show_progress) |
111 | 117 |
|
112 | | - def wait_until_done( |
| 118 | + def wait_till_done( |
113 | 119 | self, sleep_time_seconds: int = 10, show_progress: bool = False |
114 | 120 | ) -> None: |
115 | 121 | """Blocks import job until certain conditions are met. |
@@ -587,6 +593,20 @@ def parent_id(self) -> str: |
587 | 593 | """ |
588 | 594 | return self.project().uid |
589 | 595 |
|
| 596 | + def delete(self) -> None: |
| 597 | + """ |
| 598 | + Deletes a MALPredictionImport job |
| 599 | + """ |
| 600 | + |
| 601 | + query_string = """ |
| 602 | + mutation deleteModelAssistedLabelingPredictionImportPyApi($id: ID!) { |
| 603 | + deleteModelAssistedLabelingPredictionImport(where: { id: $id }) { |
| 604 | + id |
| 605 | + } |
| 606 | + } |
| 607 | + """ |
| 608 | + self.client.execute(query_string, {"id": self.uid}) |
| 609 | + |
590 | 610 | @classmethod |
591 | 611 | def create_from_file( |
592 | 612 | cls, client: "labelbox.Client", project_id: str, name: str, path: str |
|
0 commit comments