Skip to content

Commit 0fbf8e1

Browse files
author
Matt Sokoloff
committed
recommended changes
1 parent dd8f18b commit 0fbf8e1

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

labelbox/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __init__(self,
5050
Args:
5151
api_key (str): API key. If None, the key is obtained from the "LABELBOX_API_KEY" environment variable.
5252
endpoint (str): URL of the Labelbox server to connect to.
53-
enable_experimental (bool): Indicated whether or not to use experimental features
53+
enable_experimental (bool): Indicates whether or not to use experimental features
5454
Raises:
5555
labelbox.exceptions.AuthenticationError: If no `api_key`
5656
is provided as an argument or via the environment

labelbox/schema/invite.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class Invite(DbObject):
2727
email = Field.String("email", "inviteeEmail")
2828

2929
def __init__(self, client, invite_response):
30-
#invite_response.get('inviter')
3130
project_roles = invite_response.pop("projectInvites", [])
3231
super().__init__(client, invite_response)
3332

labelbox/schema/organization.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
from labelbox.schema.invite import Invite, InviteLimit, ProjectRole
88
from labelbox.schema.user import User
99
from labelbox.schema.role import Role
10-
import logging
11-
12-
logger = logging.getLogger(__name__)
1310

1411

1512
class Organization(DbObject):
@@ -64,8 +61,8 @@ def invite_user(
6461
6562
Notes:
6663
This function is currently experimental and has a few limitations that will be resolved in future releases
67-
1. There is a really unclear foreign key error if you use an unsupported role.
68-
- This means that the `Roles` object is not getting the right ids
64+
1. If you try to add an unsupported you will get an error referring to invalid foreign keys
65+
- In this case `role.get_roles` is likely not getting the right ids
6966
2. Multiple invites can be sent for the same email. This can only be resolved in the UI for now.
7067
- Future releases of the SDK will support the ability to query and revoke invites to solve this problem (and/or checking on the backend)
7168
3. Some server side response are unclear (e.g. if the user invites themself `None` is returned which the SDK raises as a `LabelboxError` )

labelbox/schema/role.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
from dataclasses import dataclass
2+
from typing import Dict, Optional, TYPE_CHECKING
23

34
from labelbox.orm.model import Field
45
from labelbox.orm.db_object import DbObject
56
from labelbox.schema.project import Project
67

7-
_ROLES = None
8+
if TYPE_CHECKING:
9+
from labelbox import Client
810

11+
_ROLES: Optional[Dict[str, "Role"]] = None
912

10-
def get_roles(client):
13+
14+
def get_roles(client: "Client") -> Dict[str, "Role"]:
1115
global _ROLES
1216
if _ROLES is None:
1317
query_str = """query GetAvailableUserRolesPyApi { roles { id name } }"""

0 commit comments

Comments
 (0)