Skip to content

Commit 70e2a42

Browse files
gh-102542 Remove unused bytes object and bytes slicing (#106433)
Remove unused bytes object and bytes slicing Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
1 parent 12a9813 commit 70e2a42

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Lib/email/mime/audio.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
__all__ = ['MIMEAudio']
88

9-
from io import BytesIO
109
from email import encoders
1110
from email.mime.nonmultipart import MIMENonMultipart
1211

@@ -59,10 +58,8 @@ def _what(data):
5958
# sndhdr.what() had a pretty cruddy interface, unfortunately. This is why
6059
# we re-do it here. It would be easier to reverse engineer the Unix 'file'
6160
# command and use the standard 'magic' file, as shipped with a modern Unix.
62-
hdr = data[:512]
63-
fakefile = BytesIO(hdr)
6461
for testfn in _rules:
65-
if res := testfn(hdr, fakefile):
62+
if res := testfn(data):
6663
return res
6764
else:
6865
return None
@@ -74,7 +71,7 @@ def rule(rulefunc):
7471

7572

7673
@rule
77-
def _aiff(h, f):
74+
def _aiff(h):
7875
if not h.startswith(b'FORM'):
7976
return None
8077
if h[8:12] in {b'AIFC', b'AIFF'}:
@@ -84,15 +81,15 @@ def _aiff(h, f):
8481

8582

8683
@rule
87-
def _au(h, f):
84+
def _au(h):
8885
if h.startswith(b'.snd'):
8986
return 'basic'
9087
else:
9188
return None
9289

9390

9491
@rule
95-
def _wav(h, f):
92+
def _wav(h):
9693
# 'RIFF' <len> 'WAVE' 'fmt ' <len>
9794
if not h.startswith(b'RIFF') or h[8:12] != b'WAVE' or h[12:16] != b'fmt ':
9895
return None

0 commit comments

Comments
 (0)