mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-10 15:44:45 +00:00
Remove unused url.safe_host_pattern()
This commit is contained in:
parent
794efd6d44
commit
71ea78382b
2 changed files with 1 additions and 22 deletions
|
|
@ -81,7 +81,6 @@ safe_url_pattern = r"%s://%s%s(#%s)?" % (
|
|||
is_safe_char = re.compile("(?i)^%s$" % _safe_char).match
|
||||
is_safe_url = re.compile("(?i)^%s$" % safe_url_pattern).match
|
||||
is_safe_domain = re.compile("(?i)^%s$" % _safe_domain_pattern).match
|
||||
is_safe_host = re.compile("(?i)^%s$" % _safe_host_pattern).match
|
||||
is_safe_path = re.compile("(?i)^%s$" % _safe_path_pattern).match
|
||||
is_safe_parameter = re.compile("(?i)^%s$" % _safe_param_pattern).match
|
||||
is_safe_query = re.compile("(?i)^%s$" % _safe_query_pattern).match
|
||||
|
|
@ -114,16 +113,6 @@ def is_numeric_port(portstr):
|
|||
return False
|
||||
|
||||
|
||||
def safe_host_pattern(host):
|
||||
"""Return regular expression pattern with given host for URL testing."""
|
||||
return "(?i)%s://%s%s(#%s)?" % (
|
||||
_safe_scheme_pattern,
|
||||
host,
|
||||
_safe_path_pattern,
|
||||
_safe_fragment_pattern,
|
||||
)
|
||||
|
||||
|
||||
def parse_qsl(qs, encoding, keep_blank_values=0, strict_parsing=0):
|
||||
"""Parse a query given as a string argument.
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ Test url routines.
|
|||
from . import need_posix, need_windows
|
||||
import unittest
|
||||
import os
|
||||
import re
|
||||
|
||||
import linkcheck.url
|
||||
|
||||
# 'ftp://user:pass@ftp.foo.net/foo/bar':
|
||||
|
|
@ -67,16 +67,6 @@ class TestUrl(unittest.TestCase):
|
|||
linkcheck.url.url_quote(url_norm(url), encoding="iso-8859-1"), nurl
|
||||
)
|
||||
|
||||
def test_safe_patterns(self):
|
||||
is_safe_host = linkcheck.url.is_safe_host
|
||||
safe_host_pattern = linkcheck.url.safe_host_pattern
|
||||
self.assertTrue(is_safe_host("example.org"))
|
||||
self.assertTrue(is_safe_host("example.org:80"))
|
||||
self.assertTrue(not is_safe_host("example.org:21"))
|
||||
pat = safe_host_pattern("example.org")
|
||||
ro = re.compile(pat)
|
||||
self.assertTrue(ro.match("http://example.org:80/"))
|
||||
|
||||
def test_url_quote(self):
|
||||
def url_quote(url):
|
||||
return linkcheck.url.url_quote(url, encoding="utf-8")
|
||||
|
|
|
|||
Loading…
Reference in a new issue