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 :: 2 :: Only'], 'Programming Language :: Python :: 3',
'description': 'An extensible framework for Python programming, with ' 'Programming Language :: Python :: 3.2',
'special focus\r\n' 'Programming Language :: Python :: 3.3',
'on event-based network programming and multiprotocol ' 'Programming Language :: Python :: 3.4',
'integration.', 'Topic :: Software Development :: Build Tools'],
'docs_url': '', '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', 'download_url': 'UNKNOWN',
'home_page': 'http://twistedmatrix.com/', 'downloads': {'last_day': -1, 'last_month': -1, 'last_week': -1},
'keywords': '', 'home_page': 'https://github.com/pypa/sampleproject',
'keywords': 'sample setuptools development',
'license': 'MIT', 'license': 'MIT',
'maintainer': '', 'maintainer': None,
'maintainer_email': '', 'maintainer_email': None,
'name': 'Twisted', 'name': 'sampleproject',
'package_url': 'http://pypi.org/project/Twisted', 'package_url': 'https://pypi.org/project/sampleproject/',
'platform': 'UNKNOWN', 'platform': 'UNKNOWN',
'release_url': 'http://pypi.org/project/Twisted/12.3.0', '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, 'requires_python': None,
'stable_version': None, 'summary': 'A sample Python project',
'summary': 'An asynchronous networking framework written in Python', 'version': '1.2.0'}
'version': '12.3.0'},
'urls': [{'comment_text': '',
'downloads': 71844,
'filename': 'Twisted-12.3.0.tar.bz2',
'has_sig': False,
'md5_digest': '6e289825f3bf5591cfd670874cc0862d',
'packagetype': 'sdist',
'python_version': 'source',
'size': 2615733,
'upload_time': '2012-12-26T12:47:03',
'url': 'https://pypi.org/packages/source/T/Twisted/Twisted-12.3.0.tar.bz2'},
{'comment_text': '',
'downloads': 5224,
'filename': 'Twisted-12.3.0.win32-py2.7.msi',
'has_sig': False,
'md5_digest': '6b778f5201b622a5519a2aca1a2fe512',
'packagetype': 'bdist_msi',
'python_version': '2.7',
'size': 2916352,
'upload_time': '2012-12-26T12:48:15',
'url': 'https://pypi.org/packages/2.7/T/Twisted/Twisted-12.3.0.win32-py2.7.msi'}]}
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',
'bugtrack_url': '',
'cheesecake_code_kwalitee_id': None,
'cheesecake_documentation_id': None,
'cheesecake_installability_id': None,
'classifiers': [...], 'classifiers': [...],
'description': 'An extensible framework for Python programming, with ' 'description': 'A sample Python project\n'
'special focus\r\n' '=======================\n'
'on event-based network programming and multiprotocol ' '\n'
'integration.', 'This is the description file for the project.\n'
'docs_url': '', '\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', 'download_url': 'UNKNOWN',
'home_page': 'http://twistedmatrix.com/', 'downloads': {...},
'keywords': '', 'home_page': 'https://github.com/pypa/sampleproject',
'keywords': 'sample setuptools development',
'license': 'MIT', 'license': 'MIT',
'maintainer': '', 'maintainer': None,
'maintainer_email': '', 'maintainer_email': None,
'name': 'Twisted', 'name': 'sampleproject',
'package_url': 'http://pypi.org/project/Twisted', 'package_url': 'https://pypi.org/project/sampleproject/',
'platform': 'UNKNOWN', 'platform': 'UNKNOWN',
'release_url': 'http://pypi.org/project/Twisted/12.3.0', '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, 'requires_python': None,
'stable_version': None, 'summary': 'A sample Python project',
'summary': 'An asynchronous networking framework written in Python', 'version': '1.2.0'}
'version': '12.3.0'},
'urls': [{...}, {...}]}
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',
'bugtrack_url': '',
'cheesecake_code_kwalitee_id': None,
'cheesecake_documentation_id': None,
'cheesecake_installability_id': None,
'classifiers': [...], 'classifiers': [...],
'description': 'An extensible ' 'description': 'A sample Python project\n'
'framework for Python ' '=======================\n'
'programming, with ' '\n'
'special focus\r\n' 'This is the description file for the '
'on event-based network ' 'project.\n'
'programming and ' '\n'
'multiprotocol ' 'The file should use UTF-8 encoding and be '
'integration.', 'written using ReStructured Text. It\n'
'docs_url': '', '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', 'download_url': 'UNKNOWN',
'home_page': 'http://twistedmatrix.com/', 'downloads': {...},
'keywords': '', 'home_page': 'https://github.com/pypa/sampleproject',
'keywords': 'sample setuptools development',
'license': 'MIT', 'license': 'MIT',
'maintainer': '', 'maintainer': None,
'maintainer_email': '', 'maintainer_email': None,
'name': 'Twisted', 'name': 'sampleproject',
'package_url': 'http://pypi.org/project/Twisted', 'package_url': 'https://pypi.org/project/sampleproject/',
'platform': 'UNKNOWN', 'platform': 'UNKNOWN',
'release_url': 'http://pypi.org/project/Twisted/12.3.0', '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, 'requires_python': None,
'stable_version': None, 'summary': 'A sample Python project',
'summary': 'An asynchronous networking ' 'version': '1.2.0'}
'framework written in '
'Python',
'version': '12.3.0'},
'urls': [{...}, {...}]}
...@@ -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