diff --git a/pytest.ini b/pytest.ini
index 8c5a2cd54..984930459 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -48,7 +48,7 @@ flake8-ignore =
scrapy/core/engine.py E261 E501 E128 E127 E306 E502
scrapy/core/scheduler.py E501
scrapy/core/scraper.py E501 E306 E261 E128 W504
- scrapy/core/spidermw.py E501 E731 E502 E231 E126 E226
+ scrapy/core/spidermw.py E501 E731 E502 E126 E226
scrapy/core/downloader/__init__.py F401 E501
scrapy/core/downloader/contextfactory.py E501 E128 E126
scrapy/core/downloader/middleware.py E501 E502
@@ -214,13 +214,13 @@ flake8-ignore =
tests/test_feedexport.py E501 F401 F841 E241
tests/test_http_cookies.py E501
tests/test_http_headers.py E302 E501
- tests/test_http_request.py F401 E402 E501 E231 E261 E127 E128 W293 E502 E128 E502 E126 E123
+ tests/test_http_request.py F401 E402 E501 E261 E127 E128 W293 E502 E128 E502 E126 E123
tests/test_http_response.py E501 E301 E502 E128 E265
- tests/test_item.py E701 E128 E231 F841 E306
+ tests/test_item.py E701 E128 F841 E306
tests/test_link.py E501
- tests/test_linkextractors.py E501 E128 E231 E124
+ tests/test_linkextractors.py E501 E128 E124
tests/test_loader.py E302 E501 E731 E303 E741 E128 E117 E241
- tests/test_logformatter.py E128 E501 E231 E122 E302
+ tests/test_logformatter.py E128 E501 E122 E302
tests/test_mail.py E302 E128 E501 E305
tests/test_middleware.py E302 E501 E128
tests/test_pipeline_crawl.py E131 E501 E128 E126
@@ -239,8 +239,8 @@ flake8-ignore =
tests/test_spidermiddleware_output_chain.py F401 E501 E302 W293 E226
tests/test_spidermiddleware_referer.py F401 E501 E302 F841 E125 E201 E261 E124 E501 E241 E121
tests/test_squeues.py E501 E302 E701 E741
- tests/test_utils_conf.py E501 E231 E303 E128
- tests/test_utils_console.py E302 E231
+ tests/test_utils_conf.py E501 E303 E128
+ tests/test_utils_console.py E302
tests/test_utils_curl.py E501
tests/test_utils_datatypes.py E402 E501 E305
tests/test_utils_defer.py E306 E261 E501 E302 F841 E226
@@ -269,4 +269,4 @@ flake8-ignore =
tests/test_spiderloader/test_spiders/spider2.py E302
tests/test_spiderloader/test_spiders/spider3.py E302
tests/test_spiderloader/test_spiders/nested/spider4.py E302
- tests/test_utils_misc/__init__.py E501 E231
+ tests/test_utils_misc/__init__.py E501
diff --git a/scrapy/core/spidermw.py b/scrapy/core/spidermw.py
index b5f9837ff..00cee3ada 100644
--- a/scrapy/core/spidermw.py
+++ b/scrapy/core/spidermw.py
@@ -36,7 +36,7 @@ class SpiderMiddlewareManager(MiddlewareManager):
self.methods['process_spider_exception'].appendleft(getattr(mw, 'process_spider_exception', None))
def scrape_response(self, scrape_func, response, request, spider):
- fname = lambda f:'%s.%s' % (
+ fname = lambda f: '%s.%s' % (
six.get_method_self(f).__class__.__name__,
six.get_method_function(f).__name__)
diff --git a/tests/test_http_request.py b/tests/test_http_request.py
index 96a4fb141..45a547f40 100644
--- a/tests/test_http_request.py
+++ b/tests/test_http_request.py
@@ -56,7 +56,7 @@ class RequestTest(unittest.TestCase):
def test_headers(self):
# Different ways of setting headers attribute
url = 'http://www.scrapy.org'
- headers = {b'Accept':'gzip', b'Custom-Header':'nothing to tell you'}
+ headers = {b'Accept': 'gzip', b'Custom-Header': 'nothing to tell you'}
r = self.request_class(url=url, headers=headers)
p = self.request_class(url=url, headers=r.headers)
@@ -816,7 +816,7 @@ class FormRequestTest(RequestTest):
""")
- r1 = self.request_class.from_response(response, formdata={'two':'3'})
+ r1 = self.request_class.from_response(response, formdata={'two': '3'})
self.assertEqual(r1.method, 'POST')
self.assertEqual(r1.headers['Content-type'], b'application/x-www-form-urlencoded')
fs = _qs(r1)
diff --git a/tests/test_item.py b/tests/test_item.py
index 947566686..7c9468f65 100644
--- a/tests/test_item.py
+++ b/tests/test_item.py
@@ -245,7 +245,7 @@ class ItemTest(unittest.TestCase):
def test_copy(self):
class TestItem(Item):
name = Field()
- item = TestItem({'name':'lower'})
+ item = TestItem({'name': 'lower'})
copied_item = item.copy()
self.assertNotEqual(id(item), id(copied_item))
copied_item['name'] = copied_item['name'].upper()
diff --git a/tests/test_linkextractors.py b/tests/test_linkextractors.py
index d96e259f6..57ef1694a 100644
--- a/tests/test_linkextractors.py
+++ b/tests/test_linkextractors.py
@@ -322,7 +322,7 @@ class Base:
Link(url=page4_url, text=u'href with whitespaces'),
])
- lx = self.extractor_cls(attrs=("href","src"), tags=("a","area","img"), deny_extensions=())
+ lx = self.extractor_cls(attrs=("href", "src"), tags=("a", "area", "img"), deny_extensions=())
self.assertEqual(lx.extract_links(self.response), [
Link(url='http://example.com/sample1.html', text=u''),
Link(url='http://example.com/sample2.html', text=u'sample 2'),
@@ -360,7 +360,7 @@ class Base:
Link(url='http://example.com/sample2.html', text=u'sample 2'),
])
- lx = self.extractor_cls(tags=("a","img"), attrs=("href", "src"), deny_extensions=())
+ lx = self.extractor_cls(tags=("a", "img"), attrs=("href", "src"), deny_extensions=())
self.assertEqual(lx.extract_links(response), [
Link(url='http://example.com/sample2.html', text=u'sample 2'),
Link(url='http://example.com/sample2.jpg', text=u''),
diff --git a/tests/test_logformatter.py b/tests/test_logformatter.py
index eb9c4a561..b4ea30bb7 100644
--- a/tests/test_logformatter.py
+++ b/tests/test_logformatter.py
@@ -45,7 +45,7 @@ class LoggingContribTest(unittest.TestCase):
"Crawled (200) (referer: http://example.com) ['cached']")
def test_flags_in_request(self):
- req = Request("http://www.example.com", flags=['test','flag'])
+ req = Request("http://www.example.com", flags=['test', 'flag'])
res = Response("http://www.example.com")
logkws = self.formatter.crawled(req, res, self.spider)
logline = logkws['msg'] % logkws['args']
diff --git a/tests/test_utils_conf.py b/tests/test_utils_conf.py
index 29937c189..02d8ba51e 100644
--- a/tests/test_utils_conf.py
+++ b/tests/test_utils_conf.py
@@ -79,7 +79,7 @@ class BuildComponentListTest(unittest.TestCase):
self.assertRaises(ValueError, build_component_list, {}, d, convert=lambda x: x)
d = {'one': {'a': 'a', 'b': 2}}
self.assertRaises(ValueError, build_component_list, {}, d, convert=lambda x: x)
- d = {'one': 'lorem ipsum',}
+ d = {'one': 'lorem ipsum'}
self.assertRaises(ValueError, build_component_list, {}, d, convert=lambda x: x)
diff --git a/tests/test_utils_console.py b/tests/test_utils_console.py
index 65782747b..c2211848c 100644
--- a/tests/test_utils_console.py
+++ b/tests/test_utils_console.py
@@ -21,7 +21,7 @@ class UtilsConsoleTestCase(unittest.TestCase):
shell = get_shell_embed_func(['invalid'])
self.assertEqual(shell, None)
- shell = get_shell_embed_func(['invalid','python'])
+ shell = get_shell_embed_func(['invalid', 'python'])
self.assertTrue(callable(shell))
self.assertEqual(shell.__name__, '_embed_standard_shell')
diff --git a/tests/test_utils_misc/__init__.py b/tests/test_utils_misc/__init__.py
index e109d5343..de6f173e0 100644
--- a/tests/test_utils_misc/__init__.py
+++ b/tests/test_utils_misc/__init__.py
@@ -74,7 +74,7 @@ class UtilsMiscTestCase(unittest.TestCase):
self.assertEqual(list(arg_to_iter(100)), [100])
self.assertEqual(list(arg_to_iter(l for l in 'abc')), ['a', 'b', 'c'])
self.assertEqual(list(arg_to_iter([1, 2, 3])), [1, 2, 3])
- self.assertEqual(list(arg_to_iter({'a':1})), [{'a': 1}])
+ self.assertEqual(list(arg_to_iter({'a': 1})), [{'a': 1}])
self.assertEqual(list(arg_to_iter(TestItem(name="john"))), [TestItem(name="john")])
def test_create_instance(self):