08b4da65487aa15bb427c475b33b71a3277d0d7b,speech/grpc/transcribe_streaming.py,,_audio_data_generator,#Any#,67

Before Change


    while True:
        // Use a blocking get() to ensure there"s at least one chunk of data
        chunk = buff.get()
        if not chunk:
            // A falsey value indicates the stream is closed.
            break
        data = [chunk]

        // Now consume whatever other data"s still buffered.
        while True:

After Change


        The function will block until at least one data chunk is available.
    
    stop = False
    while not stop:
        // Use a blocking get() to ensure there"s at least one chunk of data.
        chunk = buff.get()
        data = [chunk]

        // Now consume whatever other data"s still buffered.
        while True:
            try:
                data.append(buff.get(block=False))
            except queue.Empty:
                break

        // If `_fill_buffer` adds `None` to the buffer, the audio stream is
        // closed. Yield the final bit of the buffer and exit the loop.
        if None in data:
            stop = True
            data.remove(None)
        yield b"".join(data)


def _fill_buffer(audio_stream, buff, chunk, stoprequest):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 08b4da65487aa15bb427c475b33b71a3277d0d7b
Time: 2016-11-07
Author: puneith@users.noreply.github.com
File Name: speech/grpc/transcribe_streaming.py
Class Name:
Method Name: _audio_data_generator


Project Name: vatlab/SoS
Commit Name: 9e805c5f17d868a9d2a266e96600cfdbdee9dbfa
Time: 2017-04-07
Author: ben.bog@gmail.com
File Name: sos/sos_executor.py
Class Name: Base_Executor
Method Name: run


Project Name: vatlab/SoS
Commit Name: ecb620b20567af3a5cbc1a29f8938335e66aa669
Time: 2017-04-08
Author: ben.bog@gmail.com
File Name: sos/sos_executor.py
Class Name: Base_Executor
Method Name: run