Commit Graph

10 Commits

Author SHA1 Message Date
Guido van Rossum c934128162 Improved patches for sndhdr and imghdr by Victor Stinner, who writes:
- 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')
2007-08-13 17:50:00 +00:00
Barry Warsaw 72937f3216 Compare what's read from files against proper byte literals. Neither of these
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.
2007-08-12 14:37:20 +00:00
Guido van Rossum be19ed77dd Fix most trivially-findable print statements.
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.)
2007-02-09 05:37:30 +00:00
Guido van Rossum 3fc9582821 Amazing. This would open the sound file in text mode. Fixed.
SF bug  #446219.
2001-07-31 06:27:07 +00:00
Skip Montanaro 0de65807e6 bunch more __all__ lists
also modified check_all function to suppress all warnings since they aren't
relevant to what this test is doing (allows quiet checking of regsub, for
instance)
2001-02-15 22:15:14 +00:00
Tim Peters 495ad3c8cc Whitespace normalization. 2001-01-15 01:36:40 +00:00
Fred Drake 8152d32375 Update the code to better reflect recommended style:
Use != instead of <> since <> is documented as "obsolescent".
Use "is" and "is not" when comparing with None or type objects.
2000-12-12 23:20:45 +00:00
Fred Drake dc1aedfe2e Move brief descriptions of what() and whathdr() to docstrings in the
functions (from comments).
1999-01-06 15:20:49 +00:00
Guido van Rossum f4bf044999 Got rid of whatraw().
Doc-string-ified the lead comments.
Added auto call of test() when run as script.
1999-01-06 13:05:58 +00:00
Guido van Rossum b90bdebf19 sndhdr.py: restored lost file; audiodev.py: import platform specific
modules only when needed
1994-01-14 16:46:14 +00:00