Commit bf46a09d authored by Pablo Galindo's avatar Pablo Galindo Committed by Miss Islington (bot)

bpo-35075: Fix broken url in the pprint documentation (GH-10201)



https://bugs.python.org/issue35075
parent ac22f6aa
...@@ -217,135 +217,156 @@ let's fetch information about a project from `PyPI <https://pypi.org>`_:: ...@@ -217,135 +217,156 @@ let's fetch information about a project from `PyPI <https://pypi.org>`_::
>>> import json >>> import json
>>> import pprint >>> import pprint
>>> from urllib.request import urlopen >>> from urllib.request import urlopen
>>> with urlopen('http://pypi.org/project/Twisted/json') as url: >>> with urlopen('https://pypi.org/pypi/sampleproject/json') as resp:
... http_info = url.info() ... project_info = json.load(resp)['info']
... raw_data = url.read().decode(http_info.get_content_charset())
>>> project_info = json.loads(raw_data)
In its basic form, :func:`pprint` shows the whole object:: In its basic form, :func:`pprint` shows the whole object::
>>> pprint.pprint(project_info) >>> pprint.pprint(project_info)
{'info': {'_pypi_hidden': False, {'author': 'The Python Packaging Authority',
'_pypi_ordering': 125, 'author_email': 'pypa-dev@googlegroups.com',
'author': 'Glyph Lefkowitz', 'bugtrack_url': None,
'author_email': 'glyph@twistedmatrix.com', 'classifiers': ['Development Status :: 3 - Alpha',
'bugtrack_url': '', 'Intended Audience :: Developers',
'cheesecake_code_kwalitee_id': None, 'License :: OSI Approved :: MIT License',
'cheesecake_documentation_id': None, 'Programming Language :: Python :: 2',
'cheesecake_installability_id': None, 'Programming Language :: Python :: 2.6',
'classifiers': ['Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3',
'Programming Language :: Python :: 2 :: Only'], 'Programming Language :: Python :: 3.2',
'description': 'An extensible framework for Python programming, with ' 'Programming Language :: Python :: 3.3',
'special focus\r\n' 'Programming Language :: Python :: 3.4',
'on event-based network programming and multiprotocol ' 'Topic :: Software Development :: Build Tools'],
'integration.', 'description': 'A sample Python project\n'
'docs_url': '', '=======================\n'
'download_url': 'UNKNOWN', '\n'
'home_page': 'http://twistedmatrix.com/', 'This is the description file for the project.\n'
'keywords': '', '\n'
'license': 'MIT', 'The file should use UTF-8 encoding and be written using '
'maintainer': '', 'ReStructured Text. It\n'
'maintainer_email': '', 'will be used to generate the project webpage on PyPI, and '
'name': 'Twisted', 'should be written for\n'
'package_url': 'http://pypi.org/project/Twisted', 'that purpose.\n'
'platform': 'UNKNOWN', '\n'
'release_url': 'http://pypi.org/project/Twisted/12.3.0', 'Typical contents for this file would include an overview of '
'requires_python': None, 'the project, basic\n'
'stable_version': None, 'usage examples, etc. Generally, including the project '
'summary': 'An asynchronous networking framework written in Python', 'changelog in here is not\n'
'version': '12.3.0'}, 'a good idea, although a simple "What\'s New" section for the '
'urls': [{'comment_text': '', 'most recent version\n'
'downloads': 71844, 'may be appropriate.',
'filename': 'Twisted-12.3.0.tar.bz2', 'description_content_type': None,
'has_sig': False, 'docs_url': None,
'md5_digest': '6e289825f3bf5591cfd670874cc0862d', 'download_url': 'UNKNOWN',
'packagetype': 'sdist', 'downloads': {'last_day': -1, 'last_month': -1, 'last_week': -1},
'python_version': 'source', 'home_page': 'https://github.com/pypa/sampleproject',
'size': 2615733, 'keywords': 'sample setuptools development',
'upload_time': '2012-12-26T12:47:03', 'license': 'MIT',
'url': 'https://pypi.org/packages/source/T/Twisted/Twisted-12.3.0.tar.bz2'}, 'maintainer': None,
{'comment_text': '', 'maintainer_email': None,
'downloads': 5224, 'name': 'sampleproject',
'filename': 'Twisted-12.3.0.win32-py2.7.msi', 'package_url': 'https://pypi.org/project/sampleproject/',
'has_sig': False, 'platform': 'UNKNOWN',
'md5_digest': '6b778f5201b622a5519a2aca1a2fe512', 'project_url': 'https://pypi.org/project/sampleproject/',
'packagetype': 'bdist_msi', 'project_urls': {'Download': 'UNKNOWN',
'python_version': '2.7', 'Homepage': 'https://github.com/pypa/sampleproject'},
'size': 2916352, 'release_url': 'https://pypi.org/project/sampleproject/1.2.0/',
'upload_time': '2012-12-26T12:48:15', 'requires_dist': None,
'url': 'https://pypi.org/packages/2.7/T/Twisted/Twisted-12.3.0.win32-py2.7.msi'}]} 'requires_python': None,
'summary': 'A sample Python project',
'version': '1.2.0'}
The result can be limited to a certain *depth* (ellipsis is used for deeper The result can be limited to a certain *depth* (ellipsis is used for deeper
contents):: contents)::
>>> pprint.pprint(project_info, depth=2) >>> pprint.pprint(project_info, depth=1)
{'info': {'_pypi_hidden': False, {'author': 'The Python Packaging Authority',
'_pypi_ordering': 125, 'author_email': 'pypa-dev@googlegroups.com',
'author': 'Glyph Lefkowitz', 'bugtrack_url': None,
'author_email': 'glyph@twistedmatrix.com', 'classifiers': [...],
'bugtrack_url': '', 'description': 'A sample Python project\n'
'cheesecake_code_kwalitee_id': None, '=======================\n'
'cheesecake_documentation_id': None, '\n'
'cheesecake_installability_id': None, 'This is the description file for the project.\n'
'classifiers': [...], '\n'
'description': 'An extensible framework for Python programming, with ' 'The file should use UTF-8 encoding and be written using '
'special focus\r\n' 'ReStructured Text. It\n'
'on event-based network programming and multiprotocol ' 'will be used to generate the project webpage on PyPI, and '
'integration.', 'should be written for\n'
'docs_url': '', 'that purpose.\n'
'download_url': 'UNKNOWN', '\n'
'home_page': 'http://twistedmatrix.com/', 'Typical contents for this file would include an overview of '
'keywords': '', 'the project, basic\n'
'license': 'MIT', 'usage examples, etc. Generally, including the project '
'maintainer': '', 'changelog in here is not\n'
'maintainer_email': '', 'a good idea, although a simple "What\'s New" section for the '
'name': 'Twisted', 'most recent version\n'
'package_url': 'http://pypi.org/project/Twisted', 'may be appropriate.',
'platform': 'UNKNOWN', 'description_content_type': None,
'release_url': 'http://pypi.org/project/Twisted/12.3.0', 'docs_url': None,
'requires_python': None, 'download_url': 'UNKNOWN',
'stable_version': None, 'downloads': {...},
'summary': 'An asynchronous networking framework written in Python', 'home_page': 'https://github.com/pypa/sampleproject',
'version': '12.3.0'}, 'keywords': 'sample setuptools development',
'urls': [{...}, {...}]} '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'}
Additionally, maximum character *width* can be suggested. If a long object Additionally, maximum character *width* can be suggested. If a long object
cannot be split, the specified width will be exceeded:: cannot be split, the specified width will be exceeded::
>>> pprint.pprint(project_info, depth=2, width=50) >>> pprint.pprint(project_info, depth=1, width=60)
{'info': {'_pypi_hidden': False, {'author': 'The Python Packaging Authority',
'_pypi_ordering': 125, 'author_email': 'pypa-dev@googlegroups.com',
'author': 'Glyph Lefkowitz', 'bugtrack_url': None,
'author_email': 'glyph@twistedmatrix.com', 'classifiers': [...],
'bugtrack_url': '', 'description': 'A sample Python project\n'
'cheesecake_code_kwalitee_id': None, '=======================\n'
'cheesecake_documentation_id': None, '\n'
'cheesecake_installability_id': None, 'This is the description file for the '
'classifiers': [...], 'project.\n'
'description': 'An extensible ' '\n'
'framework for Python ' 'The file should use UTF-8 encoding and be '
'programming, with ' 'written using ReStructured Text. It\n'
'special focus\r\n' 'will be used to generate the project '
'on event-based network ' 'webpage on PyPI, and should be written '
'programming and ' 'for\n'
'multiprotocol ' 'that purpose.\n'
'integration.', '\n'
'docs_url': '', 'Typical contents for this file would '
'download_url': 'UNKNOWN', 'include an overview of the project, '
'home_page': 'http://twistedmatrix.com/', 'basic\n'
'keywords': '', 'usage examples, etc. Generally, including '
'license': 'MIT', 'the project changelog in here is not\n'
'maintainer': '', 'a good idea, although a simple "What\'s '
'maintainer_email': '', 'New" section for the most recent version\n'
'name': 'Twisted', 'may be appropriate.',
'package_url': 'http://pypi.org/project/Twisted', 'description_content_type': None,
'platform': 'UNKNOWN', 'docs_url': None,
'release_url': 'http://pypi.org/project/Twisted/12.3.0', 'download_url': 'UNKNOWN',
'requires_python': None, 'downloads': {...},
'stable_version': None, 'home_page': 'https://github.com/pypa/sampleproject',
'summary': 'An asynchronous networking ' 'keywords': 'sample setuptools development',
'framework written in ' 'license': 'MIT',
'Python', 'maintainer': None,
'version': '12.3.0'}, 'maintainer_email': None,
'urls': [{...}, {...}]} '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'}
...@@ -178,9 +178,17 @@ library/pathlib,,:Program,>>> PureWindowsPath('c:Program Files/').anchor ...@@ -178,9 +178,17 @@ library/pathlib,,:Program,>>> PureWindowsPath('c:Program Files/').anchor
library/pdb,,:lineno,filename:lineno library/pdb,,:lineno,filename:lineno
library/pickle,,:memory,"conn = sqlite3.connect("":memory:"")" library/pickle,,:memory,"conn = sqlite3.connect("":memory:"")"
library/posix,,`,"CFLAGS=""`getconf LFS_CFLAGS`"" OPT=""-g -O2 $CFLAGS""" library/posix,,`,"CFLAGS=""`getconf LFS_CFLAGS`"" OPT=""-g -O2 $CFLAGS"""
library/pprint,,::,"'Programming Language :: Python :: 2 :: Only'],"
library/pprint,,::,"'Programming Language :: Python :: 2.6'," library/pprint,,::,"'Programming Language :: Python :: 2.6',"
library/pprint,,::,"'Programming Language :: Python :: 2.7'," library/pprint,,::,"'Programming Language :: Python :: 2.7',"
library/pprint,225,::,"'classifiers': ['Development Status :: 3 - Alpha',"
library/pprint,225,::,"'Intended Audience :: Developers',"
library/pprint,225,::,"'License :: OSI Approved :: MIT License',"
library/pprint,225,::,"'Programming Language :: Python :: 2',"
library/pprint,225,::,"'Programming Language :: Python :: 3',"
library/pprint,225,::,"'Programming Language :: Python :: 3.2',"
library/pprint,225,::,"'Programming Language :: Python :: 3.3',"
library/pprint,225,::,"'Programming Language :: Python :: 3.4',"
library/pprint,225,::,"'Topic :: Software Development :: Build Tools'],"
library/profile,,:lineno,filename:lineno(function) library/profile,,:lineno,filename:lineno(function)
library/pyexpat,,:elem1,<py:elem1 /> library/pyexpat,,:elem1,<py:elem1 />
library/pyexpat,,:py,"xmlns:py = ""http://www.python.org/ns/"">" library/pyexpat,,:py,"xmlns:py = ""http://www.python.org/ns/"">"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment