Skip to content

Commit

Permalink
fix bug in 'UserInput' (not recognizing 'YES' answer)
Browse files Browse the repository at this point in the history
  • Loading branch information
sirfoga committed Nov 19, 2017
1 parent f6450b2 commit 56c372d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ All notable changes to this project will be documented in this file.
- `write_dicts_to_json`
- `JSONParser`

### Fixed
- bug in `UserInput` (not recognizing `YES` answer)

### 4.7.6 - 2017-10-29

### Added
Expand Down
10 changes: 5 additions & 5 deletions hal/streams/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def is_yes(self, answer):
True iff considered a "yes" answer
"""

yes_sim, = get_max_similar(answer, self.YES)
no_sim, = get_max_similar(answer, self.NO)
yes_sim, _ = get_max_similar(answer, self.YES)
no_sim, _ = get_max_similar(answer, self.NO)
return yes_sim > no_sim and yes_sim > self.THRESHOLD_INPUT

def is_no(self, answer):
Expand All @@ -69,8 +69,8 @@ def is_no(self, answer):
True iff considered a "yes" answer
"""

yes_sim, = get_max_similar(answer, self.YES)
no_sim, = get_max_similar(answer, self.NO)
yes_sim, _ = get_max_similar(answer, self.YES)
no_sim, _ = get_max_similar(answer, self.NO)
return no_sim > yes_sim and no_sim > self.THRESHOLD_INPUT

def show_help(self):
Expand Down Expand Up @@ -133,7 +133,7 @@ def get_yes_no(self, question):

if self.interactive:
self.show_help()
self.get_yes_no(self.last_question)
return self.get_yes_no(self.last_question)
else:
return False

Expand Down

0 comments on commit 56c372d

Please sign in to comment.