mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-35397: Remove deprecation and document urllib.parse.unwrap (GH-11481)
This commit is contained in:
parent
1f39c28e48
commit
674ee12600
6 changed files with 24 additions and 19 deletions
|
@ -979,17 +979,15 @@ def _to_bytes(url):
|
|||
|
||||
|
||||
def unwrap(url):
|
||||
warnings.warn("urllib.parse.unwrap() is deprecated as of 3.8",
|
||||
DeprecationWarning, stacklevel=2)
|
||||
return _unwrap(url)
|
||||
"""Transform a string like '<URL:scheme://host/path>' into 'scheme://host/path'.
|
||||
|
||||
|
||||
def _unwrap(url):
|
||||
"""unwrap('<URL:type://host/path>') --> 'type://host/path'."""
|
||||
The string is returned unchanged if it's not a wrapped URL.
|
||||
"""
|
||||
url = str(url).strip()
|
||||
if url[:1] == '<' and url[-1:] == '>':
|
||||
url = url[1:-1].strip()
|
||||
if url[:4] == 'URL:': url = url[4:].strip()
|
||||
if url[:4] == 'URL:':
|
||||
url = url[4:].strip()
|
||||
return url
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue