diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2016-01-14 08:11:39 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2016-01-14 08:11:39 (GMT) |
commit | 86f7109dadea2c5c97c15e1878b862e769199d1d (patch) | |
tree | c22a89a5d097cf25a93c30121c4aa8545cd8df84 | |
parent | 4e280a6f9fe9b052912de1aa11205346f91bb279 (diff) | |
download | cpython-86f7109dadea2c5c97c15e1878b862e769199d1d.zip cpython-86f7109dadea2c5c97c15e1878b862e769199d1d.tar.gz cpython-86f7109dadea2c5c97c15e1878b862e769199d1d.tar.bz2 |
Issue #25822: Add docstrings to the fields of urllib.parse results.
Patch contributed by Swati Jaiswal.
-rw-r--r-- | Lib/urllib/parse.py | 67 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
2 files changed, 68 insertions, 2 deletions
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py index 5e2155c..cecd0b9 100644 --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -224,8 +224,71 @@ class _NetlocResultMixinBytes(_NetlocResultMixinBase, _ResultMixinBytes): from collections import namedtuple _DefragResultBase = namedtuple('DefragResult', 'url fragment') -_SplitResultBase = namedtuple('SplitResult', 'scheme netloc path query fragment') -_ParseResultBase = namedtuple('ParseResult', 'scheme netloc path params query fragment') +_SplitResultBase = namedtuple( + 'SplitResult', 'scheme netloc path query fragment') +_ParseResultBase = namedtuple( + 'ParseResult', 'scheme netloc path params query fragment') + +_DefragResultBase.__doc__ = """ +DefragResult(url, fragment) + +A 2-tuple that contains the url without fragment identifier and the fragment +identifier as a separate argument. +""" + +_DefragResultBase.url.__doc__ = """The URL with no fragment identifier.""" + +_DefragResultBase.fragment.__doc__ = """ +Fragment identifier separated from URL, that allows indirect identification of a +secondary resource by reference to a primary resource and additional identifying +information. +""" + +_SplitResultBase.__doc__ = """ +SplitResult(scheme, netloc, path, query, fragment) + +A 5-tuple that contains the different components of a URL. Similar to +ParseResult, but does not split params. +""" + +_SplitResultBase.scheme.__doc__ = """Specifies URL scheme for the request.""" + +_SplitResultBase.netloc.__doc__ = """ +Network location where the request is made to. +""" + +_SplitResultBase.path.__doc__ = """ +The hierarchical path, such as the path to a file to download. +""" + +_SplitResultBase.query.__doc__ = """ +The query component, that contains non-hierarchical data, that along with data +in path component, identifies a resource in the scope of URI's scheme and +network location. +""" + +_SplitResultBase.fragment.__doc__ = """ +Fragment identifier, that allows indirect identification of a secondary resource +by reference to a primary resource and additional identifying information. +""" + +_ParseResultBase.__doc__ = """ +ParseResult(scheme, netloc, path, params, query, fragment) + +A 6-tuple that contains components of a parsed URL. +""" + +_ParseResultBase.scheme.__doc__ = _SplitResultBase.scheme.__doc__ +_ParseResultBase.netloc.__doc__ = _SplitResultBase.netloc.__doc__ +_ParseResultBase.path.__doc__ = _SplitResultBase.path.__doc__ +_ParseResultBase.params.__doc__ = """ +Parameters for last path element used to dereference the URI in order to provide +access to perform some operation on the resource. +""" + +_ParseResultBase.query.__doc__ = _SplitResultBase.query.__doc__ +_ParseResultBase.fragment.__doc__ = _SplitResultBase.fragment.__doc__ + # For backwards compatibility, alias _NetlocResultMixinStr # ResultBase is no longer part of the documented API, but it is @@ -128,6 +128,9 @@ Core and Builtins Library ------- +- Issue #25822: Add docstrings to the fields of urllib.parse results. + Patch contributed by Swati Jaiswal. + - Issue #22642: Convert trace module option parsing mechanism to argparse. Patch contributed by SilentGhost. |