File tree 1 file changed +4
-7
lines changed
1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 6
6
7
7
__all__ = ['MIMEAudio' ]
8
8
9
- from io import BytesIO
10
9
from email import encoders
11
10
from email .mime .nonmultipart import MIMENonMultipart
12
11
@@ -59,10 +58,8 @@ def _what(data):
59
58
# sndhdr.what() had a pretty cruddy interface, unfortunately. This is why
60
59
# we re-do it here. It would be easier to reverse engineer the Unix 'file'
61
60
# command and use the standard 'magic' file, as shipped with a modern Unix.
62
- hdr = data [:512 ]
63
- fakefile = BytesIO (hdr )
64
61
for testfn in _rules :
65
- if res := testfn (hdr , fakefile ):
62
+ if res := testfn (data ):
66
63
return res
67
64
else :
68
65
return None
@@ -74,7 +71,7 @@ def rule(rulefunc):
74
71
75
72
76
73
@rule
77
- def _aiff (h , f ):
74
+ def _aiff (h ):
78
75
if not h .startswith (b'FORM' ):
79
76
return None
80
77
if h [8 :12 ] in {b'AIFC' , b'AIFF' }:
@@ -84,15 +81,15 @@ def _aiff(h, f):
84
81
85
82
86
83
@rule
87
- def _au (h , f ):
84
+ def _au (h ):
88
85
if h .startswith (b'.snd' ):
89
86
return 'basic'
90
87
else :
91
88
return None
92
89
93
90
94
91
@rule
95
- def _wav (h , f ):
92
+ def _wav (h ):
96
93
# 'RIFF' <len> 'WAVE' 'fmt ' <len>
97
94
if not h .startswith (b'RIFF' ) or h [8 :12 ] != b'WAVE' or h [12 :16 ] != b'fmt ' :
98
95
return None
You can’t perform that action at this time.
0 commit comments