Skip to content

Commit 9661999

Browse files
committed
Add return ntypes to doc strings
1 parent c24abfd commit 9661999

1 file changed

Lines changed: 24 additions & 23 deletions

File tree

src/hyperlink/_url.py

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,9 @@ def register_scheme(text, uses_netloc=True, default_port=None):
371371
Args:
372372
text (Text): A string representation of the scheme.
373373
(the 'http' in 'http://hatnote.com')
374-
uses_netloc (bool): Does the scheme support specifying a network host?
375-
For instance, "http" does, "mailto" does not.
376-
Defaults to True.
374+
uses_netloc (bool): Does the scheme support specifying a
375+
network host? For instance, "http" does, "mailto" does
376+
not. Defaults to True.
377377
default_port (Optional[int]): The default port, if any, for
378378
netloc-using schemes.
379379
@@ -587,7 +587,7 @@ def _percent_decode(
587587
underlying the percent-decoding should be raised.
588588
589589
Returns:
590-
The percent-decoded version of *text*, decoded by *subencoding*.
590+
Text: The percent-decoded version of *text*, decoded by *subencoding*.
591591
"""
592592
try:
593593
quoted_bytes = text.encode(subencoding)
@@ -736,7 +736,7 @@ def parse_host(host):
736736
Will raise :class:`URLParseError` on invalid IPv6 constants.
737737
738738
Returns:
739-
tuple: family (socket constant or None), host (string)
739+
family (socket constant or None), host (string)
740740
741741
>>> import socket
742742
>>> parse_host('googlewebsite.com') == (None, 'googlewebsite.com')
@@ -808,7 +808,7 @@ class URL(object):
808808
path (Iterable[Text]): A tuple of strings representing the
809809
slash-separated parts of the path.
810810
query (Sequence[Tuple[Text, Optional[Text]]]): The query parameters, as
811-
a dictionary or as an iterable of key-value pairs.
811+
a dictionary or as an sequence of key-value pairs.
812812
fragment (Text): The fragment part of the URL.
813813
rooted (bool): A rooted URL is one which indicates an absolute path.
814814
This is True on any URL that includes a host, or any relative URL
@@ -1028,13 +1028,13 @@ def authority(self, with_password=False, **kw):
10281028
u'user:pass@localhost:8080'
10291029
10301030
Args:
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.
1031+
with_password (bool): Whether the return value of this
1032+
method include the password in the URL, if it is
1033+
set. Defaults to False.
10341034
10351035
Returns:
1036-
The authority (network location and user information) portion of
1037-
the URL.
1036+
Text: The authority (network location and user information) portion
1037+
of the URL.
10381038
"""
10391039
# first, a bit of twisted compat
10401040
with_password = kw.pop('includeSecrets', with_password)
@@ -1126,7 +1126,7 @@ def replace(
11261126
path (Iterable[Text]): A tuple of strings representing the
11271127
slash-separated parts of the path.
11281128
query (Sequence[Tuple[Text, Optional[Text]]]): The query
1129-
parameters, as a dictionary or as an iterable of key-value
1129+
parameters, as a dictionary or as an sequence of key-value
11301130
pairs.
11311131
fragment (Text): The fragment part of the URL.
11321132
port (Optional[int]): The port part of the network location.
@@ -1139,7 +1139,7 @@ def replace(
11391139
(``http://eg.com`` vs ``mailto:e@g.com``)
11401140
11411141
Returns:
1142-
A copy of the current :class:`URL`, with new values for
1142+
URL: A copy of the current :class:`URL`, with new values for
11431143
parameters passed.
11441144
"""
11451145
return self.__class__(
@@ -1175,7 +1175,7 @@ def from_text(cls, text):
11751175
text (Text): A valid URL string.
11761176
11771177
Returns:
1178-
The structured object version of the parsed string.
1178+
URL: The structured object version of the parsed string.
11791179
11801180
.. note::
11811181
@@ -1332,7 +1332,7 @@ def child(self, *segments):
13321332
in segments will be percent encoded.
13331333
13341334
Returns:
1335-
A copy of the current URL with the extra path segments.
1335+
URL: A copy of the current URL with the extra path segments.
13361336
"""
13371337
if not segments:
13381338
return self
@@ -1355,7 +1355,7 @@ def sibling(self, segment):
13551355
segment (Text): A single path segment.
13561356
13571357
Returns:
1358-
A copy of the current URL with the last path segment
1358+
URL: A copy of the current URL with the last path segment
13591359
replaced by *segment*. Special characters such as
13601360
``/?#`` will be percent encoded.
13611361
"""
@@ -1437,8 +1437,8 @@ def to_uri(self):
14371437
14381438
Returns:
14391439
URL: A new instance with its path segments, query parameters, and
1440-
hostname encoded, so that they are all in the standard
1441-
US-ASCII range.
1440+
hostname encoded, so that they are all in the standard
1441+
US-ASCII range.
14421442
"""
14431443
new_userinfo = u':'.join([_encode_userinfo_part(p) for p in
14441444
self.userinfo.split(':', 1)])
@@ -1482,7 +1482,7 @@ def to_iri(self):
14821482
14831483
Returns:
14841484
URL: A new instance with its path segments, query parameters, and
1485-
hostname decoded for display purposes.
1485+
hostname decoded for display purposes.
14861486
""" # noqa: E501
14871487
new_userinfo = u':'.join([
14881488
_decode_userinfo_part(p) for p in self.userinfo.split(':', 1)
@@ -1522,7 +1522,7 @@ def to_text(self, with_password=False):
15221522
text. Defaults to False.
15231523
15241524
Returns:
1525-
The serialized textual representation of this URL, such as
1525+
Text: The serialized textual representation of this URL, such as
15261526
``u"http://example.com/some/path?some=query"``.
15271527
15281528
The natural counterpart to :class:`URL.from_text()`.
@@ -1640,7 +1640,7 @@ def add(self, name, value=None):
16401640
value.
16411641
16421642
Returns:
1643-
A new :class:`URL` instance with the parameter added.
1643+
URL: A new :class:`URL` instance with the parameter added.
16441644
"""
16451645
return self.replace(query=self.query + ((name, value),))
16461646

@@ -1663,7 +1663,7 @@ def set(self, name, value=None):
16631663
value.
16641664
16651665
Returns:
1666-
A new :class:`URL` instance with the parameter set.
1666+
URL: A new :class:`URL` instance with the parameter set.
16671667
"""
16681668
# Preserve the original position of the query key in the list
16691669
q = [(k, v) for (k, v) in self.query if k != name]
@@ -1689,7 +1689,8 @@ def get(self, name):
16891689
name (Text): The name of the query parameter to get.
16901690
16911691
Returns:
1692-
A list of all the values associated with the key, in string form.
1692+
List[Optional[Text]]: A list of all the values associated with the
1693+
key, in string form.
16931694
"""
16941695
return [value for (key, value) in self.query if name == key]
16951696

0 commit comments

Comments
 (0)