Skip to content

Commit def8560

Browse files
Remove legacy options
`allow_duplicates` makes less sense when a project can have multiple schemas. While conceptually useful, it will require careful reimplementation. One approach could be calls to `get_label()` passing both name and schema_id. Either way this never really made sense on SDK since we don't enforce it on API side...
1 parent 8bc313c commit def8560

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

sdk/diffgram/label/label_new.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,12 @@
33

44
def label_new(self,
55
label: dict,
6-
schema_id: int = None,
7-
allow_duplicates: bool = False,
8-
print_success: bool = True):
6+
schema_id: int = None):
97
"""
108
119
Arguments
1210
self,
1311
label_list, a list of label strings
14-
ignore_duplicates, bool
15-
print_success, bool
1612
1713
Expects
1814
@@ -29,14 +25,6 @@ def label_new(self,
2925
if not name:
3026
raise Exception("Please provide a key of name with a value of label")
3127
label['schema_id'] = schema_id
32-
if allow_duplicates is False:
33-
34-
label_file_id = self.name_to_file_id.get(name, None)
35-
36-
if label_file_id:
37-
warnings.warn("\n\n '" + name + "' label already exists and was skipped." + \
38-
"\n Set allow_duplicates = True to bypass this check. \n")
39-
return
4028

4129
endpoint = "/api/v1/project/" + self.project_string_id + \
4230
"/label/new"
@@ -46,8 +34,8 @@ def label_new(self,
4634

4735
data = response.json()
4836
self.get_label_file_dict()
37+
4938
if data["log"]["success"] == True:
50-
if print_success is True:
51-
print("New label success")
39+
return
5240
else:
5341
raise Exception(data["log"]["error"])

0 commit comments

Comments
 (0)