Skip to content

Commit ef5c110

Browse files
authored
Remove deprecated code (#169)
1 parent 1b6ce31 commit ef5c110

File tree

5 files changed

+14
-206
lines changed

5 files changed

+14
-206
lines changed

tests/test_form.py

Lines changed: 0 additions & 65 deletions
This file was deleted.

tests/test_url.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
safe_url_string,
1919
url_query_parameter,
2020
url_query_cleaner,
21-
urljoin_rfc,
2221
)
2322

2423

@@ -462,10 +461,6 @@ def test_any_to_uri(self):
462461
self.assertEqual(any_to_uri("http://www.example.com/some/path.txt"),
463462
"http://www.example.com/some/path.txt")
464463

465-
def test_urljoin_rfc_deprecated(self):
466-
jurl = urljoin_rfc("http://www.example.com/", "/test")
467-
self.assertEqual(jurl, b"http://www.example.com/test")
468-
469464

470465
class CanonicalizeUrlTest(unittest.TestCase):
471466

w3lib/form.py

Lines changed: 0 additions & 65 deletions
This file was deleted.

w3lib/html.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Functions for dealing with markup text
33
"""
44

5-
import warnings
65
import re
76
from html.entities import name2codepoint
87
from urllib.parse import urljoin
@@ -19,24 +18,6 @@
1918
HTML5_WHITESPACE = ' \t\n\r\x0c'
2019

2120

22-
def remove_entities(text, keep=(), remove_illegal=True, encoding='utf-8'):
23-
r"""
24-
25-
.. warning::
26-
27-
This function is deprecated and will be removed in future.
28-
Please use :func:`replace_entities` instead.
29-
"""
30-
31-
warnings.warn(
32-
"`w3lib.html.remove_entities` function is deprecated and "
33-
"will be removed in future releases. Please use "
34-
"`w3lib.html.replace_entities` instead.",
35-
DeprecationWarning
36-
)
37-
38-
return replace_entities(text, keep, remove_illegal, encoding)
39-
4021
def replace_entities(text, keep=(), remove_illegal=True, encoding='utf-8'):
4122
"""Remove entities from the given `text` by converting them to their
4223
corresponding unicode character.

w3lib/url.py

Lines changed: 14 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import posixpath
99
import re
1010
import string
11-
import warnings
1211
from collections import namedtuple
1312
from urllib.parse import (
1413
_coerce_args,
@@ -19,7 +18,6 @@
1918
unquote_to_bytes,
2019
urldefrag,
2120
urlencode,
22-
urljoin,
2321
urlparse,
2422
urlsplit,
2523
urlunparse,
@@ -392,21 +390,20 @@ def parse_data_uri(uri):
392390
return _ParseDataURIResult(media_type, media_type_params, data)
393391

394392

395-
__all__ = ["add_or_replace_parameter",
396-
"add_or_replace_parameters",
397-
"any_to_uri",
398-
"canonicalize_url",
399-
"file_uri_to_path",
400-
"is_url",
401-
"parse_data_uri",
402-
"path_to_file_uri",
403-
"safe_download_url",
404-
"safe_url_string",
405-
"url_query_cleaner",
406-
"url_query_parameter",
407-
408-
# this last one is deprecated ; include it to be on the safe side
409-
"urljoin_rfc"]
393+
__all__ = [
394+
"add_or_replace_parameter",
395+
"add_or_replace_parameters",
396+
"any_to_uri",
397+
"canonicalize_url",
398+
"file_uri_to_path",
399+
"is_url",
400+
"parse_data_uri",
401+
"path_to_file_uri",
402+
"safe_download_url",
403+
"safe_url_string",
404+
"url_query_cleaner",
405+
"url_query_parameter",
406+
]
410407

411408

412409
def _safe_ParseResult(parts, encoding='utf8', path_encoding='utf8'):
@@ -585,38 +582,3 @@ def parse_qsl_to_bytes(qs, keep_blank_values=False):
585582
value = _coerce_result(value)
586583
r.append((name, value))
587584
return r
588-
589-
590-
def urljoin_rfc(base, ref, encoding='utf-8'):
591-
r"""
592-
.. warning::
593-
594-
This function is deprecated and will be removed in future.
595-
It is not supported with Python 3.
596-
Please use ``urlparse.urljoin`` instead.
597-
598-
Same as urlparse.urljoin but supports unicode values in base and ref
599-
parameters (in which case they will be converted to str using the given
600-
encoding).
601-
602-
Always returns a str.
603-
604-
>>> import w3lib.url
605-
>>> w3lib.url.urljoin_rfc('http://www.example.com/path/index.html', '/otherpath/index2.html')
606-
'http://www.example.com/otherpath/index2.html'
607-
>>>
608-
609-
>>> # Note: the following does not work in Python 3
610-
>>> w3lib.url.urljoin_rfc(b'http://www.example.com/path/index.html', 'fran\u00e7ais/d\u00e9part.htm') # doctest: +SKIP
611-
'http://www.example.com/path/fran\xc3\xa7ais/d\xc3\xa9part.htm'
612-
>>>
613-
614-
615-
"""
616-
617-
warnings.warn("w3lib.url.urljoin_rfc is deprecated, use urlparse.urljoin instead",
618-
DeprecationWarning)
619-
620-
str_base = to_bytes(base, encoding)
621-
str_ref = to_bytes(ref, encoding)
622-
return urljoin(str_base, str_ref)

0 commit comments

Comments
 (0)