[3.11] gh-105096: Reformat wave documentation (#105136) (#105138) (#105155)

[3.12] gh-105096: Reformat wave documentation (#105136) (#105138)

gh-105096: Reformat wave documentation (#105136)

Add ".. class::" markups in the wave documentation.

* Reformat also wave.py (minor PEP 8 changes).
* Remove redundant "import struct": it's already imported at top
  level.
* Remove wave.rst from .nitignore

(cherry picked from commit 85e5d03163)
(cherry picked from commit 01b42f9559)
This commit is contained in:
Victor Stinner 2023-05-31 18:40:25 +02:00 committed by GitHub
parent 67a8469237
commit 5de6ca59fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 135 additions and 127 deletions

View file

@ -89,6 +89,7 @@ class Error(Exception):
_wave_params = namedtuple('_wave_params',
'nchannels sampwidth framerate nframes comptype compname')
def _byteswap(data, width):
swapped_data = bytearray(len(data))
@ -101,7 +102,6 @@ def _byteswap(data, width):
class _Chunk:
def __init__(self, file, align=True, bigendian=True, inclheader=False):
import struct
self.closed = False
self.align = align # whether to align to word (2-byte) boundaries
if bigendian:
@ -211,7 +211,6 @@ def skip(self):
raise EOFError
class Wave_read:
"""Variables used in this class:
@ -393,6 +392,7 @@ def _read_fmt_chunk(self, chunk):
self._comptype = 'NONE'
self._compname = 'not compressed'
class Wave_write:
"""Variables used in this class:
@ -620,6 +620,7 @@ def _patchheader(self):
self._file.seek(curpos, 0)
self._datalength = self._datawritten
def open(f, mode=None):
if mode is None:
if hasattr(f, 'mode'):