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 Mon Dec 14 08:54:41 2015 +0530 @@ -224,8 +224,12 @@ 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 @@ -241,11 +245,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):