Project Name: smacke+ffsubsync
Language: Python
Statement Type: Constant Assignment

Source Code:
def test_speech_extraction(sample_rate, start_seconds):
    parser = GenericSubtitleParser(start_seconds=start_seconds)
    extractor = SubtitleSpeechTransformer(
        sample_rate=sample_rate, start_seconds=start_seconds
    )
    pipe = make_pipeline(parser, extractor)
    bitstring = pipe.fit_transform(BytesIO(fake_srt)).astype(bool)
    bitstring_shifted_left = np.append(bitstring[1:], [False])
    bitstring_shifted_right = np.append([False], bitstring[:-1])
    bitstring_cumsum = np.cumsum(bitstring)
    consec_ones_end_pos = np.nonzero(
        bitstring_cumsum
        * (bitstring ^ bitstring_shifted_left)
        * (bitstring_cumsum != np.cumsum(bitstring_shifted_right))
    )[0]
    prev = 0
    for pos, sub in zip(consec_ones_end_pos, parser.subs_):
        start = int(round(sub.start.total_seconds() * sample_rate))
        duration = sub.end.total_seconds() - sub.start.total_seconds()
        stop = start + int(round(duration * sample_rate))
        assert bitstring_cumsum[pos] - prev == stop - start
        prev = bitstring_cumsum[pos]

test_speech_extraction(sample_rate=10, start_seconds=0)

Selected Statement: prev = 0

Function Input:
sample_rate: 10
start_seconds: 0

Variable Values Before Statement:
Constant: 0

Value After Statement Execution: 0

Variable States During Runtime (line, value):
sample_rate: 1
10
start_seconds: 1
0
parser: 2
{subs_=None, sub_format='srt', encoding='infer', caching=False, fit_fname=None, detected_encoding_=None, max_subtitle_seconds=None, start_seconds=0, _skip_ssa_info=False, _strict=False}
7
{subs_=<ffsubsync.generic_subtitles.GenericSubtitlesFile object at 0x7fb01543e5e0>, sub_format='srt', encoding='infer', caching=False, fit_fname=<_io.BytesIO object at 0x7fb014da3310>, detected_encoding_='ASCII', max_subtitle_seconds=None, start_seconds=0, _skip_ssa_info=False, _strict=False}
extractor: 3
{sample_rate=10, start_seconds=0, framerate_ratio=1.0, subtitle_speech_results_=None, max_time_=None}
7
{sample_rate=10, start_seconds=0, framerate_ratio=1.0, subtitle_speech_results_=array([0., 0., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,       1., 1., 1., 1., 1., 1., 1., 0., 0., 0., 0., 1., 1., 1., 1., 1., 1.,       1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 0., 0., 1., 1., 1., 1.,       1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 0.]), max_time_=6.062, start_frame_=2, end_frame_=60}
pipe: 6
{steps=[('genericsubtitleparser', <ffsubsync.subtitle_parser.GenericSubtitleParser object at 0x7fb01543ef40>), ('subtitlespeechtransformer', <ffsubsync.speech_transformers.SubtitleSpeechTransformer object at 0x7fb01543e6a0>)], verbose=False}
bitstring: 7
array([False, False,  True,  True,  True,  True,  True,  True,  True,        True,  True,  True,  True,  True,  True,  True,  True,  True,        True,  True,  True,  True,  True,  True, False, False, False,       False,  True,  True,  True,  True,  True,  True,  True,  True,        True,  True,  True,  True,  True,  True,  True,  True,  True,       False, False,  True,  True,  True,  True,  True,  True,  True,        True,  True,  True,  True,  True,  True,  True, False])
bitstring_shifted_left: 8
array([False,  True,  True,  True,  True,  True,  True,  True,  True,        True,  True,  True,  True,  True,  True,  True,  True,  True,        True,  True,  True,  True,  True, False, False, False, False,        True,  True,  True,  True,  True,  True,  True,  True,  True,        True,  True,  True,  True,  True,  True,  True,  True, False,       False,  True,  True,  True,  True,  True,  True,  True,  True,        True,  True,  True,  True,  True,  True, False, False])
bitstring_shifted_right: 9
array([False, False, False,  True,  True,  True,  True,  True,  True,        True,  True,  True,  True,  True,  True,  True,  True,  True,        True,  True,  True,  True,  True,  True,  True, False, False,       False, False,  True,  True,  True,  True,  True,  True,  True,        True,  True,  True,  True,  True,  True,  True,  True,  True,        True, False, False,  True,  True,  True,  True,  True,  True,        True,  True,  True,  True,  True,  True,  True,  True])
bitstring_cumsum: 10
array([ 0,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,       16, 17, 18, 19, 20, 21, 22, 22, 22, 22, 22, 23, 24, 25, 26, 27, 28,       29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 39, 39, 40, 41, 42, 43,       44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 53])
consec_ones_end_pos: 11
array([23, 44, 60])
prev: 16
0
22
22
22
39
22
53
pos: 17
23
17
44
17
60
sub: 17
{start=datetime.timedelta(microseconds=178000), end=datetime.timedelta(seconds=2, microseconds=416000), inner=Subtitle(index=1, start=datetime.timedelta(microseconds=178000), end=datetime.timedelta(seconds=2, microseconds=416000), content='<i>Previously on "Your favorite TV show..."</i>', proprietary='')}
17
{start=datetime.timedelta(seconds=2, microseconds=828000), end=datetime.timedelta(seconds=4, microseconds=549000), inner=Subtitle(index=2, start=datetime.timedelta(seconds=2, microseconds=828000), end=datetime.timedelta(seconds=4, microseconds=549000), content='Oh hi, Mark.', proprietary='')}
17
{start=datetime.timedelta(seconds=4, microseconds=653000), end=datetime.timedelta(seconds=6, microseconds=62000), inner=Subtitle(index=3, start=datetime.timedelta(seconds=4, microseconds=653000), end=datetime.timedelta(seconds=6, microseconds=62000), content='You are tearing me apart, Lisa!', proprietary='')}
start: 18
2
18
28
18
47
duration: 19
2.238
19
1.7210000000000005
19
1.4090000000000007
stop: 20
24
20
45
20
61
@py_assert0: 21
None
@py_assert3: 21
None
@py_assert7: 21
None
@py_assert4: 21
None