diff -r dd67c8c53aea Lib/urllib/parse.py --- a/Lib/urllib/parse.py Mon Dec 07 02:31:11 2015 +0200 +++ b/Lib/urllib/parse.py Thu Dec 31 09:24:58 2015 +0530 @@ -224,14 +224,33 @@ 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' + ) # For backwards compatibility, alias _NetlocResultMixinStr # ResultBase is no longer part of the documented API, but it is # retained since deprecating it isn't worth the hassle ResultBase = _NetlocResultMixinStr + +_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.''' +) + + # Structured result objects for string data class DefragResult(_DefragResultBase, _ResultMixinStr): __slots__ = () @@ -241,11 +260,64 @@ else: return self.url +_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.''' +) + + class SplitResult(_SplitResultBase, _NetlocResultMixinStr): __slots__ = () def geturl(self): return urlunsplit(self) +_ParseResultBase.__doc__ = """ +ParseResult(scheme, netloc, path, params, query, fragment) + +A 6-tuple that contains components of a parsed URL. +""" +_ParseResultBase.scheme.__doc__ = "Specifies URL scheme for the request." +_ParseResultBase.netloc.__doc__ = ( + "Network location where the request is made to." +) +_ParseResultBase.path.__doc__ = ( + "The hierarchical path, such as the path to a file to download." +) +_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__ = ( + '''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.''' +) +_ParseResultBase.fragment.__doc__ = ( + '''Fragment identifier, that allows indirect identification of + a secondary resource by reference to a primary resource and + additional identifying information.''' +) + + class ParseResult(_ParseResultBase, _NetlocResultMixinStr): __slots__ = () def geturl(self):