Skip to content

Commit 34fe8f3

Browse files
author
Val Brodsky
committed
Add doc strings to Identifiable / Identifiables
1 parent 1eaa730 commit 34fe8f3

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

labelbox/schema/identifiable.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44

55
class Identifiable(ABC):
6+
"""
7+
Base class for any object representing a unique identifier.
8+
"""
69

710
def __init__(self, key: str):
811
self._key = key
@@ -22,8 +25,14 @@ def __str__(self):
2225

2326

2427
class UniqueId(Identifiable):
28+
"""
29+
Represents a unique, internally generated id.
30+
"""
2531
pass
2632

2733

2834
class GlobalKey(Identifiable):
35+
"""
36+
Represents a user generated id.
37+
"""
2938
pass

labelbox/schema/identifiables.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,24 @@
33

44

55
class IdType(str, Enum):
6+
"""
7+
The type of id used to identify a data row.
8+
Currently supported types are:
9+
- DataRowId: The id assigned to a data row by Labelbox.
10+
- GlobalKey: The id assigned to a data row by the user.
11+
"""
612
DataRowId = "UID"
713
GlobalKey = "GLOBAL_KEY"
814

915

1016
class Identifiables:
1117

1218
def __init__(self, iterable, id_type: IdType):
19+
"""
20+
Args:
21+
iterable: Iterable of ids (unique or global keys)
22+
id_type: The type of id used to identify a data row.
23+
"""
1324
self._iterable = iterable
1425
self._index = 0
1526
self._id_type = id_type
@@ -19,12 +30,18 @@ def __iter__(self):
1930

2031

2132
class UniqueIds(Identifiables):
33+
"""
34+
Represents a collection of unique, internally generated ids.
35+
"""
2236

2337
def __init__(self, iterable: List[str]):
2438
super().__init__(iterable, IdType.DataRowId)
2539

2640

2741
class GlobalKeys(Identifiables):
42+
"""
43+
Represents a collection of user generated ids.
44+
"""
2845

2946
def __init__(self, iterable: List[str]):
3047
super().__init__(iterable, IdType.GlobalKey)

0 commit comments

Comments
 (0)