mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
The third and final doc-string sweep by Ka-Ping Yee.
The attached patches update the standard library so that all modules have docstrings beginning with one-line summaries. A new docstring was added to formatter. The docstring for os.py was updated to mention nt, os2, ce in addition to posix, dos, mac.
This commit is contained in:
parent
54f22ed30b
commit
e7b146fb3b
29 changed files with 891 additions and 778 deletions
|
|
@ -1,19 +1,17 @@
|
|||
# Module 'sunaudio' -- interpret sun audio headers
|
||||
"""Interpret sun audio headers."""
|
||||
|
||||
MAGIC = '.snd'
|
||||
|
||||
error = 'sunaudio sound header conversion error'
|
||||
|
||||
|
||||
# convert a 4-char value to integer
|
||||
|
||||
def get_long_be(s):
|
||||
"""Convert a 4-char value to integer."""
|
||||
return (ord(s[0])<<24) | (ord(s[1])<<16) | (ord(s[2])<<8) | ord(s[3])
|
||||
|
||||
|
||||
# read a sound header from an open file
|
||||
|
||||
def gethdr(fp):
|
||||
"""Read a sound header from an open file."""
|
||||
if fp.read(4) <> MAGIC:
|
||||
raise error, 'gethdr: bad magic word'
|
||||
hdr_size = get_long_be(fp.read(4))
|
||||
|
|
@ -31,9 +29,8 @@ def gethdr(fp):
|
|||
return (data_size, encoding, sample_rate, channels, info)
|
||||
|
||||
|
||||
# read and print the sound header of a named file
|
||||
|
||||
def printhdr(file):
|
||||
"""Read and print the sound header of a named file."""
|
||||
hdr = gethdr(open(file, 'r'))
|
||||
data_size, encoding, sample_rate, channels, info = hdr
|
||||
while info[-1:] == '\0':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue