2024-05-08 16:34:40 -03:00
|
|
|
:mod:`!pprint` --- Data pretty printer
|
|
|
|
======================================
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. module:: pprint
|
|
|
|
:synopsis: Data pretty printer.
|
2016-06-11 16:02:54 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. moduleauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
|
|
|
|
.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
|
|
|
|
|
2011-01-09 23:26:08 -04:00
|
|
|
**Source code:** :source:`Lib/pprint.py`
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2011-01-10 15:54:11 -04:00
|
|
|
--------------
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
The :mod:`pprint` module provides a capability to "pretty-print" arbitrary
|
|
|
|
Python data structures in a form which can be used as input to the interpreter.
|
|
|
|
If the formatted structures include objects which are not fundamental Python
|
|
|
|
types, the representation may not be loadable. This may be the case if objects
|
2013-03-23 16:30:39 -03:00
|
|
|
such as files, sockets or classes are included, as well as many other
|
|
|
|
objects which are not representable as Python literals.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
The formatted representation keeps objects on a single line if it can, and
|
2024-04-22 07:28:21 -03:00
|
|
|
breaks them onto multiple lines if they don't fit within the allowed width,
|
|
|
|
adjustable by the *width* parameter defaulting to 80 characters.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2007-09-01 10:51:09 -03:00
|
|
|
Dictionaries are sorted by key before the display is computed.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2019-06-26 20:13:18 -03:00
|
|
|
.. versionchanged:: 3.9
|
|
|
|
Added support for pretty-printing :class:`types.SimpleNamespace`.
|
|
|
|
|
2021-04-13 20:59:24 -03:00
|
|
|
.. versionchanged:: 3.10
|
|
|
|
Added support for pretty-printing :class:`dataclasses.dataclass`.
|
|
|
|
|
2024-02-28 15:43:05 -04:00
|
|
|
.. _pprint-functions:
|
|
|
|
|
|
|
|
Functions
|
|
|
|
---------
|
|
|
|
|
|
|
|
.. function:: pp(object, *args, sort_dicts=False, **kwargs)
|
|
|
|
|
|
|
|
Prints the formatted representation of *object* followed by a newline.
|
|
|
|
If *sort_dicts* is false (the default), dictionaries will be displayed with
|
|
|
|
their keys in insertion order, otherwise the dict keys will be sorted.
|
|
|
|
*args* and *kwargs* will be passed to :func:`~pprint.pprint` as formatting
|
|
|
|
parameters.
|
|
|
|
|
2024-03-24 10:59:14 -03:00
|
|
|
>>> import pprint
|
|
|
|
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
|
|
|
|
>>> stuff.insert(0, stuff)
|
|
|
|
>>> pprint.pp(stuff)
|
|
|
|
[<Recursion on list with id=...>,
|
|
|
|
'spam',
|
|
|
|
'eggs',
|
|
|
|
'lumberjack',
|
|
|
|
'knights',
|
|
|
|
'ni']
|
|
|
|
|
2024-02-28 15:43:05 -04:00
|
|
|
.. versionadded:: 3.8
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: pprint(object, stream=None, indent=1, width=80, depth=None, *, \
|
|
|
|
compact=False, sort_dicts=True, underscore_numbers=False)
|
|
|
|
|
|
|
|
Prints the formatted representation of *object* on *stream*, followed by a
|
|
|
|
newline. If *stream* is ``None``, :data:`sys.stdout` is used. This may be used
|
|
|
|
in the interactive interpreter instead of the :func:`print` function for
|
|
|
|
inspecting values (you can even reassign ``print = pprint.pprint`` for use
|
|
|
|
within a scope).
|
|
|
|
|
|
|
|
The configuration parameters *stream*, *indent*, *width*, *depth*,
|
|
|
|
*compact*, *sort_dicts* and *underscore_numbers* are passed to the
|
|
|
|
:class:`PrettyPrinter` constructor and their meanings are as
|
2024-03-05 17:14:52 -04:00
|
|
|
described in its documentation below.
|
2024-02-28 15:43:05 -04:00
|
|
|
|
2024-03-24 10:59:14 -03:00
|
|
|
Note that *sort_dicts* is ``True`` by default and you might want to use
|
|
|
|
:func:`~pprint.pp` instead where it is ``False`` by default.
|
2024-02-28 15:43:05 -04:00
|
|
|
|
|
|
|
.. function:: pformat(object, indent=1, width=80, depth=None, *, \
|
|
|
|
compact=False, sort_dicts=True, underscore_numbers=False)
|
|
|
|
|
|
|
|
Return the formatted representation of *object* as a string. *indent*,
|
|
|
|
*width*, *depth*, *compact*, *sort_dicts* and *underscore_numbers* are
|
|
|
|
passed to the :class:`PrettyPrinter` constructor as formatting parameters
|
2024-03-05 17:14:52 -04:00
|
|
|
and their meanings are as described in its documentation below.
|
2024-02-28 15:43:05 -04:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: isreadable(object)
|
|
|
|
|
|
|
|
.. index:: pair: built-in function; eval
|
|
|
|
|
|
|
|
Determine if the formatted representation of *object* is "readable", or can be
|
|
|
|
used to reconstruct the value using :func:`eval`. This always returns ``False``
|
|
|
|
for recursive objects.
|
|
|
|
|
|
|
|
>>> pprint.isreadable(stuff)
|
|
|
|
False
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: isrecursive(object)
|
|
|
|
|
|
|
|
Determine if *object* requires a recursive representation. This function is
|
|
|
|
subject to the same limitations as noted in :func:`saferepr` below and may raise an
|
|
|
|
:exc:`RecursionError` if it fails to detect a recursive object.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: saferepr(object)
|
|
|
|
|
|
|
|
Return a string representation of *object*, protected against recursion in
|
|
|
|
some common data structures, namely instances of :class:`dict`, :class:`list`
|
|
|
|
and :class:`tuple` or subclasses whose ``__repr__`` has not been overridden. If the
|
|
|
|
representation of object exposes a recursive entry, the recursive reference
|
|
|
|
will be represented as ``<Recursion on typename with id=number>``. The
|
|
|
|
representation is not otherwise formatted.
|
|
|
|
|
|
|
|
>>> pprint.saferepr(stuff)
|
|
|
|
"[<Recursion on list with id=...>, 'spam', 'eggs', 'lumberjack', 'knights', 'ni']"
|
|
|
|
|
|
|
|
.. _prettyprinter-objects:
|
|
|
|
|
|
|
|
PrettyPrinter Objects
|
|
|
|
---------------------
|
|
|
|
|
|
|
|
This module defines one class:
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 59605-59624 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59606 | georg.brandl | 2007-12-29 11:57:00 +0100 (Sat, 29 Dec 2007) | 2 lines
Some cleanup in the docs.
........
r59611 | martin.v.loewis | 2007-12-29 19:49:21 +0100 (Sat, 29 Dec 2007) | 2 lines
Bug #1699: Define _BSD_SOURCE only on OpenBSD.
........
r59612 | raymond.hettinger | 2007-12-29 23:09:34 +0100 (Sat, 29 Dec 2007) | 1 line
Simpler documentation for itertools.tee(). Should be backported.
........
r59613 | raymond.hettinger | 2007-12-29 23:16:24 +0100 (Sat, 29 Dec 2007) | 1 line
Improve docs for itertools.groupby(). The use of xrange(0) to create a unique object is less obvious than object().
........
r59620 | christian.heimes | 2007-12-31 15:47:07 +0100 (Mon, 31 Dec 2007) | 3 lines
Added wininst-9.0.exe executable for VS 2008
Integrated bdist_wininst into PCBuild9 directory
........
r59621 | christian.heimes | 2007-12-31 15:51:18 +0100 (Mon, 31 Dec 2007) | 1 line
Moved PCbuild directory to PC/VS7.1
........
r59622 | christian.heimes | 2007-12-31 15:59:26 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot
........
r59623 | christian.heimes | 2007-12-31 16:02:41 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot, part 2
........
r59624 | christian.heimes | 2007-12-31 16:18:55 +0100 (Mon, 31 Dec 2007) | 1 line
Renamed PCBuild9 directory to PCBuild
........
2007-12-31 12:14:33 -04:00
|
|
|
.. First the implementation class:
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2018-11-20 13:26:09 -04:00
|
|
|
.. index:: single: ...; placeholder
|
|
|
|
|
2013-10-02 05:56:18 -03:00
|
|
|
.. class:: PrettyPrinter(indent=1, width=80, depth=None, stream=None, *, \
|
2021-03-24 05:23:20 -03:00
|
|
|
compact=False, sort_dicts=True, underscore_numbers=False)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Construct a :class:`PrettyPrinter` instance. This constructor understands
|
2021-07-02 06:42:08 -03:00
|
|
|
several keyword parameters.
|
|
|
|
|
2024-02-28 15:43:05 -04:00
|
|
|
*stream* (default :data:`!sys.stdout`) is a :term:`file-like object` to
|
2023-07-29 02:48:10 -03:00
|
|
|
which the output will be written by calling its :meth:`!write` method.
|
2024-02-28 15:43:05 -04:00
|
|
|
If both *stream* and :data:`!sys.stdout` are ``None``, then
|
2021-07-19 06:19:02 -03:00
|
|
|
:meth:`~PrettyPrinter.pprint` silently returns.
|
2021-07-02 06:42:08 -03:00
|
|
|
|
|
|
|
Other values configure the manner in which nesting of complex data
|
|
|
|
structures is displayed.
|
|
|
|
|
|
|
|
*indent* (default 1) specifies the amount of indentation added for
|
|
|
|
each nesting level.
|
|
|
|
|
|
|
|
*depth* controls the number of nesting levels which may be printed; if
|
|
|
|
the data structure being printed is too deep, the next contained level
|
|
|
|
is replaced by ``...``. By default, there is no constraint on the
|
|
|
|
depth of the objects being formatted.
|
|
|
|
|
|
|
|
*width* (default 80) specifies the desired maximum number of characters per
|
|
|
|
line in the output. If a structure cannot be formatted within the width
|
|
|
|
constraint, a best effort will be made.
|
|
|
|
|
|
|
|
*compact* impacts the way that long sequences (lists, tuples, sets, etc)
|
|
|
|
are formatted. If *compact* is false (the default) then each item of a
|
|
|
|
sequence will be formatted on a separate line. If *compact* is true, as
|
|
|
|
many items as will fit within the *width* will be formatted on each output
|
|
|
|
line.
|
|
|
|
|
|
|
|
If *sort_dicts* is true (the default), dictionaries will be formatted with
|
|
|
|
their keys sorted, otherwise they will display in insertion order.
|
|
|
|
|
|
|
|
If *underscore_numbers* is true, integers will be formatted with the
|
2021-04-05 13:38:10 -03:00
|
|
|
``_`` character for a thousands separator, otherwise underscores are not
|
2021-03-24 05:23:20 -03:00
|
|
|
displayed (the default).
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2013-10-02 15:40:21 -03:00
|
|
|
.. versionchanged:: 3.4
|
|
|
|
Added the *compact* parameter.
|
|
|
|
|
2019-03-22 14:22:20 -03:00
|
|
|
.. versionchanged:: 3.8
|
|
|
|
Added the *sort_dicts* parameter.
|
|
|
|
|
2021-03-24 05:23:20 -03:00
|
|
|
.. versionchanged:: 3.10
|
|
|
|
Added the *underscore_numbers* parameter.
|
2019-03-22 14:22:20 -03:00
|
|
|
|
2021-07-19 06:19:02 -03:00
|
|
|
.. versionchanged:: 3.11
|
2024-02-28 15:43:05 -04:00
|
|
|
No longer attempts to write to :data:`!sys.stdout` if it is ``None``.
|
2021-07-19 06:19:02 -03:00
|
|
|
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
>>> import pprint
|
|
|
|
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
|
2007-08-15 11:28:22 -03:00
|
|
|
>>> stuff.insert(0, stuff[:])
|
|
|
|
>>> pp = pprint.PrettyPrinter(indent=4)
|
|
|
|
>>> pp.pprint(stuff)
|
Merged revisions 64446,64490,64495,64526,64567 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r64446 | facundo.batista | 2008-06-21 19:43:56 +0200 (Sat, 21 Jun 2008) | 4 lines
Fixed issue #2888. Now the behaviour of pprint when working with nested
structures follows the common sense (and works like in 2.5 and 3.0).
........
r64490 | thomas.heller | 2008-06-23 21:51:41 +0200 (Mon, 23 Jun 2008) | 1 line
Include debug info when assembling win64.asm in a debug build.
........
r64495 | benjamin.peterson | 2008-06-24 04:41:08 +0200 (Tue, 24 Jun 2008) | 1 line
minor fix
........
r64526 | mark.dickinson | 2008-06-25 17:29:32 +0200 (Wed, 25 Jun 2008) | 2 lines
issue #3199: Fix typo in Mac/Makefile.in
........
r64567 | mark.dickinson | 2008-06-28 00:20:14 +0200 (Sat, 28 Jun 2008) | 3 lines
Fix typo in configure.in, and propagate configure.in changes from r64002
to configure and pyconfig.h.in.
........
2008-07-16 00:00:45 -03:00
|
|
|
[ ['spam', 'eggs', 'lumberjack', 'knights', 'ni'],
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
'spam',
|
|
|
|
'eggs',
|
|
|
|
'lumberjack',
|
|
|
|
'knights',
|
|
|
|
'ni']
|
2013-10-02 05:56:18 -03:00
|
|
|
>>> pp = pprint.PrettyPrinter(width=41, compact=True)
|
|
|
|
>>> pp.pprint(stuff)
|
|
|
|
[['spam', 'eggs', 'lumberjack',
|
|
|
|
'knights', 'ni'],
|
|
|
|
'spam', 'eggs', 'lumberjack', 'knights',
|
|
|
|
'ni']
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
>>> tup = ('spam', ('eggs', ('lumberjack', ('knights', ('ni', ('dead',
|
|
|
|
... ('parrot', ('fresh fruit',))))))))
|
2007-08-15 11:28:22 -03:00
|
|
|
>>> pp = pprint.PrettyPrinter(depth=6)
|
|
|
|
>>> pp.pprint(tup)
|
Merged revisions 63119-63128,63130-63131,63133,63135-63144,63146-63148,63151-63152,63155-63165,63167-63176,63181-63186,63188-63189 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63119 | benjamin.peterson | 2008-05-11 20:41:23 -0400 (Sun, 11 May 2008) | 2 lines
#2196 hasattr now allows SystemExit and KeyboardInterrupt to propagate
........
r63122 | benjamin.peterson | 2008-05-11 20:46:49 -0400 (Sun, 11 May 2008) | 2 lines
make message slightly more informative, so there's no chance of misunderstanding it
........
r63158 | ronald.oussoren | 2008-05-12 07:24:33 -0400 (Mon, 12 May 2008) | 5 lines
Remove references to platform 'mac'
The 'mac' platform (that is, os.name == 'mac') was used for the MacOS 9 port,
which is no longer supported (as of Python 2.4 IIRC).
........
r63159 | ronald.oussoren | 2008-05-12 07:31:05 -0400 (Mon, 12 May 2008) | 8 lines
MacOSX: remove dependency on Carbon package for urllib
This patch removes the dependency on the Carbon package from urllib.
The mac-specific code for getting proxy configuration is now writting in
Python using ctypes and uses the SystemConfiguration framework instead of
InternetConfig. Also provides a mac-specific implementation of proxy_bypass.
........
r63162 | eric.smith | 2008-05-12 10:00:01 -0400 (Mon, 12 May 2008) | 1 line
Added 'n' presentation type for integers.
........
r63164 | georg.brandl | 2008-05-12 12:26:52 -0400 (Mon, 12 May 2008) | 2 lines
#1713041: fix pprint's handling of maximum depth.
........
r63170 | georg.brandl | 2008-05-12 12:53:42 -0400 (Mon, 12 May 2008) | 2 lines
Fix parameter name for enumerate().
........
r63173 | georg.brandl | 2008-05-12 13:01:58 -0400 (Mon, 12 May 2008) | 2 lines
#2766: remove code without effect.
........
r63174 | georg.brandl | 2008-05-12 13:04:10 -0400 (Mon, 12 May 2008) | 3 lines
#2767: don't clear globs in run() call, since they could be needed in tearDown,
which clears them at the end.
........
r63175 | georg.brandl | 2008-05-12 13:14:51 -0400 (Mon, 12 May 2008) | 2 lines
#1760: try-except-finally is one statement since PEP 341.
........
r63186 | amaury.forgeotdarc | 2008-05-12 17:30:24 -0400 (Mon, 12 May 2008) | 2 lines
Sync code with documentation, and remove Win95 support in winsound module.
........
r63189 | amaury.forgeotdarc | 2008-05-12 18:21:39 -0400 (Mon, 12 May 2008) | 3 lines
Adapt test_pyclbr to the new version of urllib.py:
The new mac-specific functions must be ignored.
........
2008-05-15 23:54:33 -03:00
|
|
|
('spam', ('eggs', ('lumberjack', ('knights', ('ni', ('dead', (...)))))))
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
:class:`PrettyPrinter` instances have the following methods:
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: PrettyPrinter.pformat(object)
|
|
|
|
|
|
|
|
Return the formatted representation of *object*. This takes into account the
|
|
|
|
options passed to the :class:`PrettyPrinter` constructor.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: PrettyPrinter.pprint(object)
|
|
|
|
|
|
|
|
Print the formatted representation of *object* on the configured stream,
|
|
|
|
followed by a newline.
|
|
|
|
|
|
|
|
The following methods provide the implementations for the corresponding
|
|
|
|
functions of the same names. Using these methods on an instance is slightly
|
|
|
|
more efficient since new :class:`PrettyPrinter` objects don't need to be
|
|
|
|
created.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: PrettyPrinter.isreadable(object)
|
|
|
|
|
2023-05-06 00:54:08 -03:00
|
|
|
.. index:: pair: built-in function; eval
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Determine if the formatted representation of the object is "readable," or can be
|
|
|
|
used to reconstruct the value using :func:`eval`. Note that this returns
|
|
|
|
``False`` for recursive objects. If the *depth* parameter of the
|
|
|
|
:class:`PrettyPrinter` is set and the object is deeper than allowed, this
|
|
|
|
returns ``False``.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: PrettyPrinter.isrecursive(object)
|
|
|
|
|
|
|
|
Determine if the object requires a recursive representation.
|
|
|
|
|
|
|
|
This method is provided as a hook to allow subclasses to modify the way objects
|
|
|
|
are converted to strings. The default implementation uses the internals of the
|
|
|
|
:func:`saferepr` implementation.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: PrettyPrinter.format(object, context, maxlevels, level)
|
|
|
|
|
|
|
|
Returns three values: the formatted version of *object* as a string, a flag
|
|
|
|
indicating whether the result is readable, and a flag indicating whether
|
|
|
|
recursion was detected. The first argument is the object to be presented. The
|
|
|
|
second is a dictionary which contains the :func:`id` of objects that are part of
|
|
|
|
the current presentation context (direct and indirect containers for *object*
|
|
|
|
that are affecting the presentation) as the keys; if an object needs to be
|
|
|
|
presented which is already represented in *context*, the third return value
|
2016-02-07 21:34:09 -04:00
|
|
|
should be ``True``. Recursive calls to the :meth:`.format` method should add
|
2007-08-15 11:28:22 -03:00
|
|
|
additional entries for containers to this dictionary. The third argument,
|
|
|
|
*maxlevels*, gives the requested limit to recursion; this will be ``0`` if there
|
|
|
|
is no requested limit. This argument should be passed unmodified to recursive
|
|
|
|
calls. The fourth argument, *level*, gives the current level; recursive calls
|
|
|
|
should be passed a value less than that of the current call.
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
|
|
|
|
|
|
|
|
.. _pprint-example:
|
|
|
|
|
2011-05-14 17:43:44 -03:00
|
|
|
Example
|
|
|
|
-------
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
|
2024-03-24 10:59:14 -03:00
|
|
|
To demonstrate several uses of the :func:`~pprint.pp` function and its parameters,
|
2018-05-15 15:58:35 -03:00
|
|
|
let's fetch information about a project from `PyPI <https://pypi.org>`_::
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
|
2011-05-14 17:43:44 -03:00
|
|
|
>>> import json
|
Merged revisions 59333-59370 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59343 | georg.brandl | 2007-12-05 08:02:47 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix typo.
........
r59347 | christian.heimes | 2007-12-05 13:31:44 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed quoting and paths in the sqlite project file
........
r59348 | christian.heimes | 2007-12-05 13:45:11 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed error in regrtest. I must have missed the spot.
........
r59350 | christian.heimes | 2007-12-05 13:49:14 +0100 (Wed, 05 Dec 2007) | 1 line
merge -r59315:59316 from py3k: Fix issue #1553: An errornous __length_hint__ can make list() raise a SystemError
........
r59352 | christian.heimes | 2007-12-05 13:52:34 +0100 (Wed, 05 Dec 2007) | 1 line
Added msg to Misc/NEWS
........
r59354 | andrew.kuchling | 2007-12-05 14:27:20 +0100 (Wed, 05 Dec 2007) | 1 line
Spelling fix
........
r59356 | georg.brandl | 2007-12-05 18:56:50 +0100 (Wed, 05 Dec 2007) | 3 lines
Add examples to csv, pprint and traceback docs.
Written by Ross for GHOP.
........
r59358 | raymond.hettinger | 2007-12-05 19:11:08 +0100 (Wed, 05 Dec 2007) | 1 line
Error checking was too aggressive (reported by Chris Tismer)
........
r59359 | georg.brandl | 2007-12-05 19:30:48 +0100 (Wed, 05 Dec 2007) | 2 lines
Add examples to re docs. Written for GHOP by Dan Finnie.
........
r59366 | georg.brandl | 2007-12-05 20:49:21 +0100 (Wed, 05 Dec 2007) | 2 lines
Fix markup.
........
r59367 | christian.heimes | 2007-12-05 20:57:54 +0100 (Wed, 05 Dec 2007) | 1 line
Updated documentation and build_tkinter.py script
........
r59368 | georg.brandl | 2007-12-05 21:03:57 +0100 (Wed, 05 Dec 2007) | 2 lines
Another markup fix.
........
r59369 | ronald.oussoren | 2007-12-05 21:07:36 +0100 (Wed, 05 Dec 2007) | 7 lines
This "fixes" compilation issues for the Carbon._OSA module on OSX Leopard
by purging bindings to OSA's debug API's. Those APIs we're completely
unsupported on OSX 10.4 and are no longer available on OSX 10.5.
Note that this patches a generated file. This is somewhat acceptable because
regenerating the file is non-trivial and wouldn't use system headers anyway.
........
r59370 | christian.heimes | 2007-12-05 21:10:38 +0100 (Wed, 05 Dec 2007) | 1 line
Fixed bug #1557 by using popen.communicate() before popen.wait()
........
2007-12-05 16:18:38 -04:00
|
|
|
>>> import pprint
|
2011-05-14 17:43:44 -03:00
|
|
|
>>> from urllib.request import urlopen
|
2018-11-01 09:29:38 -03:00
|
|
|
>>> with urlopen('https://pypi.org/pypi/sampleproject/json') as resp:
|
|
|
|
... project_info = json.load(resp)['info']
|
2011-05-14 17:43:44 -03:00
|
|
|
|
2024-03-24 10:59:14 -03:00
|
|
|
In its basic form, :func:`~pprint.pp` shows the whole object::
|
2011-05-14 17:43:44 -03:00
|
|
|
|
2024-03-24 10:59:14 -03:00
|
|
|
>>> pprint.pp(project_info)
|
2018-11-01 09:29:38 -03:00
|
|
|
{'author': 'The Python Packaging Authority',
|
|
|
|
'author_email': 'pypa-dev@googlegroups.com',
|
|
|
|
'bugtrack_url': None,
|
|
|
|
'classifiers': ['Development Status :: 3 - Alpha',
|
|
|
|
'Intended Audience :: Developers',
|
|
|
|
'License :: OSI Approved :: MIT License',
|
|
|
|
'Programming Language :: Python :: 2',
|
|
|
|
'Programming Language :: Python :: 2.6',
|
|
|
|
'Programming Language :: Python :: 2.7',
|
|
|
|
'Programming Language :: Python :: 3',
|
|
|
|
'Programming Language :: Python :: 3.2',
|
|
|
|
'Programming Language :: Python :: 3.3',
|
|
|
|
'Programming Language :: Python :: 3.4',
|
|
|
|
'Topic :: Software Development :: Build Tools'],
|
|
|
|
'description': 'A sample Python project\n'
|
|
|
|
'=======================\n'
|
|
|
|
'\n'
|
|
|
|
'This is the description file for the project.\n'
|
|
|
|
'\n'
|
|
|
|
'The file should use UTF-8 encoding and be written using '
|
|
|
|
'ReStructured Text. It\n'
|
|
|
|
'will be used to generate the project webpage on PyPI, and '
|
|
|
|
'should be written for\n'
|
|
|
|
'that purpose.\n'
|
|
|
|
'\n'
|
|
|
|
'Typical contents for this file would include an overview of '
|
|
|
|
'the project, basic\n'
|
|
|
|
'usage examples, etc. Generally, including the project '
|
|
|
|
'changelog in here is not\n'
|
|
|
|
'a good idea, although a simple "What\'s New" section for the '
|
|
|
|
'most recent version\n'
|
|
|
|
'may be appropriate.',
|
|
|
|
'description_content_type': None,
|
|
|
|
'docs_url': None,
|
|
|
|
'download_url': 'UNKNOWN',
|
|
|
|
'downloads': {'last_day': -1, 'last_month': -1, 'last_week': -1},
|
|
|
|
'home_page': 'https://github.com/pypa/sampleproject',
|
|
|
|
'keywords': 'sample setuptools development',
|
|
|
|
'license': 'MIT',
|
|
|
|
'maintainer': None,
|
|
|
|
'maintainer_email': None,
|
|
|
|
'name': 'sampleproject',
|
|
|
|
'package_url': 'https://pypi.org/project/sampleproject/',
|
|
|
|
'platform': 'UNKNOWN',
|
|
|
|
'project_url': 'https://pypi.org/project/sampleproject/',
|
|
|
|
'project_urls': {'Download': 'UNKNOWN',
|
|
|
|
'Homepage': 'https://github.com/pypa/sampleproject'},
|
|
|
|
'release_url': 'https://pypi.org/project/sampleproject/1.2.0/',
|
|
|
|
'requires_dist': None,
|
|
|
|
'requires_python': None,
|
|
|
|
'summary': 'A sample Python project',
|
|
|
|
'version': '1.2.0'}
|
2011-05-14 17:43:44 -03:00
|
|
|
|
|
|
|
The result can be limited to a certain *depth* (ellipsis is used for deeper
|
|
|
|
contents)::
|
|
|
|
|
2024-03-24 10:59:14 -03:00
|
|
|
>>> pprint.pp(project_info, depth=1)
|
2018-11-01 09:29:38 -03:00
|
|
|
{'author': 'The Python Packaging Authority',
|
|
|
|
'author_email': 'pypa-dev@googlegroups.com',
|
|
|
|
'bugtrack_url': None,
|
|
|
|
'classifiers': [...],
|
|
|
|
'description': 'A sample Python project\n'
|
|
|
|
'=======================\n'
|
|
|
|
'\n'
|
|
|
|
'This is the description file for the project.\n'
|
|
|
|
'\n'
|
|
|
|
'The file should use UTF-8 encoding and be written using '
|
|
|
|
'ReStructured Text. It\n'
|
|
|
|
'will be used to generate the project webpage on PyPI, and '
|
|
|
|
'should be written for\n'
|
|
|
|
'that purpose.\n'
|
|
|
|
'\n'
|
|
|
|
'Typical contents for this file would include an overview of '
|
|
|
|
'the project, basic\n'
|
|
|
|
'usage examples, etc. Generally, including the project '
|
|
|
|
'changelog in here is not\n'
|
|
|
|
'a good idea, although a simple "What\'s New" section for the '
|
|
|
|
'most recent version\n'
|
|
|
|
'may be appropriate.',
|
|
|
|
'description_content_type': None,
|
|
|
|
'docs_url': None,
|
|
|
|
'download_url': 'UNKNOWN',
|
|
|
|
'downloads': {...},
|
|
|
|
'home_page': 'https://github.com/pypa/sampleproject',
|
|
|
|
'keywords': 'sample setuptools development',
|
|
|
|
'license': 'MIT',
|
|
|
|
'maintainer': None,
|
|
|
|
'maintainer_email': None,
|
|
|
|
'name': 'sampleproject',
|
|
|
|
'package_url': 'https://pypi.org/project/sampleproject/',
|
|
|
|
'platform': 'UNKNOWN',
|
|
|
|
'project_url': 'https://pypi.org/project/sampleproject/',
|
|
|
|
'project_urls': {...},
|
|
|
|
'release_url': 'https://pypi.org/project/sampleproject/1.2.0/',
|
|
|
|
'requires_dist': None,
|
|
|
|
'requires_python': None,
|
|
|
|
'summary': 'A sample Python project',
|
|
|
|
'version': '1.2.0'}
|
2013-03-23 16:30:39 -03:00
|
|
|
|
|
|
|
Additionally, maximum character *width* can be suggested. If a long object
|
|
|
|
cannot be split, the specified width will be exceeded::
|
|
|
|
|
2024-03-24 10:59:14 -03:00
|
|
|
>>> pprint.pp(project_info, depth=1, width=60)
|
2018-11-01 09:29:38 -03:00
|
|
|
{'author': 'The Python Packaging Authority',
|
|
|
|
'author_email': 'pypa-dev@googlegroups.com',
|
|
|
|
'bugtrack_url': None,
|
|
|
|
'classifiers': [...],
|
|
|
|
'description': 'A sample Python project\n'
|
|
|
|
'=======================\n'
|
|
|
|
'\n'
|
|
|
|
'This is the description file for the '
|
|
|
|
'project.\n'
|
|
|
|
'\n'
|
|
|
|
'The file should use UTF-8 encoding and be '
|
|
|
|
'written using ReStructured Text. It\n'
|
|
|
|
'will be used to generate the project '
|
|
|
|
'webpage on PyPI, and should be written '
|
|
|
|
'for\n'
|
|
|
|
'that purpose.\n'
|
|
|
|
'\n'
|
|
|
|
'Typical contents for this file would '
|
|
|
|
'include an overview of the project, '
|
|
|
|
'basic\n'
|
|
|
|
'usage examples, etc. Generally, including '
|
|
|
|
'the project changelog in here is not\n'
|
|
|
|
'a good idea, although a simple "What\'s '
|
|
|
|
'New" section for the most recent version\n'
|
|
|
|
'may be appropriate.',
|
|
|
|
'description_content_type': None,
|
|
|
|
'docs_url': None,
|
|
|
|
'download_url': 'UNKNOWN',
|
|
|
|
'downloads': {...},
|
|
|
|
'home_page': 'https://github.com/pypa/sampleproject',
|
|
|
|
'keywords': 'sample setuptools development',
|
|
|
|
'license': 'MIT',
|
|
|
|
'maintainer': None,
|
|
|
|
'maintainer_email': None,
|
|
|
|
'name': 'sampleproject',
|
|
|
|
'package_url': 'https://pypi.org/project/sampleproject/',
|
|
|
|
'platform': 'UNKNOWN',
|
|
|
|
'project_url': 'https://pypi.org/project/sampleproject/',
|
|
|
|
'project_urls': {...},
|
|
|
|
'release_url': 'https://pypi.org/project/sampleproject/1.2.0/',
|
|
|
|
'requires_dist': None,
|
|
|
|
'requires_python': None,
|
|
|
|
'summary': 'A sample Python project',
|
|
|
|
'version': '1.2.0'}
|