summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-05-24 09:32:18 (GMT)
committerGitHub <noreply@github.com>2023-05-24 09:32:18 (GMT)
commit7b00940f69ab26212ea375860a1956e157dd2c30 (patch)
treecb879b99dd188e65617e97a5f8f30101a20e57d5 /Doc
parent08d592389603500af398d278af4842cff6f22c33 (diff)
downloadcpython-7b00940f69ab26212ea375860a1956e157dd2c30.zip
cpython-7b00940f69ab26212ea375860a1956e157dd2c30.tar.gz
cpython-7b00940f69ab26212ea375860a1956e157dd2c30.tar.bz2
gh-104773: PEP 594: Remove the sndhdr module (#104774)
Remove the Lib/test/sndhdrdata/ directory.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/sndhdr.rst104
-rw-r--r--Doc/library/superseded.rst1
-rw-r--r--Doc/whatsnew/3.11.rst2
-rw-r--r--Doc/whatsnew/3.12.rst2
-rw-r--r--Doc/whatsnew/3.13.rst6
5 files changed, 8 insertions, 107 deletions
diff --git a/Doc/library/sndhdr.rst b/Doc/library/sndhdr.rst
deleted file mode 100644
index fa9323e..0000000
--- a/Doc/library/sndhdr.rst
+++ /dev/null
@@ -1,104 +0,0 @@
-:mod:`sndhdr` --- Determine type of sound file
-==============================================
-
-.. module:: sndhdr
- :synopsis: Determine type of a sound file.
- :deprecated:
-
-.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
-.. Based on comments in the module source file.
-
-**Source code:** :source:`Lib/sndhdr.py`
-
-.. index::
- single: A-LAW
- single: u-LAW
-
-.. deprecated-removed:: 3.11 3.13
- The :mod:`sndhdr` module is deprecated
- (see :pep:`PEP 594 <594#sndhdr>` for details and alternatives).
-
---------------
-
-The :mod:`sndhdr` provides utility functions which attempt to determine the type
-of sound data which is in a file. When these functions are able to determine
-what type of sound data is stored in a file, they return a
-:func:`~collections.namedtuple`, containing five attributes: (``filetype``,
-``framerate``, ``nchannels``, ``nframes``, ``sampwidth``). The value for *type*
-indicates the data type and will be one of the strings ``'aifc'``, ``'aiff'``,
-``'au'``, ``'hcom'``, ``'sndr'``, ``'sndt'``, ``'voc'``, ``'wav'``, ``'8svx'``,
-``'sb'``, ``'ub'``, or ``'ul'``. The *sampling_rate* will be either the actual
-value or ``0`` if unknown or difficult to decode. Similarly, *channels* will be
-either the number of channels or ``0`` if it cannot be determined or if the
-value is difficult to decode. The value for *frames* will be either the number
-of frames or ``-1``. The last item in the tuple, *bits_per_sample*, will either
-be the sample size in bits or ``'A'`` for A-LAW or ``'U'`` for u-LAW.
-
-
-.. function:: what(filename)
-
- Determines the type of sound data stored in the file *filename* using
- :func:`whathdr`. If it succeeds, returns a namedtuple as described above, otherwise
- ``None`` is returned.
-
- .. versionchanged:: 3.5
- Result changed from a tuple to a namedtuple.
-
-
-.. function:: whathdr(filename)
-
- Determines the type of sound data stored in a file based on the file header.
- The name of the file is given by *filename*. This function returns a namedtuple as
- described above on success, or ``None``.
-
- .. versionchanged:: 3.5
- Result changed from a tuple to a namedtuple.
-
-The following sound header types are recognized, as listed below with the return value
-from :func:`whathdr`: and :func:`what`:
-
-+------------+------------------------------------+
-| Value | Sound header format |
-+============+====================================+
-| ``'aifc'`` | Compressed Audio Interchange Files |
-+------------+------------------------------------+
-| ``'aiff'`` | Audio Interchange Files |
-+------------+------------------------------------+
-| ``'au'`` | Au Files |
-+------------+------------------------------------+
-| ``'hcom'`` | HCOM Files |
-+------------+------------------------------------+
-| ``'sndt'`` | Sndtool Sound Files |
-+------------+------------------------------------+
-| ``'voc'`` | Creative Labs Audio Files |
-+------------+------------------------------------+
-| ``'wav'`` | Waveform Audio File Format Files |
-+------------+------------------------------------+
-| ``'8svx'`` | 8-Bit Sampled Voice Files |
-+------------+------------------------------------+
-| ``'sb'`` | Signed Byte Audio Data Files |
-+------------+------------------------------------+
-| ``'ub'`` | UB Files |
-+------------+------------------------------------+
-| ``'ul'`` | uLAW Audio Files |
-+------------+------------------------------------+
-
-.. data:: tests
-
- A list of functions performing the individual tests. Each function takes two
- arguments: the byte-stream and an open file-like object. When :func:`what` is
- called with a byte-stream, the file-like object will be ``None``.
-
- The test function should return a string describing the image type if the test
- succeeded, or ``None`` if it failed.
-
-Example:
-
-.. code-block:: pycon
-
- >>> import sndhdr
- >>> imghdr.what('bass.wav')
- 'wav'
- >>> imghdr.whathdr('bass.wav')
- 'wav'
-
diff --git a/Doc/library/superseded.rst b/Doc/library/superseded.rst
index a96d042..cad4e9c 100644
--- a/Doc/library/superseded.rst
+++ b/Doc/library/superseded.rst
@@ -22,7 +22,6 @@ backwards compatibility. They have been superseded by other modules.
optparse.rst
ossaudiodev.rst
pipes.rst
- sndhdr.rst
spwd.rst
sunau.rst
uu.rst
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index d024b85..4ad6846 100644
--- a/Doc/whatsnew/3.11.rst
+++ b/Doc/whatsnew/3.11.rst
@@ -1733,7 +1733,7 @@ Modules
+---------------------+---------------------+---------------------+---------------------+---------------------+
| :mod:`aifc` | :mod:`chunk` | :mod:`msilib` | :mod:`pipes` | :mod:`!telnetlib` |
+---------------------+---------------------+---------------------+---------------------+---------------------+
- | :mod:`audioop` | :mod:`crypt` | :mod:`nis` | :mod:`sndhdr` | :mod:`uu` |
+ | :mod:`audioop` | :mod:`crypt` | :mod:`nis` | :mod:`!sndhdr` | :mod:`uu` |
+---------------------+---------------------+---------------------+---------------------+---------------------+
| :mod:`!cgi` | :mod:`imghdr` | :mod:`nntplib` | :mod:`spwd` | :mod:`xdrlib` |
+---------------------+---------------------+---------------------+---------------------+---------------------+
diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst
index 417da22..50e7583 100644
--- a/Doc/whatsnew/3.12.rst
+++ b/Doc/whatsnew/3.12.rst
@@ -816,7 +816,7 @@ Modules (see :pep:`594`):
* :mod:`nntplib`
* :mod:`ossaudiodev`
* :mod:`pipes`
-* :mod:`sndhdr`
+* :mod:`!sndhdr`
* :mod:`spwd`
* :mod:`sunau`
* :mod:`!telnetlib`
diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst
index 4bd9a73..1d4a4ca 100644
--- a/Doc/whatsnew/3.13.rst
+++ b/Doc/whatsnew/3.13.rst
@@ -147,6 +147,12 @@ Removed
(Contributed by Victor Stinner in :gh:`104773`.)
+* :pep:`594`: Remove the :mod:`!sndhdr` module, deprecated in Python 3.11: use
+ the projects `filetype <https://pypi.org/project/filetype/>`_, `puremagic
+ <https://pypi.org/project/puremagic/>`_, or `python-magic
+ <https://pypi.org/project/python-magic/>`_ instead.
+ (Contributed by Victor Stinner in :gh:`104773`.)
+
Porting to Python 3.13
======================