Skip to content

Commit

Permalink
Detect duplicates in label list
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Feb 12, 2019
1 parent c3cc420 commit 73d044d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions labelme/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,14 @@ def get_default_config():

def validate_config_item(key, value):
if key == 'validate_label' and value not in [None, 'exact', 'instance']:
raise ValueError('Unexpected value `{}` for key `{}`'
.format(value, key))
raise ValueError(
"Unexpected value for config key 'validate_label': {}"
.format(value)
)
if key == 'labels' and value is not None and len(value) != len(set(value)):
raise ValueError(
"Duplicates are detected for config key 'labels': {}".format(value)
)


def get_config(config_from_args=None, config_file=None):
Expand Down

0 comments on commit 73d044d

Please sign in to comment.