From 5627a632655a04a81f364aca987b509dac996503 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 15 Feb 2018 18:10:11 +0100 Subject: [PATCH] urlmatch: Fix lint --- qutebrowser/utils/urlmatch.py | 15 +++++++-------- tests/unit/utils/test_urlmatch.py | 6 ++++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/qutebrowser/utils/urlmatch.py b/qutebrowser/utils/urlmatch.py index 390ba733f..5a67d3ad1 100644 --- a/qutebrowser/utils/urlmatch.py +++ b/qutebrowser/utils/urlmatch.py @@ -27,7 +27,6 @@ https://cs.chromium.org/chromium/src/extensions/common/url_pattern.h import ipaddress import fnmatch -import contextlib import urllib.parse from qutebrowser.utils import utils, qtutils @@ -196,9 +195,9 @@ class UrlPattern: if host == self._host: return True - # If we're matching subdomains, and we have no host in the match pattern, - # that means that we're matching all hosts, which means we have a match no - # matter what the test host is. + # If we're matching subdomains, and we have no host in the match + # pattern, that means that we're matching all hosts, which means we + # have a match no matter what the test host is. if self._match_subdomains and not self._host: return True @@ -206,8 +205,8 @@ class UrlPattern: if not self._match_subdomains: return False - # We don't do subdomain matching against IP addresses, so we can give up now - # if the test host is an IP address. + # We don't do subdomain matching against IP addresses, so we can give + # up now if the test host is an IP address. if not utils.raises(ValueError, ipaddress.ip_address, host): return False @@ -230,8 +229,8 @@ class UrlPattern: return True # Match 'google.com' with 'google.com/' - # FIXME use the no-copy approach Chromium has in URLPattern::MatchesPath - # for performance? + # FIXME use the no-copy approach Chromium has in + # URLPattern::MatchesPath for performance? if path + '/*' == self._path: return True diff --git a/tests/unit/utils/test_urlmatch.py b/tests/unit/utils/test_urlmatch.py index 6a99e164f..b7f8da70a 100644 --- a/tests/unit/utils/test_urlmatch.py +++ b/tests/unit/utils/test_urlmatch.py @@ -375,8 +375,10 @@ def test_ignore_missing_slashes(): assert not pattern1.matches(url2) -@pytest.mark.parametrize('pattern', ['*://example.com/*', '*://example.com./*']) -@pytest.mark.parametrize('url', ['http://example.com/', 'http://example.com./']) +@pytest.mark.parametrize('pattern', ['*://example.com/*', + '*://example.com./*']) +@pytest.mark.parametrize('url', ['http://example.com/', + 'http://example.com./']) def test_trailing_dot_domain(pattern, url): """Both patterns should match trailing dot and non trailing dot domains.