Skip to content

Commit 9a956c2

Browse files
author
Val Brodsky
committed
Use _create_project(), not create_project() for create_offline_model_evaluation_project
Fixing a typo
1 parent 8de0aea commit 9a956c2

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

libs/labelbox/src/labelbox/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ def create_offline_model_evaluation_project(self, **kwargs) -> Project:
839839
kwargs.pop("append_to_existing_dataset", None)
840840
kwargs.pop("data_row_count", None)
841841

842-
return self.create_project(**kwargs)
842+
return self._create_project(**kwargs)
843843

844844
def _create_project(self, **kwargs) -> Project:
845845
auto_audit_percentage = kwargs.get("auto_audit_percentage")

libs/labelbox/src/labelbox/exceptions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ class ProcessingWaitTimeout(Exception):
153153

154154

155155
def _error_message_for_unparsed_graphql_error(error_string: str) -> str:
156+
"""
157+
Since our client only parses certain graphql errors, this function is used to
158+
extract the error message from the error string when the error is not
159+
parsed by the client.
160+
"""
156161
# Regex to find the message content
157162
pattern = r"'message': '([^']+)'"
158163
# Search for the pattern in the error string
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import pytest
2+
3+
from labelbox.exceptions import _error_message_for_unparsed_graphql_error
4+
5+
6+
@pytest.mark.parametrize('exception_message, expected_result', [
7+
("Unparsed errors on query execution: [{'message': 'Cannot create model config for project because model setup is complete'",
8+
"Cannot create model config for project because model setup is complete"),
9+
("blah blah blah", "Unknown error"),
10+
])
11+
def test_client_unparsed_exception_messages(exception_message, expected_result):
12+
assert _error_message_for_unparsed_graphql_error(
13+
exception_message) == expected_result

0 commit comments

Comments
 (0)