Skip to content

Commit

Permalink
Limit lines in snowboythreaded.py to 80 chars and rename stop_recog t…
Browse files Browse the repository at this point in the history
…o pause_recog
  • Loading branch information
rohantib committed Jul 28, 2017
1 parent a1fd627 commit 29b9d05
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions examples/Python/snowboythreaded.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class ThreadedDetector(threading.Thread):

def __init__(self, models, **kwargs):
"""
Initialize Detectors object. **kwargs is for any __init__ keyword arguments to be passed into HotWordDetector
__init__() method.
Initialize Detectors object. **kwargs is for any __init__ keyword
arguments to be passed into HotWordDetector __init__() method.
"""
threading.Thread.__init__(self)
self.models = models
Expand All @@ -31,7 +31,8 @@ def initialize_detectors(self):

def run(self):
"""
Runs in separate thread - waits on command to either run detectors or terminate thread from commands queue
Runs in separate thread - waits on command to either run detectors
or terminate thread from commands queue
"""
try:
while True:
Expand All @@ -55,15 +56,16 @@ def run(self):

def start_recog(self, **kwargs):
"""
Starts recognition in thread. Accepts kwargs to pass into the HotWordDetector.start() method, but
does not accept interrupt_callback, as that is already set up.
Starts recognition in thread. Accepts kwargs to pass into the
HotWordDetector.start() method, but does not accept interrupt_callback,
as that is already set up.
"""
assert "interrupt_check" not in kwargs, \
"Cannot set interrupt_check argument. To interrupt detectors, use Detectors.stop_recog() instead"
self.run_kwargs = kwargs
self.commands.put("Start")

def stop_recog(self):
def pause_recog(self):
"""
Halts recognition in thread.
"""
Expand Down

0 comments on commit 29b9d05

Please sign in to comment.