|
25 | 25 | )
|
26 | 26 | from urllib.parse import _coerce_args # type: ignore
|
27 | 27 | from urllib.request import pathname2url, url2pathname
|
28 |
| -from w3lib.util import to_bytes, to_native_str, to_unicode |
| 28 | +from w3lib.util import to_unicode |
29 | 29 | from w3lib._types import AnyUnicodeError, StrOrBytes
|
30 | 30 |
|
31 | 31 |
|
@@ -54,10 +54,10 @@ def safe_url_string(url: StrOrBytes, encoding: str = 'utf8', path_encoding: str
|
54 | 54 | as per https://url.spec.whatwg.org/#url-parsing.
|
55 | 55 |
|
56 | 56 | If a bytes URL is given, it is first converted to `str` using the given
|
57 |
| - encoding (which defaults to 'utf-8'). If quote_path is True (default), |
| 57 | + encoding (which defaults to 'utf-8'). If quote_path is True (default), |
58 | 58 | path_encoding ('utf-8' by default) is used to encode URL path component
|
59 | 59 | which is then quoted. Otherwise, if quote_path is False, path component
|
60 |
| - is not encoded or quoted. Given encoding is used for query string |
| 60 | + is not encoded or quoted. Given encoding is used for query string |
61 | 61 | or form data.
|
62 | 62 |
|
63 | 63 | When passing an encoding, you should use the encoding of the
|
@@ -89,7 +89,7 @@ def safe_url_string(url: StrOrBytes, encoding: str = 'utf8', path_encoding: str
|
89 | 89 | path = quote(parts.path.encode(path_encoding), _path_safe_chars)
|
90 | 90 | else:
|
91 | 91 | path = parts.path
|
92 |
| - |
| 92 | + |
93 | 93 | return urlunsplit((
|
94 | 94 | parts.scheme,
|
95 | 95 | netloc.rstrip(':'),
|
@@ -411,7 +411,7 @@ def parse_data_uri(uri: StrOrBytes) -> _ParseDataURIResult:
|
411 | 411 | ]
|
412 | 412 |
|
413 | 413 |
|
414 |
| -def _safe_ParseResult(parts: ParseResult, encoding: str = 'utf8', path_encoding: str = 'utf8') -> Tuple[str, str, str, str, str, str]: |
| 414 | +def _safe_ParseResult(parts: ParseResult, encoding: str = 'utf8', path_encoding: str = 'utf8') -> Tuple[str, str, str, str, str, str]: |
415 | 415 | # IDNA encoding can fail for too long labels (>63 characters)
|
416 | 416 | # or missing labels (e.g. http://.example.com)
|
417 | 417 | try:
|
|
0 commit comments