Skip to content

Commit a058022

Browse files
authored
Merge pull request #317 from Labelbox/ms/update-experimental
update experimental functions
2 parents 5e92625 + 23efa3d commit a058022

File tree

4 files changed

+22
-25
lines changed

4 files changed

+22
-25
lines changed

labelbox/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ def __init__(self,
7878

7979
logger.info("Initializing Labelbox client at '%s'", endpoint)
8080
self.app_url = app_url
81-
82-
# TODO: Make endpoints non-internal or support them as experimental
83-
self.endpoint = endpoint.replace('/graphql', '/_gql')
81+
self.endpoint = endpoint
8482
self.headers = {
8583
'Accept': 'application/json',
8684
'Content-Type': 'application/json',
@@ -149,9 +147,11 @@ def convert_value(value):
149147
elif data is None:
150148
raise ValueError("query and data cannot both be none")
151149

150+
endpoint = self.endpoint if not experimental else self.endpoint.replace(
151+
"/graphql", "/_gql")
152152
try:
153153
request = {
154-
'url': self.endpoint,
154+
'url': endpoint,
155155
'data': data,
156156
'headers': self.headers,
157157
'timeout': timeout

labelbox/schema/organization.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def __init__(self, *args, **kwargs):
4242
projects = Relationship.ToMany("Project", True)
4343
webhooks = Relationship.ToMany("Webhook", False)
4444

45-
@experimental
4645
def invite_user(
4746
self,
4847
email: str,
@@ -83,22 +82,21 @@ def invite_user(
8382
"projectRoleId": project_role.role.uid
8483
} for project_role in project_roles or []]
8584

86-
res = self.client.execute(query_str, {
87-
data_param: [{
88-
"inviterId": self.client.get_user().uid,
89-
"inviteeEmail": email,
90-
"organizationId": self.uid,
91-
"organizationRoleId": role.uid,
92-
"projects": projects
93-
}]
94-
},
95-
experimental=True)
85+
res = self.client.execute(
86+
query_str, {
87+
data_param: [{
88+
"inviterId": self.client.get_user().uid,
89+
"inviteeEmail": email,
90+
"organizationId": self.uid,
91+
"organizationRoleId": role.uid,
92+
"projects": projects
93+
}]
94+
})
9695
invite_response = res['createInvites'][0]['invite']
9796
if not invite_response:
9897
raise LabelboxError(f"Unable to send invite for email {email}")
9998
return Invite(self.client, invite_response)
10099

101-
@experimental
102100
def invite_limit(self) -> InviteLimit:
103101
""" Retrieve invite limits for the org
104102
This already accounts for users currently in the org
@@ -109,10 +107,10 @@ def invite_limit(self) -> InviteLimit:
109107
110108
"""
111109
org_id_param = "organizationId"
112-
res = self.client.execute("""query InvitesLimitPyApi($%s: ID!) {
110+
res = self.client.execute(
111+
"""query InvitesLimitPyApi($%s: ID!) {
113112
invitesLimit(where: {id: $%s}) { used limit remaining }
114-
}""" % (org_id_param, org_id_param), {org_id_param: self.uid},
115-
experimental=True)
113+
}""" % (org_id_param, org_id_param), {org_id_param: self.uid})
116114
return InviteLimit(
117115
**{utils.snake_case(k): v for k, v in res['invitesLimit'].items()})
118116

tests/integration/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ def __init__(self, environ: str) -> None:
118118
api_url = graphql_url(environ)
119119
api_key = testing_api_key(environ)
120120
super().__init__(api_key, api_url, enable_experimental=True)
121-
122121
self.queries = []
123122

124123
def execute(self, query=None, params=None, check_naming=True, **kwargs):
@@ -223,9 +222,10 @@ def label_pack(project, rand_gen, image_url):
223222

224223
@pytest.fixture
225224
def iframe_url(environ) -> str:
226-
if environ == Environ.PROD:
225+
if environ in [Environ.PROD, Environ.LOCAL]:
227226
return 'https://editor.labelbox.com'
228-
return 'https://staging.labelbox.dev/editor'
227+
elif environ == Environ.STAGING:
228+
return 'https://staging.labelbox.dev/editor'
229229

230230

231231
@pytest.fixture

tests/integration/test_user_management.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ def test_org_invite(client, organization, environ, queries):
1010
if environ.value == "prod":
1111
assert invite_limit.remaining > 0, "No invites available for the account associated with this key."
1212
elif environ.value != "staging":
13-
raise ValueError(
14-
f"Expected tests to run against either prod or staging. Found {environ}"
15-
)
13+
# Cannot run against local
14+
return
1615

1716
invite = organization.invite_user(dummy_email, role)
1817

0 commit comments

Comments
 (0)