Skip to content

Commit 4afeb55

Browse files
committed
add parse doctest and 'new in' messages
1 parent 1f57a36 commit 4afeb55

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/hyperlink/_url.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,8 @@ def remove(
17481748
_EMPTY_URL = URL()
17491749

17501750
class DecodedURL(object):
1751-
""":class:`DecodedURL` is a type designed to act as a higher-level
1751+
"""
1752+
:class:`DecodedURL` is a type designed to act as a higher-level
17521753
interface to :class:`URL` and the recommended type for most
17531754
operations. By analogy, :class:`DecodedURL` is the
17541755
:class:`unicode` to URL's :class:`bytes`.
@@ -1784,7 +1785,7 @@ class DecodedURL(object):
17841785
>>> DecodedURL().replace(host='pypi.org', path=('projects', 'hyperlink').to_text()
17851786
"http://pypi.org/projects/hyperlink"
17861787
1787-
1788+
*(New in 18.0.0)*
17881789
"""
17891790
def __init__(self, url=_EMPTY_URL, lazy=False):
17901791
# type: (URL, bool) -> None
@@ -2112,10 +2113,15 @@ def __dir__(self):
21122113

21132114
def parse(url, decoded=True, lazy=False):
21142115
# type: (Text, bool, bool) -> Union[URL, DecodedURL]
2115-
"""Automatically turn text into a structured URL object.
2116+
"""
2117+
Automatically turn text into a structured URL object.
2118+
2119+
>>> url = parse("https://github.com/python-hyper/hyperlink")
2120+
>>> print(url.to_text())
2121+
"https://github.com/python-hyper/hyperlink"
21162122
21172123
Args:
2118-
url (Text): A string representation of a URL.
2124+
url (str): A text string representation of a URL.
21192125
21202126
decoded (bool): Whether or not to return a :class:`DecodedURL`,
21212127
which automatically handles all
@@ -2128,6 +2134,8 @@ def parse(url, decoded=True, lazy=False):
21282134
whether the URL is decoded immediately or as accessed. The
21292135
default, `lazy=False`, checks all encoded parts of the URL
21302136
for decodability.
2137+
2138+
*(New in 18.0.0)*
21312139
"""
21322140
enc_url = EncodedURL.from_text(url)
21332141
if not decoded:

0 commit comments

Comments
 (0)