File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 33
44
55class 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
2427class UniqueId (Identifiable ):
28+ """
29+ Represents a unique, internally generated id.
30+ """
2531 pass
2632
2733
2834class GlobalKey (Identifiable ):
35+ """
36+ Represents a user generated id.
37+ """
2938 pass
Original file line number Diff line number Diff line change 33
44
55class 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
1016class 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
2132class 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
2741class 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 )
You can’t perform that action at this time.
0 commit comments