◐ Shell
clean mode source ↗

[3.11] gh-85525: Indicate supported sound header formats (GH-21575) by miss-islington · Pull Request #98277 · python/cpython

Expand Up @@ -77,6 +77,7 @@ def whathdr(filename): tests = []
def test_aifc(h, f): """AIFC and AIFF files""" with warnings.catch_warnings(): warnings.simplefilter('ignore', category=DeprecationWarning) import aifc Expand All @@ -100,6 +101,7 @@ def test_aifc(h, f):

def test_au(h, f): """AU and SND files""" if h.startswith(b'.snd'): func = get_long_be elif h[:4] in (b'\0ds.', b'dns.'): Expand Down Expand Up @@ -133,6 +135,7 @@ def test_au(h, f):

def test_hcom(h, f): """HCOM file""" if h[65:69] != b'FSSD' or h[128:132] != b'HCOM': return None divisor = get_long_be(h[144:148]) Expand All @@ -146,6 +149,7 @@ def test_hcom(h, f):

def test_voc(h, f): """VOC file""" if not h.startswith(b'Creative Voice File\032'): return None sbseek = get_short_le(h[20:22]) Expand All @@ -160,6 +164,7 @@ def test_voc(h, f):

def test_wav(h, f): """WAV file""" import wave # 'RIFF' <len> 'WAVE' 'fmt ' <len> if not h.startswith(b'RIFF') or h[8:12] != b'WAVE' or h[12:16] != b'fmt ': Expand All @@ -176,6 +181,7 @@ def test_wav(h, f):

def test_8svx(h, f): """8SVX file""" if not h.startswith(b'FORM') or h[8:12] != b'8SVX': return None # Should decode it to get #channels -- assume always 1 Expand All @@ -185,6 +191,7 @@ def test_8svx(h, f):

def test_sndt(h, f): """SNDT file""" if h.startswith(b'SOUND'): nsamples = get_long_le(h[8:12]) rate = get_short_le(h[20:22]) Expand All @@ -194,6 +201,7 @@ def test_sndt(h, f):

def test_sndr(h, f): """SNDR file""" if h.startswith(b'\0\0'): rate = get_short_le(h[2:4]) if 4000 <= rate <= 25000: Expand Down