Skip to content

Commit c0902ec

Browse files
committed
feat: add some type inference for consumers
1 parent c988e48 commit c0902ec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

speech_recognition/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def record(self, source, duration=None, offset=None):
363363
frames.close()
364364
return AudioData(frame_data, source.SAMPLE_RATE, source.SAMPLE_WIDTH)
365365

366-
def adjust_for_ambient_noise(self, source, duration=1):
366+
def adjust_for_ambient_noise(self, source: AudioSource, duration=1):
367367
"""
368368
Adjusts the energy threshold dynamically using audio from ``source`` (an ``AudioSource`` instance) to account for ambient noise.
369369
@@ -439,7 +439,7 @@ def snowboy_wait_for_hot_word(self, snowboy_location, snowboy_hot_word_files, so
439439

440440
return b"".join(frames), elapsed_time
441441

442-
def listen(self, source, timeout=None, phrase_time_limit=None, snowboy_configuration=None, stream=False):
442+
def listen(self, source: AudioSource, timeout=None, phrase_time_limit=None, snowboy_configuration=None, stream=False):
443443
"""
444444
Records a single phrase from ``source`` (an ``AudioSource`` instance) into an ``AudioData`` instance, which it returns.
445445

0 commit comments

Comments
 (0)