FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-102542 Remove unused bytes object and bytes slicing by JosephSBoyle · Pull Request #106433 · python/cpython · GitHub

/ cpython Public
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
11 changes: 4 additions & 7 deletions Lib/email/mime/audio.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

__all__ = ['MIMEAudio']

from io import BytesIO
from email import encoders
from email.mime.nonmultipart import MIMENonMultipart

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


@rule
def _aiff(h, f):
def _aiff(h):
if not h.startswith(b'FORM'):
return None
if h[8:12] in {b'AIFC', b'AIFF'}:
Expand All @@ -84,15 +81,15 @@ def _aiff(h, f):


@rule
def _au(h, f):
def _au(h):
if h.startswith(b'.snd'):
return 'basic'
else:
return None


@rule
def _wav(h, f):
def _wav(h):
# 'RIFF' <len> 'WAVE' 'fmt ' <len>
if not h.startswith(b'RIFF') or h[8:12] != b'WAVE' or h[12:16] != b'fmt ':
return None
Expand Down

Back | FazBrowse Home | New Git URL