Skip to content

Commit

Permalink
Save phrases in tuple instead of list
Browse files Browse the repository at this point in the history
  • Loading branch information
Aculeasis committed Jan 16, 2019
1 parent 3758731 commit b300923
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/modules_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,10 @@ def wrap(f):
return wrap


def list_to_tuple(data: list) -> tuple:
return tuple(key if not isinstance(key, list) else list_to_tuple(key) for key in data)


def parse_phrases(name, phrases):
if isinstance(phrases, str) or \
(isinstance(phrases, (tuple, list)) and len(phrases) == 2 and phrases[1] in ALL_COMPARE_MODES):
Expand All @@ -549,4 +553,4 @@ def parse_phrases(name, phrases):
phrases[idx][0] = phrases[idx][0].lower()
else:
raise RuntimeError('Bad word \'{}\' from \'{}\''.format(phrases[idx], name))
return phrases
return list_to_tuple(phrases)

0 comments on commit b300923

Please sign in to comment.