diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2018-11-01 12:29:38 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-11-01 12:29:38 (GMT) |
commit | bf46a09dec372b85846216bd692d648dac08ac36 (patch) | |
tree | 4fd57640888006875d325976815bc473018df314 | |
parent | ac22f6aa989f18c33c12615af1c66c73cf75d5e7 (diff) | |
download | cpython-bf46a09dec372b85846216bd692d648dac08ac36.zip cpython-bf46a09dec372b85846216bd692d648dac08ac36.tar.gz cpython-bf46a09dec372b85846216bd692d648dac08ac36.tar.bz2 |
bpo-35075: Fix broken url in the pprint documentation (GH-10201)
https://bugs.python.org/issue35075
-rw-r--r-- | Doc/library/pprint.rst | 261 | ||||
-rw-r--r-- | Doc/tools/susp-ignored.csv | 10 |
2 files changed, 150 insertions, 121 deletions
diff --git a/Doc/library/pprint.rst b/Doc/library/pprint.rst index aa97d3e..3922a76 100644 --- a/Doc/library/pprint.rst +++ b/Doc/library/pprint.rst @@ -217,135 +217,156 @@ let's fetch information about a project from `PyPI <https://pypi.org>`_:: >>> import json >>> import pprint >>> from urllib.request import urlopen - >>> with urlopen('http://pypi.org/project/Twisted/json') as url: - ... http_info = url.info() - ... raw_data = url.read().decode(http_info.get_content_charset()) - >>> project_info = json.loads(raw_data) + >>> with urlopen('https://pypi.org/pypi/sampleproject/json') as resp: + ... project_info = json.load(resp)['info'] In its basic form, :func:`pprint` shows the whole object:: >>> pprint.pprint(project_info) - {'info': {'_pypi_hidden': False, - '_pypi_ordering': 125, - 'author': 'Glyph Lefkowitz', - 'author_email': 'glyph@twistedmatrix.com', - 'bugtrack_url': '', - 'cheesecake_code_kwalitee_id': None, - 'cheesecake_documentation_id': None, - 'cheesecake_installability_id': None, - 'classifiers': ['Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 2 :: Only'], - 'description': 'An extensible framework for Python programming, with ' - 'special focus\r\n' - 'on event-based network programming and multiprotocol ' - 'integration.', - 'docs_url': '', - 'download_url': 'UNKNOWN', - 'home_page': 'http://twistedmatrix.com/', - 'keywords': '', - 'license': 'MIT', - 'maintainer': '', - 'maintainer_email': '', - 'name': 'Twisted', - 'package_url': 'http://pypi.org/project/Twisted', - 'platform': 'UNKNOWN', - 'release_url': 'http://pypi.org/project/Twisted/12.3.0', - 'requires_python': None, - 'stable_version': None, - 'summary': 'An asynchronous networking framework written in Python', - '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'}]} + {'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'} The result can be limited to a certain *depth* (ellipsis is used for deeper contents):: - >>> pprint.pprint(project_info, depth=2) - {'info': {'_pypi_hidden': False, - '_pypi_ordering': 125, - 'author': 'Glyph Lefkowitz', - 'author_email': 'glyph@twistedmatrix.com', - 'bugtrack_url': '', - 'cheesecake_code_kwalitee_id': None, - 'cheesecake_documentation_id': None, - 'cheesecake_installability_id': None, - 'classifiers': [...], - 'description': 'An extensible framework for Python programming, with ' - 'special focus\r\n' - 'on event-based network programming and multiprotocol ' - 'integration.', - 'docs_url': '', - 'download_url': 'UNKNOWN', - 'home_page': 'http://twistedmatrix.com/', - 'keywords': '', - 'license': 'MIT', - 'maintainer': '', - 'maintainer_email': '', - 'name': 'Twisted', - 'package_url': 'http://pypi.org/project/Twisted', - 'platform': 'UNKNOWN', - 'release_url': 'http://pypi.org/project/Twisted/12.3.0', - 'requires_python': None, - 'stable_version': None, - 'summary': 'An asynchronous networking framework written in Python', - 'version': '12.3.0'}, - 'urls': [{...}, {...}]} + >>> pprint.pprint(project_info, depth=1) + {'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'} Additionally, maximum character *width* can be suggested. If a long object cannot be split, the specified width will be exceeded:: - >>> pprint.pprint(project_info, depth=2, width=50) - {'info': {'_pypi_hidden': False, - '_pypi_ordering': 125, - 'author': 'Glyph Lefkowitz', - 'author_email': 'glyph@twistedmatrix.com', - 'bugtrack_url': '', - 'cheesecake_code_kwalitee_id': None, - 'cheesecake_documentation_id': None, - 'cheesecake_installability_id': None, - 'classifiers': [...], - 'description': 'An extensible ' - 'framework for Python ' - 'programming, with ' - 'special focus\r\n' - 'on event-based network ' - 'programming and ' - 'multiprotocol ' - 'integration.', - 'docs_url': '', - 'download_url': 'UNKNOWN', - 'home_page': 'http://twistedmatrix.com/', - 'keywords': '', - 'license': 'MIT', - 'maintainer': '', - 'maintainer_email': '', - 'name': 'Twisted', - 'package_url': 'http://pypi.org/project/Twisted', - 'platform': 'UNKNOWN', - 'release_url': 'http://pypi.org/project/Twisted/12.3.0', - 'requires_python': None, - 'stable_version': None, - 'summary': 'An asynchronous networking ' - 'framework written in ' - 'Python', - 'version': '12.3.0'}, - 'urls': [{...}, {...}]} + >>> pprint.pprint(project_info, depth=1, width=60) + {'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'} diff --git a/Doc/tools/susp-ignored.csv b/Doc/tools/susp-ignored.csv index bb3310b..118ac15 100644 --- a/Doc/tools/susp-ignored.csv +++ b/Doc/tools/susp-ignored.csv @@ -178,9 +178,17 @@ library/pathlib,,:Program,>>> PureWindowsPath('c:Program Files/').anchor library/pdb,,:lineno,filename:lineno library/pickle,,:memory,"conn = sqlite3.connect("":memory:"")" 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.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/pyexpat,,:elem1,<py:elem1 /> library/pyexpat,,:py,"xmlns:py = ""http://www.python.org/ns/"">" |