Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Fix the flake8 per-file ignore syntax (#5688)

Andrey Rahmatullinb33244e2f0d8
diff --git a/.flake8 b/.flake8
index d7aebc24b..0c64d009e 100644
--- a/.flake8
+++ b/.flake8
@@ -6,16 +6,17 @@ ignore = W503
exclude =
docs/conf.py
+per-file-ignores =
# Exclude files that are meant to provide top-level imports
# E402: Module level import not at top of file
# F401: Module imported but unused
- scrapy/__init__.py E402
- scrapy/core/downloader/handlers/http.py F401
- scrapy/http/__init__.py F401
- scrapy/linkextractors/__init__.py E402 F401
- scrapy/selector/__init__.py F401
- scrapy/spiders/__init__.py E402 F401
+ scrapy/__init__.py:E402
+ scrapy/core/downloader/handlers/http.py:F401
+ scrapy/http/__init__.py:F401
+ scrapy/linkextractors/__init__.py:E402,F401
+ scrapy/selector/__init__.py:F401
+ scrapy/spiders/__init__.py:E402,F401
# Issues pending a review:
- scrapy/utils/url.py F403 F405
- tests/test_loader.py E741
+ scrapy/utils/url.py:F403,F405
+ tests/test_loader.py:E741
diff --git a/scrapy/utils/url.py b/scrapy/utils/url.py
index 4d5e9ae82..21201ace5 100644
--- a/scrapy/utils/url.py
+++ b/scrapy/utils/url.py
@@ -34,6 +34,7 @@ def url_has_any_extension(url, extensions):
lowercase_path = parse_url(url).path.lower()
return any(lowercase_path.endswith(ext) for ext in extensions)
+
def parse_url(url, encoding=None):
"""Return urlparsed url from the given argument (which could be an already
parsed url)
diff --git a/tests/test_loader.py b/tests/test_loader.py
index c0937b349..b3e44d36b 100644
--- a/tests/test_loader.py
+++ b/tests/test_loader.py
@@ -295,7 +295,7 @@ class SelectortemLoaderTest(unittest.TestCase):
l.add_css('name', 'div::text')
self.assertEqual(l.get_output_value('name'), ['Marta'])
-
+
def test_init_method_with_base_response(self):
"""Selector should be None after initialization"""
response = Response("https://scrapy.org")