Commit Graph

15 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
Raymond Hettinger 97db05de3e SF #75103: imghdr -- identify JPEGs in EXIF format 2005-01-07 08:15:41 +00:00
Skip Montanaro 17ab123cf1 a few more modules get __all__ 2001-01-24 06:27:27 +00:00
Tim Peters 07e99cb774 Whitespace normalization. 2001-01-14 23:47:14 +00:00
Guido van Rossum 54f22ed30b More trivial comment -> docstring transformations by Ka-Ping Yee,
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.
2000-02-04 15:10:34 +00:00
Guido van Rossum 45ac47c0b2 Allow open file as parameter (must be seekable) (Jack) 1997-10-08 15:22:32 +00:00
Guido van Rossum 9e3307494d (Jack:) Recognize PNG files. 1997-04-11 18:59:38 +00:00
Guido van Rossum f813f56bcd imghdr.what(): check for not h'. This lets
you do:
    imghdr.what(None, '')
And still go down the
1996-08-22 21:20:46 +00:00
Guido van Rossum 81749b0754 Added optional second arg to what(), giving the data read from the file
(then f may be None).
1996-07-30 16:26:42 +00:00
Guido van Rossum 5cfa5dfe97 * calendar.py: all libC functionality now moved to built-in time module
* 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'
1993-06-23 09:30:50 +00:00
Guido van Rossum 2db91358de Misc changes and new modules. whrandom is "objectified". SOCKET.py
is moved to the sgi subdirectory.
1992-10-18 17:09:59 +00:00
Guido van Rossum 05b55e76f0 Fix pnm test for short files and add X bitmap as recognized type 1992-06-03 16:48:44 +00:00
Guido van Rossum 1c34fc7afb Initial revision 1992-05-27 14:06:59 +00:00