@@ -369,12 +369,13 @@ def register_scheme(text, uses_netloc=True, default_port=None):
369369 `file an issue`_!
370370
371371 Args:
372- text: Text representing the scheme.
372+ text ( Text): A string representation of the scheme.
373373 (the 'http' in 'http://hatnote.com')
374- uses_netloc: Does the scheme support specifying a network host?
374+ uses_netloc (bool) : Does the scheme support specifying a network host?
375375 For instance, "http" does, "mailto" does not.
376376 Defaults to True.
377- default_port: The default port, if any, for netloc-using schemes.
377+ default_port (Optional[int]): The default port, if any, for
378+ netloc-using schemes.
378379
379380 .. _file an issue: https://github.com/mahmoud/hyperlink/issues
380381 """
@@ -797,24 +798,24 @@ class URL(object):
797798 constructor arguments is below.
798799
799800 Args:
800- scheme: The text name of the scheme.
801- host: The host portion of the network location
802- port: The port part of the network location. If
801+ scheme (Optional[Text]) : The text name of the scheme.
802+ host (Optional[Text]) : The host portion of the network location
803+ port (Optional[int]) : The port part of the network location. If
803804 ``None`` or no port is passed, the port will default to
804805 the default port of the scheme, if it is known. See the
805806 ``SCHEME_PORT_MAP`` and :func:`register_default_port`
806807 for more info.
807- path: A tuple of strings representing the
808+ path (Iterable[Text]) : A tuple of strings representing the
808809 slash-separated parts of the path.
809- query: The query parameters, as a dictionary or
810- as an iterable of key-value pairs.
811- fragment: The fragment part of the URL.
812- rooted: A rooted URL is one which indicates an absolute path.
810+ query (Sequence[Tuple[Text, Optional[Text]]]) : The query parameters, as
811+ a dictionary or as an iterable of key-value pairs.
812+ fragment (Text) : The fragment part of the URL.
813+ rooted (bool) : A rooted URL is one which indicates an absolute path.
813814 This is True on any URL that includes a host, or any relative URL
814815 that starts with a slash.
815- userinfo: The username or colon-separated
816+ userinfo (Text) : The username or colon-separated
816817 username:password pair.
817- uses_netloc: Indicates whether two slashes appear
818+ uses_netloc (bool) : Indicates whether two slashes appear
818819 between the scheme and the host (``http://eg.com`` vs
819820 ``mailto:e@g.com``). Set automatically based on scheme.
820821
@@ -1027,12 +1028,13 @@ def authority(self, with_password=False, **kw):
10271028 u'user:pass@localhost:8080'
10281029
10291030 Args:
1030- with_password: Whether the return value of this method include the
1031- password in the URL, if it is set. Defaults to False.
1031+ with_password (bool): Whether the return value of this method
1032+ include the password in the URL, if it is set.
1033+ Defaults to False.
10321034
10331035 Returns:
1034- The authority (network location and user information) portion of the
1035- URL.
1036+ The authority (network location and user information) portion of
1037+ the URL.
10361038 """
10371039 # first, a bit of twisted compat
10381040 with_password = kw .pop ('includeSecrets' , with_password )
@@ -1119,18 +1121,22 @@ def replace(
11191121 the value on the current URL.
11201122
11211123 Args:
1122- scheme: The text name of the scheme.
1123- host: The host portion of the network location
1124- path: A tuple of strings representing the slash-separated parts of
1125- the path.
1126- query: The query parameters, as a dictionary or as an iterable of
1127- key-value pairs.
1128- fragment: The fragment part of the URL.
1129- port: The port part of the network location.
1130- rooted: Whether or not the path begins with a slash.
1131- userinfo: The username or colon-separated username:password pair.
1132- uses_netloc: Indicates whether two slashes appear between the
1133- scheme and the host (``http://eg.com`` vs ``mailto:e@g.com``)
1124+ scheme (Optional[Text]): The text name of the scheme.
1125+ host (Optional[Text]): The host portion of the network location.
1126+ path (Iterable[Text]): A tuple of strings representing the
1127+ slash-separated parts of the path.
1128+ query (Sequence[Tuple[Text, Optional[Text]]]): The query
1129+ parameters, as a dictionary or as an iterable of key-value
1130+ pairs.
1131+ fragment (Text): The fragment part of the URL.
1132+ port (Optional[int]): The port part of the network location.
1133+ rooted (Optional[bool]): Whether or not the path begins with a
1134+ slash.
1135+ userinfo (Text): The username or colon-separated username:password
1136+ pair.
1137+ uses_netloc (bool): Indicates whether two slashes appear between
1138+ the scheme and the host
1139+ (``http://eg.com`` vs ``mailto:e@g.com``)
11341140
11351141 Returns:
11361142 A copy of the current :class:`URL`, with new values for
@@ -1166,7 +1172,7 @@ def from_text(cls, text):
11661172 sure to decode those bytestrings.
11671173
11681174 Args:
1169- text: A valid URL string.
1175+ text (Text) : A valid URL string.
11701176
11711177 Returns:
11721178 The structured object version of the parsed string.
@@ -1257,14 +1263,15 @@ def normalize(self, scheme=True, host=True, path=True, query=True,
12571263 name.
12581264
12591265 Args:
1260- scheme: Convert the scheme to lowercase
1261- host: Convert the host to lowercase
1262- path: Normalize the path (see above for details)
1263- query: Normalize the query string
1264- fragment: Normalize the fragment
1265- userinfo: Normalize the userinfo
1266- percents: Encode isolated percent signs for any percent-encoded
1267- fields which are being normalized (defaults to True).
1266+ scheme (bool): Convert the scheme to lowercase
1267+ host (bool): Convert the host to lowercase
1268+ path (bool): Normalize the path (see above for details)
1269+ query (bool): Normalize the query string
1270+ fragment (bool): Normalize the fragment
1271+ userinfo (bool): Normalize the userinfo
1272+ percents (bool): Encode isolated percent signs for any
1273+ percent-encoded fields which are being normalized
1274+ (defaults to True).
12681275
12691276 >>> url = URL.from_text(u'Http://example.COM/a/../b/./c%2f?%61%')
12701277 >>> print(url.normalize().to_text())
@@ -1320,7 +1327,7 @@ def child(self, *segments):
13201327 u'http://localhost/a/b/c/d?x=y'
13211328
13221329 Args:
1323- segments: Additional parts to be joined and added to
1330+ segments (Text) : Additional parts to be joined and added to
13241331 the path, like :func:`os.path.join`. Special characters
13251332 in segments will be percent encoded.
13261333
@@ -1345,7 +1352,7 @@ def sibling(self, segment):
13451352 sibling of this URL path.
13461353
13471354 Args:
1348- segment: A single path segment.
1355+ segment (Text) : A single path segment.
13491356
13501357 Returns:
13511358 A copy of the current URL with the last path segment
@@ -1370,7 +1377,7 @@ def click(self, href=u''):
13701377 >>> url.click(u'../d/./e').to_text()
13711378 u'http://localhost/a/b/d/e'
13721379
1373- Args:
1380+ Args (Text) :
13741381 href: A string representing a clicked URL.
13751382
13761383 Return:
@@ -1510,7 +1517,7 @@ def to_text(self, with_password=False):
15101517 unless the data after the colon is the empty string (indicating no
15111518 password)."
15121519
1513- Args:
1520+ Args (bool) :
15141521 with_password: Whether or not to include the password in the URL
15151522 text. Defaults to False.
15161523
@@ -1626,9 +1633,9 @@ def add(self, name, value=None):
16261633 URL.from_text(u'https://example.com/?x=y&x=z')
16271634
16281635 Args:
1629- name: The name of the query parameter to add.
1636+ name (Text) : The name of the query parameter to add.
16301637 The part before the ``=``.
1631- value: The value of the query parameter to add.
1638+ value (Optional[Text]) : The value of the query parameter to add.
16321639 The part after the ``=``. Defaults to ``None``, meaning no
16331640 value.
16341641
@@ -1649,9 +1656,9 @@ def set(self, name, value=None):
16491656 URL.from_text(u'https://example.com/?x=z')
16501657
16511658 Args:
1652- name: The name of the query parameter to set.
1659+ name (Text) : The name of the query parameter to set.
16531660 The part before the ``=``.
1654- value: The value of the query parameter to set.
1661+ value (Optional[Text]) : The value of the query parameter to set.
16551662 The part after the ``=``. Defaults to ``None``, meaning no
16561663 value.
16571664
@@ -1679,7 +1686,7 @@ def get(self, name):
16791686 list is always returned, and this method raises no exceptions.
16801687
16811688 Args:
1682- name: The name of the query parameter to get.
1689+ name (Text) : The name of the query parameter to get.
16831690
16841691 Returns:
16851692 A list of all the values associated with the key, in string form.
@@ -1699,11 +1706,12 @@ def remove(
16991706 parameter is not already set.
17001707
17011708 Args:
1702- name: The name of the query parameter to remove.
1703- value: Optional value to additionally filter on.
1709+ name (Text) : The name of the query parameter to remove.
1710+ value (Text) : Optional value to additionally filter on.
17041711 Setting this removes query parameters which match both name
17051712 and value.
1706- limit: Optional maximum number of parameters to remove.
1713+ limit (Optional[int]): Optional maximum number of parameters to
1714+ remove.
17071715
17081716 Returns:
17091717 URL: A new :class:`URL` instance with the parameter removed.
@@ -1750,9 +1758,9 @@ class DecodedURL(object):
17501758 special characters encoded with codecs other than UTF-8.
17511759
17521760 Args:
1753- url: A :class:`URL` object to wrap.
1754- lazy: Set to True to avoid pre-decode all parts of the URL to check for
1755- validity. Defaults to False.
1761+ url (URL) : A :class:`URL` object to wrap.
1762+ lazy (bool) : Set to True to avoid pre-decode all parts of the URL to
1763+ check for validity. Defaults to False.
17561764
17571765 """
17581766 def __init__ (self , url , lazy = False ):
@@ -1771,8 +1779,8 @@ def from_text(cls, text, lazy=False):
17711779 Make a `DecodedURL` instance from any text string containing a URL.
17721780
17731781 Args:
1774- text: Text containing the URL
1775- lazy: Whether to pre-decode all parts of the URL to check for
1782+ text (Text) : Text containing the URL
1783+ lazy (bool) : Whether to pre-decode all parts of the URL to check for
17761784 validity. Defaults to True.
17771785 """
17781786 _url = URL .from_text (text )
@@ -2084,15 +2092,16 @@ def parse(url, decoded=True, lazy=False):
20842092 """Automatically turn text into a structured URL object.
20852093
20862094 Args:
2095+ url (Text): A string representation of a URL.
20872096
2088- decoded: Whether or not to return a :class:`DecodedURL`,
2097+ decoded (bool) : Whether or not to return a :class:`DecodedURL`,
20892098 which automatically handles all
20902099 encoding/decoding/quoting/unquoting for all the various
20912100 accessors of parts of the URL, or an :class:`EncodedURL`,
20922101 which has the same API, but requires handling of special
20932102 characters for different parts of the URL.
20942103
2095- lazy: In the case of `decoded=True`, this controls
2104+ lazy (bool) : In the case of `decoded=True`, this controls
20962105 whether the URL is decoded immediately or as accessed. The
20972106 default, `lazy=False`, checks all encoded parts of the URL
20982107 for decodability.
0 commit comments