From dc1e9dfd3966ad25f4fc3ffb2a65541ece7067f2 Mon Sep 17 00:00:00 2001 From: David Conway Date: Sun, 1 Nov 2015 20:42:51 -0500 Subject: [PATCH] refs #121, renamed functions for clarity --- caster/lib/dfplus/additions.py | 2 +- caster/lib/dfplus/state/actions2.py | 2 +- caster/lib/navigation.py | 22 +++++++++------------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/caster/lib/dfplus/additions.py b/caster/lib/dfplus/additions.py index 3b91e4007..b9e847952 100644 --- a/caster/lib/dfplus/additions.py +++ b/caster/lib/dfplus/additions.py @@ -33,7 +33,7 @@ class IntegerContentST(IntegerContentBase): builders = [int_0, int_1_9, int_10_19, int_20_99, int_100s, int_100big, int_1000s, int_1000000s] if "en" in language.language_map and settings.SETTINGS["miscellaneous"]["integer_remap_opt_in"]: - mapping = navigation.strange_numbers_map() + mapping = navigation.numbers_map_1_to_9() IntegerContentST.builders[1] = MapIntBuilder(mapping) INTEGER_CONTENT = IntegerContentST diff --git a/caster/lib/dfplus/state/actions2.py b/caster/lib/dfplus/state/actions2.py index c5d0198d5..01be646e9 100644 --- a/caster/lib/dfplus/state/actions2.py +++ b/caster/lib/dfplus/state/actions2.py @@ -101,7 +101,7 @@ class FuzzyMatchAction(ContextSeeker): default_1: speaking a next command other than a number or cancel activates the first choice in the list ; ''' - TEN = ["numb "+x for x in navigation.strange_numbers_list()+["ten"]] + TEN = ["numb "+x for x in navigation.numbers_list_1_to_9()+["ten"]] def __init__(self, list_function, filter_function, selection_function, default_1=True, rspec="default", rdescript="unnamed command (FM)"): def get_choices(data): choices = list_function() diff --git a/caster/lib/navigation.py b/caster/lib/navigation.py index c58479b1a..3954eab04 100644 --- a/caster/lib/navigation.py +++ b/caster/lib/navigation.py @@ -79,19 +79,7 @@ def word_number(wn): } Text(numbers_to_words[int(wn)]).execute() -def strange_numbers_map(): - return { - "one": 1, - "torque": 2, - "traio": 3, - "fairn": 4, - "faif": 5, - "six": 6, - "seven": 7, - "eigen": 8, - "nine": 9, - } -def strange_numbers_list(): +def numbers_list_1_to_9(): result=["one", "torque", "traio", @@ -109,6 +97,14 @@ def strange_numbers_list(): result[7]="eight" return result +def numbers_map_1_to_9(): + result = {} + l = numbers_list_1_to_9() + for i in range(0, 9): + result[l[i]] = i+1 + return result + + def numbers2(wnKK): Text(str(wnKK)).execute()