Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
452bab4a
Kaydet (Commit)
452bab4a
authored
Kas 16, 2013
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #16685: Added support for writing any bytes-like objects in the aifc,
sunau, and wave modules.
üst
7714ebbe
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
51 additions
and
0 deletions
+51
-0
aifc.rst
Doc/library/aifc.rst
+6
-0
sunau.rst
Doc/library/sunau.rst
+6
-0
wave.rst
Doc/library/wave.rst
+6
-0
aifc.py
Lib/aifc.py
+2
-0
sunau.py
Lib/sunau.py
+2
-0
audiotests.py
Lib/test/audiotests.py
+24
-0
wave.py
Lib/wave.py
+2
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/aifc.rst
Dosyayı görüntüle @
452bab4a
...
...
@@ -225,12 +225,18 @@ number of frames must be filled in.
Write data to the output file. This method can only be called after the audio
file parameters have been set.
.. versionchanged:: 3.4
Any :term:`bytes-like object`\ s are now accepted.
.. method:: aifc.writeframesraw(data)
Like :meth:`writeframes`, except that the header of the audio file is not
updated.
.. versionchanged:: 3.4
Any :term:`bytes-like object`\ s are now accepted.
.. method:: aifc.close()
...
...
Doc/library/sunau.rst
Dosyayı görüntüle @
452bab4a
...
...
@@ -250,11 +250,17 @@ AU_write objects, as returned by :func:`.open` above, have the following methods
Write audio frames, without correcting *nframes*.
.. versionchanged:: 3.4
Any :term:`bytes-like object`\ s are now accepted.
.. method:: AU_write.writeframes(data)
Write audio frames and make sure *nframes* is correct.
.. versionchanged:: 3.4
Any :term:`bytes-like object`\ s are now accepted.
.. method:: AU_write.close()
...
...
Doc/library/wave.rst
Dosyayı görüntüle @
452bab4a
...
...
@@ -208,12 +208,18 @@ Wave_write objects, as returned by :func:`.open`, have the following methods:
Write audio frames, without correcting *nframes*.
.. versionchanged:: 3.4
Any :term:`bytes-like object`\ s are now accepted.
.. method:: Wave_write.writeframes(data)
Write audio frames and make sure *nframes* is correct. Can raise an
exception if a file is not seekable.
.. versionchanged:: 3.4
Any :term:`bytes-like object`\ s are now accepted.
Note that it is invalid to set any parameters after calling :meth:`writeframes`
or :meth:`writeframesraw`, and any attempt to do so will raise
...
...
Lib/aifc.py
Dosyayı görüntüle @
452bab4a
...
...
@@ -692,6 +692,8 @@ class Aifc_write:
return
self
.
_nframeswritten
def
writeframesraw
(
self
,
data
):
if
not
isinstance
(
data
,
(
bytes
,
bytearray
)):
data
=
memoryview
(
data
)
.
cast
(
'B'
)
self
.
_ensure_header_written
(
len
(
data
))
nframes
=
len
(
data
)
//
(
self
.
_sampwidth
*
self
.
_nchannels
)
if
self
.
_convert
:
...
...
Lib/sunau.py
Dosyayı görüntüle @
452bab4a
...
...
@@ -415,6 +415,8 @@ class Au_write:
return
self
.
_nframeswritten
def
writeframesraw
(
self
,
data
):
if
not
isinstance
(
data
,
(
bytes
,
bytearray
)):
data
=
memoryview
(
data
)
.
cast
(
'B'
)
self
.
_ensure_header_written
()
if
self
.
_comptype
==
'ULAW'
:
import
audioop
...
...
Lib/test/audiotests.py
Dosyayı görüntüle @
452bab4a
...
...
@@ -146,6 +146,30 @@ class AudioWriteTests(AudioTests):
self
.
check_file
(
TESTFN
,
self
.
nframes
,
self
.
frames
)
def
test_write_bytearray
(
self
):
f
=
self
.
create_file
(
TESTFN
)
f
.
setnframes
(
self
.
nframes
)
f
.
writeframes
(
bytearray
(
self
.
frames
))
f
.
close
()
self
.
check_file
(
TESTFN
,
self
.
nframes
,
self
.
frames
)
def
test_write_array
(
self
):
f
=
self
.
create_file
(
TESTFN
)
f
.
setnframes
(
self
.
nframes
)
f
.
writeframes
(
array
.
array
(
'h'
,
self
.
frames
))
f
.
close
()
self
.
check_file
(
TESTFN
,
self
.
nframes
,
self
.
frames
)
def
test_write_memoryview
(
self
):
f
=
self
.
create_file
(
TESTFN
)
f
.
setnframes
(
self
.
nframes
)
f
.
writeframes
(
memoryview
(
self
.
frames
))
f
.
close
()
self
.
check_file
(
TESTFN
,
self
.
nframes
,
self
.
frames
)
def
test_incompleted_write
(
self
):
with
open
(
TESTFN
,
'wb'
)
as
testfile
:
testfile
.
write
(
b
'ababagalamaga'
)
...
...
Lib/wave.py
Dosyayı görüntüle @
452bab4a
...
...
@@ -435,6 +435,8 @@ class Wave_write:
return
self
.
_nframeswritten
def
writeframesraw
(
self
,
data
):
if
not
isinstance
(
data
,
(
bytes
,
bytearray
)):
data
=
memoryview
(
data
)
.
cast
(
'B'
)
self
.
_ensure_header_written
(
len
(
data
))
nframes
=
len
(
data
)
//
(
self
.
_sampwidth
*
self
.
_nchannels
)
if
self
.
_convert
:
...
...
Misc/NEWS
Dosyayı görüntüle @
452bab4a
...
...
@@ -47,6 +47,9 @@ Core and Builtins
Library
-------
-
Issue
#
16685
:
Added
support
for
writing
any
bytes
-
like
objects
in
the
aifc
,
sunau
,
and
wave
modules
.
-
Issue
#
5202
:
Added
support
for
unseekable
files
in
the
wave
module
.
-
Issue
#
19544
and
Issue
#
1180
:
Restore
global
option
to
ignore
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment