svn+ssh://pythondev@svn.python.org/python/trunk
........
r65713 | benjamin.peterson | 2008-08-16 11:29:02 -0500 (Sat, 16 Aug 2008) | 1 line
#3424 rearrange the order of tests in imghdr to place more common types first
........
- fix "h[sbseek] == b'\1'" and "ratecode = ord(h[sbseek+4])" in test_voc()
- avoid division by zero
- use startswith method: replace h[:2] == b'BM' by h.startswith(b'BM')
- use aifc.open() instead of old aifc.openfp()
- use ord(b'P') instead of ord('P')
modules have unittests AFAICT, and I'm not improving things here, but these
changes make a bunch of email package tests succeed, and command line testing
against real files seems to make things better.
Added an __main__ section to imghdr.py so that it can be run from the command
line similarly to sndhdr.py. Someone else can figure out a better -m way of
doing this.
In sndhdr.py do a couple of very minor cleanups, and use a with statement to
not wait for gc to close the file.
There's one major and one minor category still unfixed:
doctests are the major category (and I hope to be able to augment the
refactoring tool to refactor bona fide doctests soon);
other code generating print statements in strings is the minor category.
(Oh, and I don't know if the compiler package works.)
who writes:
Here is batch 2, as a big collection of CVS context diffs.
Along with moving comments into docstrings, i've added a
couple of missing docstrings and attempted to make sure more
module docstrings begin with a one-line summary.
I did not add docstrings to the methods in profile.py for
fear of upsetting any careful optimizations there, though
i did move class documentation into class docstrings.
The convention i'm using is to leave credits/version/copyright
type of stuff in # comments, and move the rest of the descriptive
stuff about module usage into module docstrings. Hope this is
okay.
* imghdr.py: added jpeg recognition
* torgb.py: added jpeg conversion
* tzparse.py: use functions from time instead of calendar
* whatsound.py: add /ufs/guido/biin/sgi to $PATH when calling 'whatsound'